Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: chrome/browser/ui/webui/options2/options_ui2_uitest.cc

Issue 9814030: get rid of old options pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/options2/options_ui2_uitest.h" 5 #include "chrome/browser/ui/webui/options2/options_ui2_uitest.h"
6 6
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/common/url_constants.h" 9 #include "chrome/common/url_constants.h"
10 #include "chrome/test/automation/automation_proxy.h" 10 #include "chrome/test/automation/automation_proxy.h"
(...skipping 11 matching lines...) Expand all
22 void OptionsUITest::NavigateToSettings(scoped_refptr<TabProxy> tab) { 22 void OptionsUITest::NavigateToSettings(scoped_refptr<TabProxy> tab) {
23 const GURL& url = GURL(chrome::kChromeUISettingsURL); 23 const GURL& url = GURL(chrome::kChromeUISettingsURL);
24 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, 24 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
25 tab->NavigateToURLBlockUntilNavigationsComplete(url, 1)) << url.spec(); 25 tab->NavigateToURLBlockUntilNavigationsComplete(url, 1)) << url.spec();
26 } 26 }
27 27
28 void OptionsUITest::VerifyNavbar(scoped_refptr<TabProxy> tab) { 28 void OptionsUITest::VerifyNavbar(scoped_refptr<TabProxy> tab) {
29 bool navbar_exist = false; 29 bool navbar_exist = false;
30 EXPECT_TRUE(tab->ExecuteAndExtractBool(L"", 30 EXPECT_TRUE(tab->ExecuteAndExtractBool(L"",
31 L"domAutomationController.send(" 31 L"domAutomationController.send("
32 L"!!document.getElementById('navbar'))", &navbar_exist)); 32 L"!!document.getElementById('navigation'))", &navbar_exist));
33 EXPECT_EQ(true, navbar_exist); 33 EXPECT_EQ(true, navbar_exist);
34 } 34 }
35 35
36 void OptionsUITest::VerifyTitle(scoped_refptr<TabProxy> tab) { 36 void OptionsUITest::VerifyTitle(scoped_refptr<TabProxy> tab) {
37 std::wstring title; 37 std::wstring title;
38 EXPECT_TRUE(tab->GetTabTitle(&title)); 38 EXPECT_TRUE(tab->GetTabTitle(&title));
39 string16 expected_title = l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE); 39 string16 expected_title = l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE);
40 EXPECT_NE(WideToUTF16Hack(title).find(expected_title), string16::npos); 40 EXPECT_NE(WideToUTF16Hack(title).find(expected_title), string16::npos);
41 } 41 }
42 42
Dan Beam 2012/03/23 03:25:31 TODO(estade): Rewrite for uberpage?
43 void OptionsUITest::VerifySections(scoped_refptr<TabProxy> tab) {
44 #if defined(OS_CHROMEOS)
45 const int kExpectedSections = 1 + 7;
46 #else
47 const int kExpectedSections = 1 + 4;
48 #endif
49 int num_of_sections = 0;
50 EXPECT_TRUE(tab->ExecuteAndExtractInt(L"",
51 L"domAutomationController.send("
52 L"document.getElementById('navbar').children.length)", &num_of_sections));
53 EXPECT_EQ(kExpectedSections, num_of_sections);
54 }
55
56 TEST_F(OptionsUITest, LoadOptionsByURL) { 43 TEST_F(OptionsUITest, LoadOptionsByURL) {
57 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 44 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
58 ASSERT_TRUE(browser.get()); 45 ASSERT_TRUE(browser.get());
59 46
60 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); 47 scoped_refptr<TabProxy> tab = browser->GetActiveTab();
61 ASSERT_TRUE(tab.get()); 48 ASSERT_TRUE(tab.get());
62 49
63 NavigateToSettings(tab); 50 NavigateToSettings(tab);
64 VerifyTitle(tab); 51 VerifyTitle(tab);
65 VerifyNavbar(tab); 52 VerifyNavbar(tab);
66 VerifySections(tab);
67 } 53 }
68 54
69 } // namespace options2 55 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698