| Index: chrome/browser/ssl/ssl_browser_tests.cc
|
| ===================================================================
|
| --- chrome/browser/ssl/ssl_browser_tests.cc (revision 96616)
|
| +++ chrome/browser/ssl/ssl_browser_tests.cc (working copy)
|
| @@ -16,7 +16,6 @@
|
| #include "content/browser/tab_contents/interstitial_page.h"
|
| #include "content/browser/tab_contents/navigation_entry.h"
|
| #include "content/browser/tab_contents/tab_contents.h"
|
| -#include "content/common/notification_service.h"
|
| #include "net/base/cert_status_flags.h"
|
| #include "net/test/test_server.h"
|
|
|
| @@ -117,11 +116,9 @@
|
| void ProceedThroughInterstitial(TabContents* tab) {
|
| InterstitialPage* interstitial_page = tab->interstitial_page();
|
| ASSERT_TRUE(interstitial_page);
|
| - ui_test_utils::WindowedNotificationObserver observer(
|
| - content::NOTIFICATION_LOAD_STOP,
|
| - Source<NavigationController>(&tab->controller()));
|
| interstitial_page->Proceed();
|
| - observer.Wait();
|
| + // Wait for the navigation to be done.
|
| + ui_test_utils::WaitForNavigation(&(tab->controller()));
|
| }
|
|
|
| static bool GetFilePathWithHostAndPortReplacement(
|
| @@ -414,13 +411,8 @@
|
| ASSERT_TRUE(entry2);
|
|
|
| // Now go back so that a page is in the forward history.
|
| - {
|
| - ui_test_utils::WindowedNotificationObserver observer(
|
| - content::NOTIFICATION_LOAD_STOP,
|
| - Source<NavigationController>(&tab->controller()));
|
| - tab->controller().GoBack();
|
| - observer.Wait();
|
| - }
|
| + tab->controller().GoBack();
|
| + ui_test_utils::WaitForNavigation(&(tab->controller()));
|
| ASSERT_TRUE(tab->controller().CanGoForward());
|
| NavigationEntry* entry3 = tab->controller().GetActiveEntry();
|
| ASSERT_TRUE(entry1 == entry3);
|
| @@ -432,13 +424,8 @@
|
| true); // Interstitial showing
|
|
|
| // Simulate user clicking and holding on forward button.
|
| - {
|
| - ui_test_utils::WindowedNotificationObserver observer(
|
| - content::NOTIFICATION_LOAD_STOP,
|
| - Source<NavigationController>(&tab->controller()));
|
| - tab->controller().GoToOffset(1);
|
| - observer.Wait();
|
| - }
|
| + tab->controller().GoToOffset(1);
|
| + ui_test_utils::WaitForNavigation(&(tab->controller()));
|
|
|
| // We should be showing the second good page.
|
| EXPECT_FALSE(browser()->GetSelectedTabContents()->interstitial_page());
|
| @@ -610,11 +597,9 @@
|
| params.disposition = NEW_FOREGROUND_TAB;
|
| params.tabstrip_index = 0;
|
| params.source_contents = tab1;
|
| - ui_test_utils::WindowedNotificationObserver observer(
|
| - content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
|
| browser::Navigate(¶ms);
|
| TabContentsWrapper* tab2 = params.target_contents;
|
| - observer.Wait();
|
| + ui_test_utils::WaitForNavigation(&(tab2->controller()));
|
|
|
| // The new tab has insecure content.
|
| CheckAuthenticatedState(tab2->tab_contents(), true);
|
| @@ -649,11 +634,9 @@
|
| browser::NavigateParams params(browser(), url, PageTransition::TYPED);
|
| params.disposition = NEW_FOREGROUND_TAB;
|
| params.source_contents = tab1;
|
| - ui_test_utils::WindowedNotificationObserver observer(
|
| - content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
|
| browser::Navigate(¶ms);
|
| TabContentsWrapper* tab2 = params.target_contents;
|
| - observer.Wait();
|
| + ui_test_utils::WaitForNavigation(&(tab2->controller()));
|
|
|
| // The new tab has insecure content.
|
| CheckAuthenticationBrokenState(tab2->tab_contents(), 0, true, false);
|
| @@ -824,10 +807,9 @@
|
| // Let's add another tab to make sure the browser does not exit when we close
|
| // the first tab.
|
| GURL url = test_server()->GetURL("files/ssl/google.html");
|
| - ui_test_utils::WindowedNotificationObserver observer(
|
| - content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
|
| - browser()->AddSelectedTabWithURL(url, PageTransition::TYPED);
|
| - observer.Wait();
|
| + TabContentsWrapper* tab2 =
|
| + browser()->AddSelectedTabWithURL(url, PageTransition::TYPED);
|
| + ui_test_utils::WaitForNavigation(&(tab2->controller()));
|
|
|
| // Close the first tab.
|
| browser()->CloseTabContents(tab1);
|
| @@ -970,33 +952,23 @@
|
|
|
| bool success = false;
|
| // Now navigate inside the frame.
|
| - {
|
| - ui_test_utils::WindowedNotificationObserver observer(
|
| - content::NOTIFICATION_LOAD_STOP,
|
| - Source<NavigationController>(&tab->controller()));
|
| - EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - tab->render_view_host(), std::wstring(),
|
| - L"window.domAutomationController.send(clickLink('goodHTTPSLink'));",
|
| - &success));
|
| - ASSERT_TRUE(success);
|
| - observer.Wait();
|
| - }
|
| + EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| + tab->render_view_host(), std::wstring(),
|
| + L"window.domAutomationController.send(clickLink('goodHTTPSLink'));",
|
| + &success));
|
| + EXPECT_TRUE(success);
|
| + ui_test_utils::WaitForNavigation(&tab->controller());
|
|
|
| // We should still be fine.
|
| CheckAuthenticatedState(tab, false);
|
|
|
| // Now let's hit a bad page.
|
| - {
|
| - ui_test_utils::WindowedNotificationObserver observer(
|
| - content::NOTIFICATION_LOAD_STOP,
|
| - Source<NavigationController>(&tab->controller()));
|
| - EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - tab->render_view_host(), std::wstring(),
|
| - L"window.domAutomationController.send(clickLink('badHTTPSLink'));",
|
| - &success));
|
| - ASSERT_TRUE(success);
|
| - observer.Wait();
|
| - }
|
| + EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| + tab->render_view_host(), std::wstring(),
|
| + L"window.domAutomationController.send(clickLink('badHTTPSLink'));",
|
| + &success));
|
| + EXPECT_TRUE(success);
|
| + ui_test_utils::WaitForNavigation(&tab->controller());
|
|
|
| // The security style should still be secure.
|
| CheckAuthenticatedState(tab, false);
|
| @@ -1012,39 +984,24 @@
|
| EXPECT_FALSE(is_content_evil);
|
|
|
| // Now go back, our state should still be OK.
|
| - {
|
| - ui_test_utils::WindowedNotificationObserver observer(
|
| - content::NOTIFICATION_LOAD_STOP,
|
| - Source<NavigationController>(&tab->controller()));
|
| - tab->controller().GoBack();
|
| - observer.Wait();
|
| - }
|
| + tab->controller().GoBack();
|
| + ui_test_utils::WaitForNavigation(&tab->controller());
|
| CheckAuthenticatedState(tab, false);
|
|
|
| // Navigate to a page served over HTTP.
|
| - {
|
| - ui_test_utils::WindowedNotificationObserver observer(
|
| - content::NOTIFICATION_LOAD_STOP,
|
| - Source<NavigationController>(&tab->controller()));
|
| - EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - tab->render_view_host(), std::wstring(),
|
| - L"window.domAutomationController.send(clickLink('HTTPLink'));",
|
| - &success));
|
| - ASSERT_TRUE(success);
|
| - observer.Wait();
|
| - }
|
| + EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| + tab->render_view_host(), std::wstring(),
|
| + L"window.domAutomationController.send(clickLink('HTTPLink'));",
|
| + &success));
|
| + EXPECT_TRUE(success);
|
| + ui_test_utils::WaitForNavigation(&tab->controller());
|
|
|
| // Our state should be insecure.
|
| CheckAuthenticatedState(tab, true);
|
|
|
| // Go back, our state should be unchanged.
|
| - {
|
| - ui_test_utils::WindowedNotificationObserver observer(
|
| - content::NOTIFICATION_LOAD_STOP,
|
| - Source<NavigationController>(&tab->controller()));
|
| - tab->controller().GoBack();
|
| - observer.Wait();
|
| - }
|
| + tab->controller().GoBack();
|
| + ui_test_utils::WaitForNavigation(&tab->controller());
|
| CheckAuthenticatedState(tab, true);
|
| }
|
|
|
| @@ -1071,15 +1028,12 @@
|
|
|
| // Navigate to a good frame.
|
| bool success = false;
|
| - ui_test_utils::WindowedNotificationObserver observer(
|
| - content::NOTIFICATION_LOAD_STOP,
|
| - Source<NavigationController>(&tab->controller()));
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| tab->render_view_host(), std::wstring(),
|
| L"window.domAutomationController.send(clickLink('goodHTTPSLink'));",
|
| &success));
|
| - ASSERT_TRUE(success);
|
| - observer.Wait();
|
| + EXPECT_TRUE(success);
|
| + ui_test_utils::WaitForNavigation(&tab->controller());
|
|
|
| // We should still be authentication broken.
|
| CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
|
| @@ -1106,35 +1060,24 @@
|
| CheckUnauthenticatedState(tab);
|
|
|
| // Now navigate inside the frame to a secure HTTPS frame.
|
| - {
|
| - bool success = false;
|
| - ui_test_utils::WindowedNotificationObserver observer(
|
| - content::NOTIFICATION_LOAD_STOP,
|
| - Source<NavigationController>(&tab->controller()));
|
| - EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - tab->render_view_host(), std::wstring(),
|
| - L"window.domAutomationController.send(clickLink('goodHTTPSLink'));",
|
| - &success));
|
| - ASSERT_TRUE(success);
|
| - observer.Wait();
|
| - }
|
| + bool success = false;
|
| + EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| + tab->render_view_host(), std::wstring(),
|
| + L"window.domAutomationController.send(clickLink('goodHTTPSLink'));",
|
| + &success));
|
| + EXPECT_TRUE(success);
|
| + ui_test_utils::WaitForNavigation(&tab->controller());
|
|
|
| // We should still be unauthenticated.
|
| CheckUnauthenticatedState(tab);
|
|
|
| // Now navigate to a bad HTTPS frame.
|
| - {
|
| - bool success = false;
|
| - ui_test_utils::WindowedNotificationObserver observer(
|
| - content::NOTIFICATION_LOAD_STOP,
|
| - Source<NavigationController>(&tab->controller()));
|
| - EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - tab->render_view_host(), std::wstring(),
|
| - L"window.domAutomationController.send(clickLink('badHTTPSLink'));",
|
| - &success));
|
| - ASSERT_TRUE(success);
|
| - observer.Wait();
|
| - }
|
| + EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| + tab->render_view_host(), std::wstring(),
|
| + L"window.domAutomationController.send(clickLink('badHTTPSLink'));",
|
| + &success));
|
| + EXPECT_TRUE(success);
|
| + ui_test_utils::WaitForNavigation(&tab->controller());
|
|
|
| // State should not have changed.
|
| CheckUnauthenticatedState(tab);
|
|
|