| Index: chrome/browser/ssl/ssl_browser_tests.cc
|
| ===================================================================
|
| --- chrome/browser/ssl/ssl_browser_tests.cc (revision 145001)
|
| +++ chrome/browser/ssl/ssl_browser_tests.cc (working copy)
|
| @@ -12,6 +12,7 @@
|
| #include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/browser_commands.h"
|
| #include "chrome/browser/ui/browser_navigator.h"
|
| +#include "chrome/browser/ui/browser_tabstrip.h"
|
| #include "chrome/browser/ui/constrained_window_tab_helper.h"
|
| #include "chrome/browser/ui/tab_contents/tab_contents.h"
|
| #include "chrome/browser/ui/tabs/tab_strip_model.h"
|
| @@ -199,7 +200,7 @@
|
| }
|
|
|
| int GetConstrainedWindowCount() const {
|
| - return static_cast<int>(browser()->GetActiveTabContents()->
|
| + return static_cast<int>(chrome::GetActiveTabContents(browser())->
|
| constrained_window_tab_helper()->constrained_window_count());
|
| }
|
|
|
| @@ -303,7 +304,7 @@
|
| ui_test_utils::NavigateToURL(browser(),
|
| test_server()->GetURL("files/ssl/google.html"));
|
|
|
| - CheckUnauthenticatedState(browser()->GetActiveWebContents());
|
| + CheckUnauthenticatedState(chrome::GetActiveWebContents(browser()));
|
| }
|
|
|
| // Visits a page over http which includes broken https resources (status should
|
| @@ -323,7 +324,7 @@
|
| ui_test_utils::NavigateToURL(
|
| browser(), test_server()->GetURL(replacement_path));
|
|
|
| - CheckUnauthenticatedState(browser()->GetActiveWebContents());
|
| + CheckUnauthenticatedState(chrome::GetActiveWebContents(browser()));
|
| }
|
|
|
| // http://crbug.com/91745
|
| @@ -340,7 +341,7 @@
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server_.GetURL("files/ssl/google.html"));
|
|
|
| - CheckAuthenticatedState(browser()->GetActiveWebContents(), false);
|
| + CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), false);
|
| }
|
|
|
| // Visits a page with https error and proceed:
|
| @@ -350,7 +351,7 @@
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server_expired_.GetURL("files/ssl/google.html"));
|
|
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
|
| true); // Interstitial showing
|
|
|
| @@ -371,7 +372,7 @@
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server_.GetURL("files/ssl/google.html"));
|
|
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| NavigationEntry* entry = tab->GetController().GetActiveEntry();
|
| ASSERT_TRUE(entry);
|
|
|
| @@ -415,7 +416,7 @@
|
| // First navigate to an HTTP page.
|
| ui_test_utils::NavigateToURL(browser(),
|
| test_server()->GetURL("files/ssl/google.html"));
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| NavigationEntry* entry = tab->GetController().GetActiveEntry();
|
| ASSERT_TRUE(entry);
|
|
|
| @@ -437,7 +438,7 @@
|
| tab->GetRenderViewHost()));
|
|
|
| // We should be back at the original good page.
|
| - EXPECT_FALSE(browser()->GetActiveWebContents()->GetInterstitialPage());
|
| + EXPECT_FALSE(chrome::GetActiveWebContents(browser())->GetInterstitialPage());
|
| CheckUnauthenticatedState(tab);
|
| }
|
|
|
| @@ -451,7 +452,7 @@
|
| // First navigate to an HTTP page.
|
| ui_test_utils::NavigateToURL(browser(),
|
| test_server()->GetURL("files/ssl/google.html"));
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| NavigationEntry* entry = tab->GetController().GetActiveEntry();
|
| ASSERT_TRUE(entry);
|
|
|
| @@ -465,7 +466,7 @@
|
| tab->GetController().GoToOffset(-1);
|
|
|
| // We should be back at the original good page.
|
| - EXPECT_FALSE(browser()->GetActiveWebContents()->GetInterstitialPage());
|
| + EXPECT_FALSE(chrome::GetActiveWebContents(browser())->GetInterstitialPage());
|
| CheckUnauthenticatedState(tab);
|
| }
|
|
|
| @@ -477,7 +478,7 @@
|
| // First navigate to two HTTP pages.
|
| ui_test_utils::NavigateToURL(browser(),
|
| test_server()->GetURL("files/ssl/google.html"));
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| NavigationEntry* entry1 = tab->GetController().GetActiveEntry();
|
| ASSERT_TRUE(entry1);
|
| ui_test_utils::NavigateToURL(browser(),
|
| @@ -513,7 +514,7 @@
|
| }
|
|
|
| // We should be showing the second good page.
|
| - EXPECT_FALSE(browser()->GetActiveWebContents()->GetInterstitialPage());
|
| + EXPECT_FALSE(chrome::GetActiveWebContents(browser())->GetInterstitialPage());
|
| CheckUnauthenticatedState(tab);
|
| EXPECT_FALSE(tab->GetController().CanGoForward());
|
| NavigationEntry* entry4 = tab->GetController().GetActiveEntry();
|
| @@ -528,7 +529,7 @@
|
| ASSERT_TRUE(https_server_expired_.Start());
|
|
|
| // Setup page title observer.
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| ui_test_utils::TitleWatcher watcher(tab, ASCIIToUTF16("PASS"));
|
| watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
|
|
|
| @@ -545,8 +546,8 @@
|
| // Create tabs and visit pages which keep on creating wss connections.
|
| TabContents* tabs[16];
|
| for (int i = 0; i < 16; ++i) {
|
| - tabs[i] = browser()->AddSelectedTabWithURL(
|
| - slaveUrl, content::PAGE_TRANSITION_LINK);
|
| + tabs[i] = chrome::AddSelectedTabWithURL(browser(), slaveUrl,
|
| + content::PAGE_TRANSITION_LINK);
|
| }
|
| chrome::SelectNextTab(browser());
|
|
|
| @@ -558,8 +559,8 @@
|
|
|
| // Close tabs which contains the test page.
|
| for (int i = 0; i < 16; ++i)
|
| - browser()->CloseTabContents(tabs[i]->web_contents());
|
| - browser()->CloseTabContents(tab);
|
| + chrome::CloseWebContents(browser(), tabs[i]->web_contents());
|
| + chrome::CloseWebContents(browser(), tab);
|
| }
|
|
|
| // Visit a HTTPS page and proceeds despite an invalid certificate. The page
|
| @@ -578,7 +579,7 @@
|
| ASSERT_TRUE(wss_server.Start(wss_root_dir));
|
|
|
| // Setup page title observer.
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| ui_test_utils::TitleWatcher watcher(tab, ASCIIToUTF16("PASS"));
|
| watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
|
|
|
| @@ -614,8 +615,8 @@
|
| ASSERT_TRUE(https_server_expired_.Start());
|
|
|
| GURL url = https_server_expired_.GetURL("files/ssl/google.htm");
|
| - TabContents* tab2 =
|
| - browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED);
|
| + TabContents* tab2 = chrome::AddSelectedTabWithURL(
|
| + browser(), url, content::PAGE_TRANSITION_TYPED);
|
| ui_test_utils::WaitForLoadStop(tab2->web_contents());
|
|
|
| // Verify our assumption that there was no prior navigation.
|
| @@ -650,7 +651,7 @@
|
|
|
| // Proceed through the SSL interstitial. This doesn't use
|
| // |ProceedThroughInterstitial| since no page load will commit.
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| ASSERT_TRUE(tab != NULL);
|
| ASSERT_TRUE(tab->GetInterstitialPage() != NULL);
|
| {
|
| @@ -689,7 +690,7 @@
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server_.GetURL(replacement_path));
|
|
|
| - CheckAuthenticatedState(browser()->GetActiveWebContents(), true);
|
| + CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), true);
|
| }
|
|
|
| // Visits a page that runs insecure content and tries to suppress the insecure
|
| @@ -703,8 +704,8 @@
|
| ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(
|
| "files/ssl/page_runs_insecure_content.html"));
|
|
|
| - CheckAuthenticationBrokenState(browser()->GetActiveWebContents(), 0, true,
|
| - false);
|
| + CheckAuthenticationBrokenState(chrome::GetActiveWebContents(browser()), 0,
|
| + true, false);
|
| }
|
|
|
| // Visits a page with unsafe content and make sure that:
|
| @@ -722,7 +723,7 @@
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server_.GetURL(replacement_path));
|
|
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| // When the bad content is filtered, the state is expected to be
|
| // authenticated.
|
| CheckAuthenticatedState(tab, false);
|
| @@ -764,7 +765,7 @@
|
| ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(
|
| replacement_path));
|
|
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| CheckAuthenticatedState(tab, false);
|
|
|
| // Load the insecure image.
|
| @@ -788,7 +789,7 @@
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server_.GetURL("files/ssl/blank_page.html"));
|
|
|
| - TabContents* tab1 = browser()->GetActiveTabContents();
|
| + TabContents* tab1 = chrome::GetActiveTabContents(browser());
|
|
|
| // This tab should be fine.
|
| CheckAuthenticatedState(tab1->web_contents(), false);
|
| @@ -830,7 +831,7 @@
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server_.GetURL("files/ssl/blank_page.html"));
|
|
|
| - TabContents* tab1 = browser()->GetActiveTabContents();
|
| + TabContents* tab1 = chrome::GetActiveTabContents(browser());
|
|
|
| // This tab should be fine.
|
| CheckAuthenticatedState(tab1->web_contents(), false);
|
| @@ -884,7 +885,7 @@
|
| // Load original page over HTTP.
|
| const GURL url_http = test_server()->GetURL(replacement_path);
|
| ui_test_utils::NavigateToURL(browser(), url_http);
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| CheckUnauthenticatedState(tab);
|
|
|
| // Load again but over SSL. It should be marked as displaying insecure
|
| @@ -918,7 +919,7 @@
|
| // Load original page over HTTP.
|
| const GURL url_http = test_server()->GetURL(replacement_path);
|
| ui_test_utils::NavigateToURL(browser(), url_http);
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| CheckUnauthenticatedState(tab);
|
|
|
| // Load again but over SSL. It should be marked as displaying insecure
|
| @@ -940,7 +941,7 @@
|
| https_server_mismatched_.GetURL("files/ssl/google.html"));
|
|
|
| // We get an interstitial page as a result.
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
|
| false, true); // Interstitial showing.
|
| ProceedThroughInterstitial(tab);
|
| @@ -978,7 +979,7 @@
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server_expired_.GetURL("files/ssl/page_with_refs.html"));
|
|
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
|
| true); // Interstitial showing.
|
|
|
| @@ -1013,7 +1014,7 @@
|
| ui_test_utils::NavigateToURL(browser(),
|
| test_server()->GetURL(replacement_path));
|
|
|
| - WebContents* tab1 = browser()->GetActiveWebContents();
|
| + WebContents* tab1 = chrome::GetActiveWebContents(browser());
|
| // It is probably overkill to add a notification for a popup-opening, let's
|
| // just poll.
|
| for (int i = 0; i < 10; i++) {
|
| @@ -1031,11 +1032,11 @@
|
| ui_test_utils::WindowedNotificationObserver observer(
|
| content::NOTIFICATION_LOAD_STOP,
|
| content::NotificationService::AllSources());
|
| - browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED);
|
| + chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED);
|
| observer.Wait();
|
|
|
| // Close the first tab.
|
| - browser()->CloseTabContents(tab1);
|
| + chrome::CloseWebContents(browser(), tab1);
|
| }
|
|
|
| // Visit a page over bad https that is a redirect to a page with good https.
|
| @@ -1048,7 +1049,7 @@
|
|
|
| ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec()));
|
|
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
|
|
| CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
|
| true); // Interstitial showing.
|
| @@ -1068,7 +1069,7 @@
|
| GURL url2 = https_server_expired_.GetURL("files/ssl/google.html");
|
| ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec()));
|
|
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
|
| true); // Interstitial showing.
|
|
|
| @@ -1083,7 +1084,7 @@
|
| ASSERT_TRUE(test_server()->Start());
|
| ASSERT_TRUE(https_server_.Start());
|
|
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
|
|
| // HTTP redirects to good HTTPS.
|
| GURL http_url = test_server()->GetURL("server-redirect?");
|
| @@ -1100,7 +1101,7 @@
|
| ASSERT_TRUE(test_server()->Start());
|
| ASSERT_TRUE(https_server_expired_.Start());
|
|
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
|
|
| GURL http_url = test_server()->GetURL("server-redirect?");
|
| GURL bad_https_url =
|
| @@ -1127,18 +1128,18 @@
|
|
|
| ui_test_utils::NavigateToURL(browser(),
|
| GURL(https_url.spec() + http_url.spec()));
|
| - CheckUnauthenticatedState(browser()->GetActiveWebContents());
|
| + CheckUnauthenticatedState(chrome::GetActiveWebContents(browser()));
|
| }
|
|
|
| // Visits a page to which we could not connect (bad port) over http and https
|
| // and make sure the security style is correct.
|
| IN_PROC_BROWSER_TEST_F(SSLUITest, TestConnectToBadPort) {
|
| ui_test_utils::NavigateToURL(browser(), GURL("http://localhost:17"));
|
| - CheckUnauthenticatedState(browser()->GetActiveWebContents());
|
| + CheckUnauthenticatedState(chrome::GetActiveWebContents(browser()));
|
|
|
| // Same thing over HTTPS.
|
| ui_test_utils::NavigateToURL(browser(), GURL("https://localhost:17"));
|
| - CheckUnauthenticatedState(browser()->GetActiveWebContents());
|
| + CheckUnauthenticatedState(chrome::GetActiveWebContents(browser()));
|
| }
|
|
|
| //
|
| @@ -1161,7 +1162,7 @@
|
| https_server_expired_,
|
| &top_frame_path));
|
|
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server_.GetURL(top_frame_path));
|
|
|
| @@ -1259,7 +1260,7 @@
|
| https_server_expired_,
|
| &top_frame_path));
|
|
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server_expired_.GetURL(top_frame_path));
|
| CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
|
| @@ -1298,7 +1299,7 @@
|
| https_server_expired_,
|
| &top_frame_path));
|
|
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| ui_test_utils::NavigateToURL(browser(),
|
| test_server()->GetURL(top_frame_path));
|
| CheckUnauthenticatedState(tab);
|
| @@ -1359,7 +1360,7 @@
|
| &page_with_unsafe_worker_path));
|
| ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(
|
| page_with_unsafe_worker_path));
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| // Expect Worker not to load insecure content.
|
| CheckWorkerLoadResult(tab, false);
|
| // The bad content is filtered, expect the state to be authenticated.
|
| @@ -1374,7 +1375,7 @@
|
| // the user approves the bad certificate.
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server_expired_.GetURL("files/ssl/blank_page.html"));
|
| - WebContents* tab = browser()->GetActiveWebContents();
|
| + WebContents* tab = chrome::GetActiveWebContents(browser());
|
| CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false,
|
| true); // Interstitial showing
|
| ProceedThroughInterstitial(tab);
|
| @@ -1409,7 +1410,7 @@
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server_.GetURL(replacement_path));
|
|
|
| - CheckAuthenticatedState(browser()->GetActiveWebContents(), false);
|
| + CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), false);
|
| }
|
|
|
| // Test that when the browser blocks displaying insecure content (iframes), the
|
| @@ -1428,7 +1429,7 @@
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server_.GetURL(replacement_path));
|
|
|
| - CheckAuthenticatedState(browser()->GetActiveWebContents(), false);
|
| + CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), false);
|
| }
|
|
|
|
|
| @@ -1448,7 +1449,7 @@
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server_.GetURL(replacement_path));
|
|
|
| - CheckAuthenticatedState(browser()->GetActiveWebContents(), false);
|
| + CheckAuthenticatedState(chrome::GetActiveWebContents(browser()), false);
|
| }
|
|
|
|
|
|
|