summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-08 07:15:16 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-08 07:15:16 +0000
commit36589350415ced89e716015330fe210a8fcfd180 (patch)
tree95673c9f4a7aebe659a3500902c7480ecbe10d2b /chrome/browser/dom_ui
parent93b86a850b7b1b3f46a7c4fc4521fefa8ca56e8d (diff)
downloadchromium_src-36589350415ced89e716015330fe210a8fcfd180.zip
chromium_src-36589350415ced89e716015330fe210a8fcfd180.tar.gz
chromium_src-36589350415ced89e716015330fe210a8fcfd180.tar.bz2
[GTTF] Tests cleanup:
- use timeouts correctly - use more automation methods to make test code more clear - use more reliable ways of waiting - remove unnecessary automation calls TEST=none BUG=none Review URL: http://codereview.chromium.org/1553016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43932 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/bookmarks_ui_uitest.cc11
-rw-r--r--chrome/browser/dom_ui/new_tab_ui_uitest.cc17
2 files changed, 8 insertions, 20 deletions
diff --git a/chrome/browser/dom_ui/bookmarks_ui_uitest.cc b/chrome/browser/dom_ui/bookmarks_ui_uitest.cc
index 77f7f38..3e3ac33 100644
--- a/chrome/browser/dom_ui/bookmarks_ui_uitest.cc
+++ b/chrome/browser/dom_ui/bookmarks_ui_uitest.cc
@@ -21,7 +21,7 @@ class BookmarksUITest : public UITest {
L"domAutomationController.send("
L" location.protocol == 'chrome-extension:' && "
L" document.readyState == 'complete')",
- UITest::test_timeout_ms());
+ test_timeout_ms());
}
scoped_refptr<TabProxy> GetBookmarksUITab() {
@@ -110,8 +110,7 @@ TEST_F(BookmarksUITest, CommandAgainGoesBackToBookmarksTab) {
// Bring up the bookmarks manager tab.
ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER));
- ASSERT_TRUE(browser->WaitForTabToBecomeActive(1,
- UITest::action_max_timeout_ms()));
+ ASSERT_TRUE(browser->WaitForTabToBecomeActive(1, action_max_timeout_ms()));
ASSERT_TRUE(browser->GetTabCount(&tab_count));
ASSERT_EQ(2, tab_count);
@@ -122,13 +121,11 @@ TEST_F(BookmarksUITest, CommandAgainGoesBackToBookmarksTab) {
// Switch to first tab and run command again.
ASSERT_TRUE(browser->ActivateTab(0));
- ASSERT_TRUE(browser->WaitForTabToBecomeActive(0,
- UITest::action_max_timeout_ms()));
+ ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms()));
ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER));
// Ensure the bookmarks ui tab is active.
- ASSERT_TRUE(browser->WaitForTabToBecomeActive(1,
- UITest::action_max_timeout_ms()));
+ ASSERT_TRUE(browser->WaitForTabToBecomeActive(1, action_max_timeout_ms()));
ASSERT_TRUE(browser->GetTabCount(&tab_count));
ASSERT_EQ(2, tab_count);
}
diff --git a/chrome/browser/dom_ui/new_tab_ui_uitest.cc b/chrome/browser/dom_ui/new_tab_ui_uitest.cc
index 7d7531e..0b8f380 100644
--- a/chrome/browser/dom_ui/new_tab_ui_uitest.cc
+++ b/chrome/browser/dom_ui/new_tab_ui_uitest.cc
@@ -43,19 +43,10 @@ TEST_F(NewTabUITest, NTPHasThumbnails) {
scoped_refptr<TabProxy> tab = window->GetActiveTab();
ASSERT_TRUE(tab.get());
- int filler_thumbnails_count = -1;
- int wait_time = action_max_timeout_ms();
- while (wait_time > 0) {
- ASSERT_TRUE(tab->ExecuteAndExtractInt(L"",
- L"window.domAutomationController.send("
- L"document.getElementsByClassName('filler').length)",
- &filler_thumbnails_count));
- if (filler_thumbnails_count == 0)
- break;
- PlatformThread::Sleep(sleep_timeout_ms());
- wait_time -= sleep_timeout_ms();
- }
- EXPECT_EQ(0, filler_thumbnails_count);
+ ASSERT_TRUE(WaitUntilJavaScriptCondition(tab, L"",
+ L"window.domAutomationController.send("
+ L"document.getElementsByClassName('filler').length == 0)",
+ action_max_timeout_ms()));
}
TEST_F(NewTabUITest, ChromeInternalLoadsNTP) {