diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-15 00:02:40 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-15 00:02:40 +0000 |
commit | b7a20d363af744159a2bb85bfe3db027d2d4819e (patch) | |
tree | 14a363b284d4456d6c0a4888a6b944af3e10b490 /chrome/test | |
parent | 3f58d855ccb7c29abd2fd73cb60e11089abe8dd1 (diff) | |
download | chromium_src-b7a20d363af744159a2bb85bfe3db027d2d4819e.zip chromium_src-b7a20d363af744159a2bb85bfe3db027d2d4819e.tar.gz chromium_src-b7a20d363af744159a2bb85bfe3db027d2d4819e.tar.bz2 |
Convert parts of errorpage_uitest.cc to be not flaky.
TEST=Covered by browser_tests.
http://crbug.com/19361, http://crbug.com/19395
Review URL: http://codereview.chromium.org/169002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23500 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/in_process_browser_test.cc | 5 | ||||
-rw-r--r-- | chrome/test/ui_test_utils.cc | 26 | ||||
-rw-r--r-- | chrome/test/ui_test_utils.h | 13 |
3 files changed, 31 insertions, 13 deletions
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc index 6c07e41..0c58c55 100644 --- a/chrome/test/in_process_browser_test.cc +++ b/chrome/test/in_process_browser_test.cc @@ -243,7 +243,12 @@ void InProcessBrowserTest::RunTestOnMainThreadLoop() { void InProcessBrowserTest::ConfigureHostResolverProc( net::RuleBasedHostResolverProc* host_resolver_proc) { + // TODO(phajdan.jr): remove, http://crbug.com/2635 host_resolver_proc->AllowDirectLookup("*.google.com"); + + // TODO(phajdan.jr): remove, http://crbug.com/18365 + host_resolver_proc->AllowDirectLookup("*.gstatic.com"); + // See http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol // We don't want the test code to use it. host_resolver_proc->AddSimulatedFailure("wpad"); diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc index 928ff87..543828b 100644 --- a/chrome/test/ui_test_utils.cc +++ b/chrome/test/ui_test_utils.cc @@ -282,6 +282,23 @@ bool GetCurrentTabTitle(const Browser* browser, string16* title) { return true; } +bool WaitForNavigationInCurrentTab(Browser* browser) { + TabContents* tab_contents = browser->GetSelectedTabContents(); + if (!tab_contents) + return false; + WaitForNavigation(&tab_contents->controller()); + return true; +} + +bool WaitForNavigationsInCurrentTab(Browser* browser, + int number_of_navigations) { + TabContents* tab_contents = browser->GetSelectedTabContents(); + if (!tab_contents) + return false; + WaitForNavigations(&tab_contents->controller(), number_of_navigations); + return true; +} + void WaitForNavigation(NavigationController* controller) { WaitForNavigations(controller, 1); } @@ -304,15 +321,6 @@ void NavigateToURLBlockUntilNavigationsComplete(Browser* browser, WaitForNavigations(controller, number_of_navigations); } -bool ReloadCurrentTab(Browser* browser) { - browser->Reload(); - TabContents* tab_contents = browser->GetSelectedTabContents(); - if (!tab_contents) - return false; - WaitForNavigation(&tab_contents->controller()); - return true; -} - Value* ExecuteJavaScript(RenderViewHost* render_view_host, const std::wstring& frame_xpath, const std::wstring& original_script) { diff --git a/chrome/test/ui_test_utils.h b/chrome/test/ui_test_utils.h index 952cf5f..94e4235 100644 --- a/chrome/test/ui_test_utils.h +++ b/chrome/test/ui_test_utils.h @@ -31,6 +31,15 @@ void RunMessageLoop(); // Puts the current tab title in |title|. Returns true on success. bool GetCurrentTabTitle(const Browser* browser, string16* title); +// Waits for the current tab to complete the navigation. Returns true on +// success. +bool WaitForNavigationInCurrentTab(Browser* browser); + +// Waits for the current tab to complete the specified number of navigations. +// Returns true on success. +bool WaitForNavigationsInCurrentTab(Browser* browser, + int number_of_navigations); + // Waits for |controller| to complete a navigation. This blocks until // the navigation finishes. void WaitForNavigation(NavigationController* controller); @@ -44,10 +53,6 @@ void WaitForNavigations(NavigationController* controller, // navigation finishes. void NavigateToURL(Browser* browser, const GURL& url); -// Reloads current tab contents and waits for navigation to finish. -// Returns true on success. -bool ReloadCurrentTab(Browser* browser); - // Navigates the selected tab of |browser| to |url|, blocking until the // number of navigations specified complete. void NavigateToURLBlockUntilNavigationsComplete(Browser* browser, |