| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 183 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 184 tab->GetRenderViewHost(), std::wstring(), | 184 tab->GetRenderViewHost(), std::wstring(), |
| 185 L"window.domAutomationController.send(IsContentLoaded());", | 185 L"window.domAutomationController.send(IsContentLoaded());", |
| 186 &actuallyLoadedContent)); | 186 &actuallyLoadedContent)); |
| 187 EXPECT_EQ(expectLoaded, actuallyLoadedContent); | 187 EXPECT_EQ(expectLoaded, actuallyLoadedContent); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void ProceedThroughInterstitial(WebContents* tab) { | 190 void ProceedThroughInterstitial(WebContents* tab) { |
| 191 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); | 191 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); |
| 192 ASSERT_TRUE(interstitial_page); | 192 ASSERT_TRUE(interstitial_page); |
| 193 ui_test_utils::WindowedNotificationObserver observer( | 193 content::WindowedNotificationObserver observer( |
| 194 content::NOTIFICATION_LOAD_STOP, | 194 content::NOTIFICATION_LOAD_STOP, |
| 195 content::Source<NavigationController>(&tab->GetController())); | 195 content::Source<NavigationController>(&tab->GetController())); |
| 196 interstitial_page->Proceed(); | 196 interstitial_page->Proceed(); |
| 197 observer.Wait(); | 197 observer.Wait(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 int GetConstrainedWindowCount() const { | 200 int GetConstrainedWindowCount() const { |
| 201 return static_cast<int>(chrome::GetActiveTabContents(browser())-> | 201 return static_cast<int>(chrome::GetActiveTabContents(browser())-> |
| 202 constrained_window_tab_helper()->constrained_window_count()); | 202 constrained_window_tab_helper()->constrained_window_count()); |
| 203 } | 203 } |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 WebContents* tab = chrome::GetActiveWebContents(browser()); | 479 WebContents* tab = chrome::GetActiveWebContents(browser()); |
| 480 NavigationEntry* entry1 = tab->GetController().GetActiveEntry(); | 480 NavigationEntry* entry1 = tab->GetController().GetActiveEntry(); |
| 481 ASSERT_TRUE(entry1); | 481 ASSERT_TRUE(entry1); |
| 482 ui_test_utils::NavigateToURL(browser(), | 482 ui_test_utils::NavigateToURL(browser(), |
| 483 test_server()->GetURL("files/ssl/blank_page.html")); | 483 test_server()->GetURL("files/ssl/blank_page.html")); |
| 484 NavigationEntry* entry2 = tab->GetController().GetActiveEntry(); | 484 NavigationEntry* entry2 = tab->GetController().GetActiveEntry(); |
| 485 ASSERT_TRUE(entry2); | 485 ASSERT_TRUE(entry2); |
| 486 | 486 |
| 487 // Now go back so that a page is in the forward history. | 487 // Now go back so that a page is in the forward history. |
| 488 { | 488 { |
| 489 ui_test_utils::WindowedNotificationObserver observer( | 489 content::WindowedNotificationObserver observer( |
| 490 content::NOTIFICATION_LOAD_STOP, | 490 content::NOTIFICATION_LOAD_STOP, |
| 491 content::Source<NavigationController>(&tab->GetController())); | 491 content::Source<NavigationController>(&tab->GetController())); |
| 492 tab->GetController().GoBack(); | 492 tab->GetController().GoBack(); |
| 493 observer.Wait(); | 493 observer.Wait(); |
| 494 } | 494 } |
| 495 ASSERT_TRUE(tab->GetController().CanGoForward()); | 495 ASSERT_TRUE(tab->GetController().CanGoForward()); |
| 496 NavigationEntry* entry3 = tab->GetController().GetActiveEntry(); | 496 NavigationEntry* entry3 = tab->GetController().GetActiveEntry(); |
| 497 ASSERT_TRUE(entry1 == entry3); | 497 ASSERT_TRUE(entry1 == entry3); |
| 498 | 498 |
| 499 // Now go to a bad HTTPS page that shows an interstitial. | 499 // Now go to a bad HTTPS page that shows an interstitial. |
| 500 ui_test_utils::NavigateToURL(browser(), | 500 ui_test_utils::NavigateToURL(browser(), |
| 501 https_server_expired_.GetURL("files/ssl/google.html")); | 501 https_server_expired_.GetURL("files/ssl/google.html")); |
| 502 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 502 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 503 true); // Interstitial showing | 503 true); // Interstitial showing |
| 504 | 504 |
| 505 // Simulate user clicking and holding on forward button. | 505 // Simulate user clicking and holding on forward button. |
| 506 { | 506 { |
| 507 ui_test_utils::WindowedNotificationObserver observer( | 507 content::WindowedNotificationObserver observer( |
| 508 content::NOTIFICATION_LOAD_STOP, | 508 content::NOTIFICATION_LOAD_STOP, |
| 509 content::Source<NavigationController>(&tab->GetController())); | 509 content::Source<NavigationController>(&tab->GetController())); |
| 510 tab->GetController().GoToOffset(1); | 510 tab->GetController().GoToOffset(1); |
| 511 observer.Wait(); | 511 observer.Wait(); |
| 512 } | 512 } |
| 513 | 513 |
| 514 // We should be showing the second good page. | 514 // We should be showing the second good page. |
| 515 EXPECT_FALSE(chrome::GetActiveWebContents(browser())->GetInterstitialPage()); | 515 EXPECT_FALSE(chrome::GetActiveWebContents(browser())->GetInterstitialPage()); |
| 516 CheckUnauthenticatedState(tab); | 516 CheckUnauthenticatedState(tab); |
| 517 EXPECT_FALSE(tab->GetController().CanGoForward()); | 517 EXPECT_FALSE(tab->GetController().CanGoForward()); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 ASSERT_TRUE(https_server_expired_.Start()); | 631 ASSERT_TRUE(https_server_expired_.Start()); |
| 632 GURL url_non_dangerous = test_server()->GetURL(""); | 632 GURL url_non_dangerous = test_server()->GetURL(""); |
| 633 GURL url_dangerous = https_server_expired_.GetURL( | 633 GURL url_dangerous = https_server_expired_.GetURL( |
| 634 "files/downloads/dangerous/dangerous.exe"); | 634 "files/downloads/dangerous/dangerous.exe"); |
| 635 | 635 |
| 636 // Visit a non-dangerous page. | 636 // Visit a non-dangerous page. |
| 637 ui_test_utils::NavigateToURL(browser(), url_non_dangerous); | 637 ui_test_utils::NavigateToURL(browser(), url_non_dangerous); |
| 638 | 638 |
| 639 // Now, start a transition to dangerous download. | 639 // Now, start a transition to dangerous download. |
| 640 { | 640 { |
| 641 ui_test_utils::WindowedNotificationObserver observer( | 641 content::WindowedNotificationObserver observer( |
| 642 content::NOTIFICATION_LOAD_STOP, | 642 content::NOTIFICATION_LOAD_STOP, |
| 643 content::NotificationService::AllSources()); | 643 content::NotificationService::AllSources()); |
| 644 chrome::NavigateParams navigate_params(browser(), url_dangerous, | 644 chrome::NavigateParams navigate_params(browser(), url_dangerous, |
| 645 content::PAGE_TRANSITION_TYPED); | 645 content::PAGE_TRANSITION_TYPED); |
| 646 chrome::Navigate(&navigate_params); | 646 chrome::Navigate(&navigate_params); |
| 647 observer.Wait(); | 647 observer.Wait(); |
| 648 } | 648 } |
| 649 | 649 |
| 650 // Proceed through the SSL interstitial. This doesn't use | 650 // Proceed through the SSL interstitial. This doesn't use |
| 651 // |ProceedThroughInterstitial| since no page load will commit. | 651 // |ProceedThroughInterstitial| since no page load will commit. |
| 652 WebContents* tab = chrome::GetActiveWebContents(browser()); | 652 WebContents* tab = chrome::GetActiveWebContents(browser()); |
| 653 ASSERT_TRUE(tab != NULL); | 653 ASSERT_TRUE(tab != NULL); |
| 654 ASSERT_TRUE(tab->GetInterstitialPage() != NULL); | 654 ASSERT_TRUE(tab->GetInterstitialPage() != NULL); |
| 655 { | 655 { |
| 656 ui_test_utils::WindowedNotificationObserver observer( | 656 content::WindowedNotificationObserver observer( |
| 657 chrome::NOTIFICATION_DOWNLOAD_INITIATED, | 657 chrome::NOTIFICATION_DOWNLOAD_INITIATED, |
| 658 content::NotificationService::AllSources()); | 658 content::NotificationService::AllSources()); |
| 659 tab->GetInterstitialPage()->Proceed(); | 659 tab->GetInterstitialPage()->Proceed(); |
| 660 observer.Wait(); | 660 observer.Wait(); |
| 661 } | 661 } |
| 662 | 662 |
| 663 // There should still be an interstitial at this point. Press the | 663 // There should still be an interstitial at this point. Press the |
| 664 // back button on the browser. Note that this doesn't wait for a | 664 // back button on the browser. Note that this doesn't wait for a |
| 665 // NAV_ENTRY_COMMITTED notification because going back with an | 665 // NAV_ENTRY_COMMITTED notification because going back with an |
| 666 // active interstitial simply hides the interstitial. | 666 // active interstitial simply hides the interstitial. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 797 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 798 "files/ssl/page_displays_insecure_content.html", | 798 "files/ssl/page_displays_insecure_content.html", |
| 799 test_server()->host_port_pair(), | 799 test_server()->host_port_pair(), |
| 800 &replacement_path)); | 800 &replacement_path)); |
| 801 | 801 |
| 802 GURL url = https_server_.GetURL(replacement_path); | 802 GURL url = https_server_.GetURL(replacement_path); |
| 803 chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_TYPED); | 803 chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_TYPED); |
| 804 params.disposition = NEW_FOREGROUND_TAB; | 804 params.disposition = NEW_FOREGROUND_TAB; |
| 805 params.tabstrip_index = 0; | 805 params.tabstrip_index = 0; |
| 806 params.source_contents = tab1; | 806 params.source_contents = tab1; |
| 807 ui_test_utils::WindowedNotificationObserver observer( | 807 content::WindowedNotificationObserver observer( |
| 808 content::NOTIFICATION_LOAD_STOP, | 808 content::NOTIFICATION_LOAD_STOP, |
| 809 content::NotificationService::AllSources()); | 809 content::NotificationService::AllSources()); |
| 810 chrome::Navigate(¶ms); | 810 chrome::Navigate(¶ms); |
| 811 TabContents* tab2 = params.target_contents; | 811 TabContents* tab2 = params.target_contents; |
| 812 observer.Wait(); | 812 observer.Wait(); |
| 813 | 813 |
| 814 // The new tab has insecure content. | 814 // The new tab has insecure content. |
| 815 CheckAuthenticatedState(tab2->web_contents(), true); | 815 CheckAuthenticatedState(tab2->web_contents(), true); |
| 816 | 816 |
| 817 // The original tab should not be contaminated. | 817 // The original tab should not be contaminated. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 839 test_server()->host_port_pair(), | 839 test_server()->host_port_pair(), |
| 840 &replacement_path)); | 840 &replacement_path)); |
| 841 | 841 |
| 842 // Create a new tab in the same process. Using a NEW_FOREGROUND_TAB | 842 // Create a new tab in the same process. Using a NEW_FOREGROUND_TAB |
| 843 // disposition won't usually stay in the same process, but this works | 843 // disposition won't usually stay in the same process, but this works |
| 844 // because we are using process-per-site in SetUpCommandLine. | 844 // because we are using process-per-site in SetUpCommandLine. |
| 845 GURL url = https_server_.GetURL(replacement_path); | 845 GURL url = https_server_.GetURL(replacement_path); |
| 846 chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_TYPED); | 846 chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_TYPED); |
| 847 params.disposition = NEW_FOREGROUND_TAB; | 847 params.disposition = NEW_FOREGROUND_TAB; |
| 848 params.source_contents = tab1; | 848 params.source_contents = tab1; |
| 849 ui_test_utils::WindowedNotificationObserver observer( | 849 content::WindowedNotificationObserver observer( |
| 850 content::NOTIFICATION_LOAD_STOP, | 850 content::NOTIFICATION_LOAD_STOP, |
| 851 content::NotificationService::AllSources()); | 851 content::NotificationService::AllSources()); |
| 852 chrome::Navigate(¶ms); | 852 chrome::Navigate(¶ms); |
| 853 TabContents* tab2 = params.target_contents; | 853 TabContents* tab2 = params.target_contents; |
| 854 observer.Wait(); | 854 observer.Wait(); |
| 855 | 855 |
| 856 // Both tabs should have the same process. | 856 // Both tabs should have the same process. |
| 857 EXPECT_EQ(tab1->web_contents()->GetRenderProcessHost(), | 857 EXPECT_EQ(tab1->web_contents()->GetRenderProcessHost(), |
| 858 tab2->web_contents()->GetRenderProcessHost()); | 858 tab2->web_contents()->GetRenderProcessHost()); |
| 859 | 859 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 break; | 1018 break; |
| 1019 MessageLoop::current()->PostDelayedTask( | 1019 MessageLoop::current()->PostDelayedTask( |
| 1020 FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); | 1020 FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); |
| 1021 ui_test_utils::RunMessageLoop(); | 1021 ui_test_utils::RunMessageLoop(); |
| 1022 } | 1022 } |
| 1023 ASSERT_EQ(1, GetConstrainedWindowCount()); | 1023 ASSERT_EQ(1, GetConstrainedWindowCount()); |
| 1024 | 1024 |
| 1025 // Let's add another tab to make sure the browser does not exit when we close | 1025 // Let's add another tab to make sure the browser does not exit when we close |
| 1026 // the first tab. | 1026 // the first tab. |
| 1027 GURL url = test_server()->GetURL("files/ssl/google.html"); | 1027 GURL url = test_server()->GetURL("files/ssl/google.html"); |
| 1028 ui_test_utils::WindowedNotificationObserver observer( | 1028 content::WindowedNotificationObserver observer( |
| 1029 content::NOTIFICATION_LOAD_STOP, | 1029 content::NOTIFICATION_LOAD_STOP, |
| 1030 content::NotificationService::AllSources()); | 1030 content::NotificationService::AllSources()); |
| 1031 chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED); | 1031 chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED); |
| 1032 observer.Wait(); | 1032 observer.Wait(); |
| 1033 | 1033 |
| 1034 // Close the first tab. | 1034 // Close the first tab. |
| 1035 chrome::CloseWebContents(browser(), tab1); | 1035 chrome::CloseWebContents(browser(), tab1); |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 // Visit a page over bad https that is a redirect to a page with good https. | 1038 // Visit a page over bad https that is a redirect to a page with good https. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 | 1160 |
| 1161 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1161 WebContents* tab = chrome::GetActiveWebContents(browser()); |
| 1162 ui_test_utils::NavigateToURL(browser(), | 1162 ui_test_utils::NavigateToURL(browser(), |
| 1163 https_server_.GetURL(top_frame_path)); | 1163 https_server_.GetURL(top_frame_path)); |
| 1164 | 1164 |
| 1165 CheckAuthenticatedState(tab, false); | 1165 CheckAuthenticatedState(tab, false); |
| 1166 | 1166 |
| 1167 bool success = false; | 1167 bool success = false; |
| 1168 // Now navigate inside the frame. | 1168 // Now navigate inside the frame. |
| 1169 { | 1169 { |
| 1170 ui_test_utils::WindowedNotificationObserver observer( | 1170 content::WindowedNotificationObserver observer( |
| 1171 content::NOTIFICATION_LOAD_STOP, | 1171 content::NOTIFICATION_LOAD_STOP, |
| 1172 content::Source<NavigationController>(&tab->GetController())); | 1172 content::Source<NavigationController>(&tab->GetController())); |
| 1173 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 1173 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 1174 tab->GetRenderViewHost(), std::wstring(), | 1174 tab->GetRenderViewHost(), std::wstring(), |
| 1175 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));", | 1175 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));", |
| 1176 &success)); | 1176 &success)); |
| 1177 ASSERT_TRUE(success); | 1177 ASSERT_TRUE(success); |
| 1178 observer.Wait(); | 1178 observer.Wait(); |
| 1179 } | 1179 } |
| 1180 | 1180 |
| 1181 // We should still be fine. | 1181 // We should still be fine. |
| 1182 CheckAuthenticatedState(tab, false); | 1182 CheckAuthenticatedState(tab, false); |
| 1183 | 1183 |
| 1184 // Now let's hit a bad page. | 1184 // Now let's hit a bad page. |
| 1185 { | 1185 { |
| 1186 ui_test_utils::WindowedNotificationObserver observer( | 1186 content::WindowedNotificationObserver observer( |
| 1187 content::NOTIFICATION_LOAD_STOP, | 1187 content::NOTIFICATION_LOAD_STOP, |
| 1188 content::Source<NavigationController>(&tab->GetController())); | 1188 content::Source<NavigationController>(&tab->GetController())); |
| 1189 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 1189 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 1190 tab->GetRenderViewHost(), std::wstring(), | 1190 tab->GetRenderViewHost(), std::wstring(), |
| 1191 L"window.domAutomationController.send(clickLink('badHTTPSLink'));", | 1191 L"window.domAutomationController.send(clickLink('badHTTPSLink'));", |
| 1192 &success)); | 1192 &success)); |
| 1193 ASSERT_TRUE(success); | 1193 ASSERT_TRUE(success); |
| 1194 observer.Wait(); | 1194 observer.Wait(); |
| 1195 } | 1195 } |
| 1196 | 1196 |
| 1197 // The security style should still be secure. | 1197 // The security style should still be secure. |
| 1198 CheckAuthenticatedState(tab, false); | 1198 CheckAuthenticatedState(tab, false); |
| 1199 | 1199 |
| 1200 // And the frame should be blocked. | 1200 // And the frame should be blocked. |
| 1201 bool is_content_evil = true; | 1201 bool is_content_evil = true; |
| 1202 std::wstring content_frame_xpath(L"html/frameset/frame[2]"); | 1202 std::wstring content_frame_xpath(L"html/frameset/frame[2]"); |
| 1203 std::wstring is_evil_js(L"window.domAutomationController.send(" | 1203 std::wstring is_evil_js(L"window.domAutomationController.send(" |
| 1204 L"document.getElementById('evilDiv') != null);"); | 1204 L"document.getElementById('evilDiv') != null);"); |
| 1205 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 1205 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 1206 tab->GetRenderViewHost(), content_frame_xpath, is_evil_js, | 1206 tab->GetRenderViewHost(), content_frame_xpath, is_evil_js, |
| 1207 &is_content_evil)); | 1207 &is_content_evil)); |
| 1208 EXPECT_FALSE(is_content_evil); | 1208 EXPECT_FALSE(is_content_evil); |
| 1209 | 1209 |
| 1210 // Now go back, our state should still be OK. | 1210 // Now go back, our state should still be OK. |
| 1211 { | 1211 { |
| 1212 ui_test_utils::WindowedNotificationObserver observer( | 1212 content::WindowedNotificationObserver observer( |
| 1213 content::NOTIFICATION_LOAD_STOP, | 1213 content::NOTIFICATION_LOAD_STOP, |
| 1214 content::Source<NavigationController>(&tab->GetController())); | 1214 content::Source<NavigationController>(&tab->GetController())); |
| 1215 tab->GetController().GoBack(); | 1215 tab->GetController().GoBack(); |
| 1216 observer.Wait(); | 1216 observer.Wait(); |
| 1217 } | 1217 } |
| 1218 CheckAuthenticatedState(tab, false); | 1218 CheckAuthenticatedState(tab, false); |
| 1219 | 1219 |
| 1220 // Navigate to a page served over HTTP. | 1220 // Navigate to a page served over HTTP. |
| 1221 { | 1221 { |
| 1222 ui_test_utils::WindowedNotificationObserver observer( | 1222 content::WindowedNotificationObserver observer( |
| 1223 content::NOTIFICATION_LOAD_STOP, | 1223 content::NOTIFICATION_LOAD_STOP, |
| 1224 content::Source<NavigationController>(&tab->GetController())); | 1224 content::Source<NavigationController>(&tab->GetController())); |
| 1225 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 1225 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 1226 tab->GetRenderViewHost(), std::wstring(), | 1226 tab->GetRenderViewHost(), std::wstring(), |
| 1227 L"window.domAutomationController.send(clickLink('HTTPLink'));", | 1227 L"window.domAutomationController.send(clickLink('HTTPLink'));", |
| 1228 &success)); | 1228 &success)); |
| 1229 ASSERT_TRUE(success); | 1229 ASSERT_TRUE(success); |
| 1230 observer.Wait(); | 1230 observer.Wait(); |
| 1231 } | 1231 } |
| 1232 | 1232 |
| 1233 // Our state should be insecure. | 1233 // Our state should be insecure. |
| 1234 CheckAuthenticatedState(tab, true); | 1234 CheckAuthenticatedState(tab, true); |
| 1235 | 1235 |
| 1236 // Go back, our state should be unchanged. | 1236 // Go back, our state should be unchanged. |
| 1237 { | 1237 { |
| 1238 ui_test_utils::WindowedNotificationObserver observer( | 1238 content::WindowedNotificationObserver observer( |
| 1239 content::NOTIFICATION_LOAD_STOP, | 1239 content::NOTIFICATION_LOAD_STOP, |
| 1240 content::Source<NavigationController>(&tab->GetController())); | 1240 content::Source<NavigationController>(&tab->GetController())); |
| 1241 tab->GetController().GoBack(); | 1241 tab->GetController().GoBack(); |
| 1242 observer.Wait(); | 1242 observer.Wait(); |
| 1243 } | 1243 } |
| 1244 CheckAuthenticatedState(tab, true); | 1244 CheckAuthenticatedState(tab, true); |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 // From a bad HTTPS top frame: | 1247 // From a bad HTTPS top frame: |
| 1248 // - navigate to an OK HTTPS frame (expected to be still authentication broken). | 1248 // - navigate to an OK HTTPS frame (expected to be still authentication broken). |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1259 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1259 WebContents* tab = chrome::GetActiveWebContents(browser()); |
| 1260 ui_test_utils::NavigateToURL(browser(), | 1260 ui_test_utils::NavigateToURL(browser(), |
| 1261 https_server_expired_.GetURL(top_frame_path)); | 1261 https_server_expired_.GetURL(top_frame_path)); |
| 1262 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, | 1262 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, |
| 1263 true); // Interstitial showing | 1263 true); // Interstitial showing |
| 1264 | 1264 |
| 1265 ProceedThroughInterstitial(tab); | 1265 ProceedThroughInterstitial(tab); |
| 1266 | 1266 |
| 1267 // Navigate to a good frame. | 1267 // Navigate to a good frame. |
| 1268 bool success = false; | 1268 bool success = false; |
| 1269 ui_test_utils::WindowedNotificationObserver observer( | 1269 content::WindowedNotificationObserver observer( |
| 1270 content::NOTIFICATION_LOAD_STOP, | 1270 content::NOTIFICATION_LOAD_STOP, |
| 1271 content::Source<NavigationController>(&tab->GetController())); | 1271 content::Source<NavigationController>(&tab->GetController())); |
| 1272 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 1272 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 1273 tab->GetRenderViewHost(), std::wstring(), | 1273 tab->GetRenderViewHost(), std::wstring(), |
| 1274 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));", | 1274 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));", |
| 1275 &success)); | 1275 &success)); |
| 1276 ASSERT_TRUE(success); | 1276 ASSERT_TRUE(success); |
| 1277 observer.Wait(); | 1277 observer.Wait(); |
| 1278 | 1278 |
| 1279 // We should still be authentication broken. | 1279 // We should still be authentication broken. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1296 &top_frame_path)); | 1296 &top_frame_path)); |
| 1297 | 1297 |
| 1298 WebContents* tab = chrome::GetActiveWebContents(browser()); | 1298 WebContents* tab = chrome::GetActiveWebContents(browser()); |
| 1299 ui_test_utils::NavigateToURL(browser(), | 1299 ui_test_utils::NavigateToURL(browser(), |
| 1300 test_server()->GetURL(top_frame_path)); | 1300 test_server()->GetURL(top_frame_path)); |
| 1301 CheckUnauthenticatedState(tab); | 1301 CheckUnauthenticatedState(tab); |
| 1302 | 1302 |
| 1303 // Now navigate inside the frame to a secure HTTPS frame. | 1303 // Now navigate inside the frame to a secure HTTPS frame. |
| 1304 { | 1304 { |
| 1305 bool success = false; | 1305 bool success = false; |
| 1306 ui_test_utils::WindowedNotificationObserver observer( | 1306 content::WindowedNotificationObserver observer( |
| 1307 content::NOTIFICATION_LOAD_STOP, | 1307 content::NOTIFICATION_LOAD_STOP, |
| 1308 content::Source<NavigationController>(&tab->GetController())); | 1308 content::Source<NavigationController>(&tab->GetController())); |
| 1309 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 1309 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 1310 tab->GetRenderViewHost(), std::wstring(), | 1310 tab->GetRenderViewHost(), std::wstring(), |
| 1311 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));", | 1311 L"window.domAutomationController.send(clickLink('goodHTTPSLink'));", |
| 1312 &success)); | 1312 &success)); |
| 1313 ASSERT_TRUE(success); | 1313 ASSERT_TRUE(success); |
| 1314 observer.Wait(); | 1314 observer.Wait(); |
| 1315 } | 1315 } |
| 1316 | 1316 |
| 1317 // We should still be unauthenticated. | 1317 // We should still be unauthenticated. |
| 1318 CheckUnauthenticatedState(tab); | 1318 CheckUnauthenticatedState(tab); |
| 1319 | 1319 |
| 1320 // Now navigate to a bad HTTPS frame. | 1320 // Now navigate to a bad HTTPS frame. |
| 1321 { | 1321 { |
| 1322 bool success = false; | 1322 bool success = false; |
| 1323 ui_test_utils::WindowedNotificationObserver observer( | 1323 content::WindowedNotificationObserver observer( |
| 1324 content::NOTIFICATION_LOAD_STOP, | 1324 content::NOTIFICATION_LOAD_STOP, |
| 1325 content::Source<NavigationController>(&tab->GetController())); | 1325 content::Source<NavigationController>(&tab->GetController())); |
| 1326 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 1326 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 1327 tab->GetRenderViewHost(), std::wstring(), | 1327 tab->GetRenderViewHost(), std::wstring(), |
| 1328 L"window.domAutomationController.send(clickLink('badHTTPSLink'));", | 1328 L"window.domAutomationController.send(clickLink('badHTTPSLink'));", |
| 1329 &success)); | 1329 &success)); |
| 1330 ASSERT_TRUE(success); | 1330 ASSERT_TRUE(success); |
| 1331 observer.Wait(); | 1331 observer.Wait(); |
| 1332 } | 1332 } |
| 1333 | 1333 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1453 | 1453 |
| 1454 // Visit a page over https that contains a frame with a redirect. | 1454 // Visit a page over https that contains a frame with a redirect. |
| 1455 | 1455 |
| 1456 // XMLHttpRequest insecure content in synchronous mode. | 1456 // XMLHttpRequest insecure content in synchronous mode. |
| 1457 | 1457 |
| 1458 // XMLHttpRequest insecure content in asynchronous mode. | 1458 // XMLHttpRequest insecure content in asynchronous mode. |
| 1459 | 1459 |
| 1460 // XMLHttpRequest over bad ssl in synchronous mode. | 1460 // XMLHttpRequest over bad ssl in synchronous mode. |
| 1461 | 1461 |
| 1462 // XMLHttpRequest over OK ssl in synchronous mode. | 1462 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |