diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-02 16:34:14 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-02 16:34:14 +0000 |
commit | 2c7c9029d4dcffbeb340a78611a1703bbc052e1d (patch) | |
tree | 92e39fe75113f90f9fb09e9746b94451097c4a94 /chrome/browser/history | |
parent | f29bbcd30f7e635372e25f299fc6c7efdf51e3c3 (diff) | |
download | chromium_src-2c7c9029d4dcffbeb340a78611a1703bbc052e1d.zip chromium_src-2c7c9029d4dcffbeb340a78611a1703bbc052e1d.tar.gz chromium_src-2c7c9029d4dcffbeb340a78611a1703bbc052e1d.tar.bz2 |
Remove most Sleeps from RedirectTest and wait properly.
Not fixing any Top15 flakiness, but removes the ugly polling pattern
and prevents it from being copy-pasted into new tests.
TEST=Covered by ui_tests.
BUG=none
Review URL: http://codereview.chromium.org/183037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25176 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r-- | chrome/browser/history/redirect_uitest.cc | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/chrome/browser/history/redirect_uitest.cc b/chrome/browser/history/redirect_uitest.cc index 30b63b2..f5f1622 100644 --- a/chrome/browser/history/redirect_uitest.cc +++ b/chrome/browser/history/redirect_uitest.cc @@ -58,10 +58,8 @@ TEST_F(RedirectTest, Client) { GURL first_url = server->TestServerPageW( std::wstring(L"client-redirect?") + UTF8ToWide(final_url.spec())); - // We need the sleep for the client redirects, because it appears as two - // page visits in the browser. - NavigateToURL(first_url); - PlatformThread::Sleep(action_timeout_ms()); + // The client redirect appears as two page visits in the browser. + NavigateToURLBlockUntilNavigationsComplete(first_url, 2); scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); @@ -78,8 +76,7 @@ TEST_F(RedirectTest, Client) { EXPECT_TRUE(final_url == tab_url); // Navigate one more time. - NavigateToURL(first_url); - PlatformThread::Sleep(action_timeout_ms()); + NavigateToURLBlockUntilNavigationsComplete(first_url, 2); // The address bar should still display the final URL. EXPECT_TRUE(tab_proxy->GetCurrentURL(&tab_url)); @@ -96,21 +93,13 @@ TEST_F(RedirectTest, ClientEmptyReferer) { test_file = test_file.AppendASCII("file_client_redirect.html"); GURL first_url = net::FilePathToFileURL(test_file); - NavigateToURL(first_url); - std::vector<GURL> redirects; - // We need the sleeps for the client redirects, because it appears as two - // page visits in the browser. And note for this test the browser actually - // loads the html file on disk, rather than just getting a response from - // the TestServer. - for (int i = 0; i < 10; ++i) { - PlatformThread::Sleep(sleep_timeout_ms()); - scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); - ASSERT_TRUE(tab_proxy.get()); - ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects)); - if (!redirects.empty()) - break; - } + // The client redirect appears as two page visits in the browser. + NavigateToURLBlockUntilNavigationsComplete(first_url, 2); + std::vector<GURL> redirects; + scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); + ASSERT_TRUE(tab_proxy.get()); + ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects)); ASSERT_EQ(1U, redirects.size()); EXPECT_EQ(final_url.spec(), redirects[0].spec()); } @@ -123,8 +112,8 @@ TEST_F(RedirectTest, ClientCancelled) { ASSERT_TRUE(file_util::AbsolutePath(&first_path)); GURL first_url = net::FilePathToFileURL(first_path); - NavigateToURL(first_url); - PlatformThread::Sleep(action_timeout_ms()); + // The client redirect appears as two page visits in the browser. + NavigateToURLBlockUntilNavigationsComplete(first_url, 2); scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); ASSERT_TRUE(tab_proxy.get()); @@ -244,15 +233,10 @@ TEST_F(RedirectTest, ClientFragments) { std::vector<GURL> redirects; NavigateToURL(first_url); - for (int i = 0; i < 10; ++i) { - PlatformThread::Sleep(sleep_timeout_ms()); - scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); - ASSERT_TRUE(tab_proxy.get()); - ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects)); - if (!redirects.empty()) - break; - } + scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); + ASSERT_TRUE(tab_proxy.get()); + ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects)); EXPECT_EQ(1U, redirects.size()); EXPECT_EQ(first_url.spec() + "#myanchor", redirects[0].spec()); } |