Revert 99124: Revert 99099 Fix up more WaitForNavigation calls.
Revert task manager test. This one looks to be more complicated.
See http://codereview.chromium.org/7745037/ (original review)
[email protected]
BUG=None.
TEST=browser_tests,ui_tests
Review URL: http://codereview.chromium.org/7831020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100749 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc
index 1dcc950..2e37fd32 100644
--- a/chrome/browser/extensions/app_process_apitest.cc
+++ b/chrome/browser/extensions/app_process_apitest.cc
@@ -38,6 +38,8 @@
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 @@
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 @@
// 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 @@
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 @@
// 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());
}