options_ui_browsertest.cc revision 868fa2fe829687343ffae624259930155e16dbd8
1// Copyright (c) 2012 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "chrome/browser/ui/webui/options/options_ui_browsertest.h" 6 7#include "base/strings/string16.h" 8#include "base/strings/utf_string_conversions.h" 9#include "chrome/browser/ui/browser.h" 10#include "chrome/browser/ui/tabs/tab_strip_model.h" 11#include "chrome/common/url_constants.h" 12#include "chrome/test/base/ui_test_utils.h" 13#include "content/public/browser/web_contents.h" 14#include "content/public/test/browser_test_utils.h" 15#include "grit/generated_resources.h" 16#include "ui/base/l10n/l10n_util.h" 17 18namespace options { 19 20OptionsBrowserTest::OptionsBrowserTest() { 21} 22 23void OptionsBrowserTest::NavigateToSettings() { 24 const GURL& url = GURL(chrome::kChromeUISettingsURL); 25 ui_test_utils::NavigateToURL(browser(), url); 26} 27 28void OptionsBrowserTest::VerifyNavbar() { 29 bool navbar_exist = false; 30 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 31 browser()->tab_strip_model()->GetActiveWebContents(), 32 "domAutomationController.send(" 33 " !!document.getElementById('navigation'))", 34 &navbar_exist)); 35 EXPECT_EQ(true, navbar_exist); 36} 37 38void OptionsBrowserTest::VerifyTitle() { 39 string16 title = 40 browser()->tab_strip_model()->GetActiveWebContents()->GetTitle(); 41 string16 expected_title = l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE); 42 EXPECT_NE(title.find(expected_title), string16::npos); 43} 44 45// Flaky, see http://crbug.com/119671. 46IN_PROC_BROWSER_TEST_F(OptionsBrowserTest, DISABLED_LoadOptionsByURL) { 47 NavigateToSettings(); 48 VerifyTitle(); 49 VerifyNavbar(); 50} 51 52} // namespace options 53