diff options
author | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 02:06:48 +0000 |
---|---|---|
committer | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 02:06:48 +0000 |
commit | c3f7c5b0645559a8c76399317089fa6d29662539 (patch) | |
tree | 9f7df58680d03fc2dc63a2c94e7389f34c1081f2 /chrome/browser/extensions/app_process_apitest.cc | |
parent | b73bee8b9662814944d45fb1677cd28cad8dc812 (diff) | |
download | chromium_src-c3f7c5b0645559a8c76399317089fa6d29662539.zip chromium_src-c3f7c5b0645559a8c76399317089fa6d29662539.tar.gz chromium_src-c3f7c5b0645559a8c76399317089fa6d29662539.tar.bz2 |
Fix up more WaitForNavigation calls. Almost all fixed now.
R=phajdan.jr@chromium.org
BUG=None.
TEST=brower_tests,ui_tests
Review URL: http://codereview.chromium.org/7745037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99099 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/app_process_apitest.cc')
-rw-r--r-- | chrome/browser/extensions/app_process_apitest.cc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc index 1dcc950..2e37fd3 100644 --- a/chrome/browser/extensions/app_process_apitest.cc +++ b/chrome/browser/extensions/app_process_apitest.cc @@ -38,6 +38,8 @@ static void WindowOpenHelper(Browser* browser, RenderViewHost* opener_host, const GURL& url, bool newtab_process_should_equal_opener) { + ui_test_utils::WindowedNotificationObserver observer( + content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( opener_host, L"", L"window.open('" + UTF8ToWide(url.spec()) + L"');")); @@ -48,9 +50,7 @@ static void WindowOpenHelper(Browser* browser, EXPECT_TRUE(last_active_browser); TabContents* newtab = last_active_browser->GetSelectedTabContents(); EXPECT_TRUE(newtab); - if (!newtab->controller().GetLastCommittedEntry() || - newtab->controller().GetLastCommittedEntry()->url() != url) - ui_test_utils::WaitForNavigation(&newtab->controller()); + observer.Wait(); EXPECT_EQ(url, newtab->controller().GetLastCommittedEntry()->url()); if (newtab_process_should_equal_opener) EXPECT_EQ(opener_host->process(), newtab->render_view_host()->process()); @@ -61,6 +61,9 @@ static void WindowOpenHelper(Browser* browser, // Simulates a page navigating itself to an URL, and waits for the navigation. static void NavigateTabHelper(TabContents* contents, const GURL& url) { bool result = false; + ui_test_utils::WindowedNotificationObserver observer( + content::NOTIFICATION_LOAD_STOP, + NotificationService::AllSources()); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( contents->render_view_host(), L"", L"window.addEventListener('unload', function() {" @@ -69,10 +72,7 @@ static void NavigateTabHelper(TabContents* contents, const GURL& url) { L"window.location = '" + UTF8ToWide(url.spec()) + L"';", &result)); ASSERT_TRUE(result); - - if (!contents->controller().GetLastCommittedEntry() || - contents->controller().GetLastCommittedEntry()->url() != url) - ui_test_utils::WaitForNavigation(&contents->controller()); + observer.Wait(); EXPECT_EQ(url, contents->controller().GetLastCommittedEntry()->url()); } @@ -285,16 +285,20 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadIntoAppProcess) { // Enable app and reload via JavaScript. EnableExtension(app->id()); + ui_test_utils::WindowedNotificationObserver observer( + content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->render_view_host(), L"", L"location.reload();")); - ui_test_utils::WaitForNavigation(&contents->controller()); + observer.Wait(); EXPECT_TRUE(contents->render_view_host()->process()->is_extension_process()); // Disable app and reload via JavaScript. DisableExtension(app->id()); + ui_test_utils::WindowedNotificationObserver observer2( + content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->render_view_host(), L"", L"location.reload();")); - ui_test_utils::WaitForNavigation(&contents->controller()); + observer2.Wait(); EXPECT_FALSE(contents->render_view_host()->process()->is_extension_process()); } |