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

Unified Diff: chrome/browser/ui/webui/options/options_ui_uitest.cc

Issue 7038026: Add a NavBarCheck test case for OptionsUITest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/options_ui_uitest.cc
diff --git a/chrome/browser/ui/webui/options/options_ui_uitest.cc b/chrome/browser/ui/webui/options/options_ui_uitest.cc
index 9ceaac93b181c21066f5145fbba470d85c1872b0..22042ae1adf0cb9ece902e4696e5f108c8fff9b9 100644
--- a/chrome/browser/ui/webui/options/options_ui_uitest.cc
+++ b/chrome/browser/ui/webui/options/options_ui_uitest.cc
@@ -25,6 +25,34 @@ class OptionsUITest : public UITest {
dom_automation_enabled_ = true;
}
+ bool WaitForOptionsUI(TabProxy* tab) {
+ return WaitUntilJavaScriptCondition(tab, L"",
+ L"domAutomationController.send("
+ L" location.protocol == 'chrome:' && "
+ L" document.readyState == 'complete')",
+ TestTimeouts::huge_test_timeout_ms());
+ }
+
+ scoped_refptr<TabProxy> GetOptionsUITab() {
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ EXPECT_TRUE(browser.get());
+ if (!browser.get())
+ return NULL;
+ scoped_refptr<TabProxy> tab = browser->GetActiveTab();
+ EXPECT_TRUE(tab.get());
+ if (!tab.get())
+ return NULL;
+ bool success = tab->NavigateToURL(GURL(chrome::kChromeUISettingsURL));
+ EXPECT_TRUE(success);
+ if (!success)
+ return NULL;
+ success = WaitForOptionsUI(tab);
+ EXPECT_TRUE(success);
+ if (!success)
+ return NULL;
+ return tab;
+ }
+
void AssertIsOptionsPage(TabProxy* tab) {
std::wstring title;
ASSERT_TRUE(tab->GetTabTitle(&title));
@@ -35,16 +63,9 @@ class OptionsUITest : public UITest {
}
};
-// Flaky: http://crbug.com/77375
-TEST_F(OptionsUITest, FLAKY_LoadOptionsByURL) {
- scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
- ASSERT_TRUE(browser.get());
-
- scoped_refptr<TabProxy> tab = browser->GetActiveTab();
+TEST_F(OptionsUITest, LoadOptionsByURL) {
+ scoped_refptr<TabProxy> tab = GetOptionsUITab();
ASSERT_TRUE(tab.get());
-
- // Go to the options tab via URL.
- NavigateToURL(GURL(chrome::kChromeUISettingsURL));
AssertIsOptionsPage(tab);
}
@@ -113,4 +134,34 @@ TEST_F(OptionsUITest, DISABLED_TwoCommandsOneTab) {
ASSERT_EQ(2, tab_count);
}
+// Navigates to settings page and do sanity check on settings sections.
+TEST_F(OptionsUITest, NavBarCheck) {
+ scoped_refptr<TabProxy> tab = GetOptionsUITab();
+ ASSERT_TRUE(tab.get());
+ AssertIsOptionsPage(tab);
+
+ // Check navbar's existence.
+ bool navbar_exist = false;
+ ASSERT_TRUE(tab->ExecuteAndExtractBool(L"",
+ L"domAutomationController.send("
+ L"!!document.getElementById('navbar'))", &navbar_exist));
+ ASSERT_EQ(true, navbar_exist);
+
+ // Check section headers in navbar.
+ // For ChromeOS, there should be 1 + 6:
+ // search, basics, personal, systerm, internet, under the hood and users
+ // For other platforms, there should 1 + 3:
+ // search, basics, personal and under the hood.
+#if defined(OS_CHROMEOS)
+ const int kExpectedSections = 1 + 6;
+#else
+ const int kExpectedSections = 1 + 3;
+#endif
+ int num_of_sections = 0;
+ ASSERT_TRUE(tab->ExecuteAndExtractInt(L"",
+ L"domAutomationController.send("
+ L"document.getElementById('navbar').children.length)", &num_of_sections));
+ ASSERT_EQ(kExpectedSections, num_of_sections);
+}
+
} // namespace
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698