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/base_switches.h" | 5 #include "base/base_switches.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "chrome/browser/ui/browser_navigator.h" | 39 #include "chrome/browser/ui/browser_navigator.h" |
40 #include "chrome/browser/ui/browser_navigator_params.h" | 40 #include "chrome/browser/ui/browser_navigator_params.h" |
41 #include "chrome/browser/ui/browser_tabstrip.h" | 41 #include "chrome/browser/ui/browser_tabstrip.h" |
42 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 42 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
43 #include "chrome/common/chrome_paths.h" | 43 #include "chrome/common/chrome_paths.h" |
44 #include "chrome/common/chrome_switches.h" | 44 #include "chrome/common/chrome_switches.h" |
45 #include "chrome/common/pref_names.h" | 45 #include "chrome/common/pref_names.h" |
46 #include "chrome/test/base/in_process_browser_test.h" | 46 #include "chrome/test/base/in_process_browser_test.h" |
47 #include "chrome/test/base/ui_test_utils.h" | 47 #include "chrome/test/base/ui_test_utils.h" |
48 #include "components/content_settings/core/browser/host_content_settings_map.h" | 48 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 49 #include "components/security_interstitials/core/controller_client.h" |
49 #include "components/security_interstitials/core/metrics_helper.h" | 50 #include "components/security_interstitials/core/metrics_helper.h" |
50 #include "components/ssl_errors/error_classification.h" | 51 #include "components/ssl_errors/error_classification.h" |
51 #include "components/variations/variations_associated_data.h" | 52 #include "components/variations/variations_associated_data.h" |
52 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 53 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
53 #include "content/public/browser/browser_context.h" | 54 #include "content/public/browser/browser_context.h" |
54 #include "content/public/browser/cert_store.h" | 55 #include "content/public/browser/cert_store.h" |
55 #include "content/public/browser/interstitial_page.h" | 56 #include "content/public/browser/interstitial_page.h" |
56 #include "content/public/browser/navigation_controller.h" | 57 #include "content/public/browser/navigation_controller.h" |
57 #include "content/public/browser/navigation_entry.h" | 58 #include "content/public/browser/navigation_entry.h" |
58 #include "content/public/browser/notification_service.h" | 59 #include "content/public/browser/notification_service.h" |
(...skipping 2253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2312 | 2313 |
2313 content::WindowedNotificationObserver observer( | 2314 content::WindowedNotificationObserver observer( |
2314 content::NOTIFICATION_LOAD_STOP, | 2315 content::NOTIFICATION_LOAD_STOP, |
2315 content::Source<NavigationController>(&tab->GetController())); | 2316 content::Source<NavigationController>(&tab->GetController())); |
2316 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); | 2317 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); |
2317 ASSERT_EQ(SSLBlockingPage::kTypeForTesting, | 2318 ASSERT_EQ(SSLBlockingPage::kTypeForTesting, |
2318 interstitial_page->GetDelegateForTesting()->GetTypeForTesting()); | 2319 interstitial_page->GetDelegateForTesting()->GetTypeForTesting()); |
2319 content::RenderViewHost* interstitial_rvh = | 2320 content::RenderViewHost* interstitial_rvh = |
2320 interstitial_page->GetMainFrame()->GetRenderViewHost(); | 2321 interstitial_page->GetMainFrame()->GetRenderViewHost(); |
2321 int result = -1; | 2322 int result = -1; |
2322 std::string javascript = base::StringPrintf( | 2323 std::string javascript = |
2323 "window.domAutomationController.send(%d);", | 2324 base::StringPrintf("window.domAutomationController.send(%d);", |
2324 SecurityInterstitialPage::CMD_PROCEED); | 2325 security_interstitials::CMD_PROCEED); |
2325 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( | 2326 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( |
2326 interstitial_rvh, javascript, &result)); | 2327 interstitial_rvh, javascript, &result)); |
2327 // The above will hang without the fix. | 2328 // The above will hang without the fix. |
2328 EXPECT_EQ(1, result); | 2329 EXPECT_EQ(1, result); |
2329 observer.Wait(); | 2330 observer.Wait(); |
2330 CheckAuthenticationBrokenState( | 2331 CheckAuthenticationBrokenState( |
2331 tab, net::CERT_STATUS_DATE_INVALID, AuthState::NONE); | 2332 tab, net::CERT_STATUS_DATE_INVALID, AuthState::NONE); |
2332 } | 2333 } |
2333 | 2334 |
2334 // Verifies that the interstitial can go back, even if JavaScript is disabled. | 2335 // Verifies that the interstitial can go back, even if JavaScript is disabled. |
(...skipping 12 matching lines...) Expand all Loading... |
2347 | 2348 |
2348 content::WindowedNotificationObserver observer( | 2349 content::WindowedNotificationObserver observer( |
2349 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 2350 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
2350 content::NotificationService::AllSources()); | 2351 content::NotificationService::AllSources()); |
2351 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); | 2352 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); |
2352 ASSERT_EQ(SSLBlockingPage::kTypeForTesting, | 2353 ASSERT_EQ(SSLBlockingPage::kTypeForTesting, |
2353 interstitial_page->GetDelegateForTesting()->GetTypeForTesting()); | 2354 interstitial_page->GetDelegateForTesting()->GetTypeForTesting()); |
2354 content::RenderViewHost* interstitial_rvh = | 2355 content::RenderViewHost* interstitial_rvh = |
2355 interstitial_page->GetMainFrame()->GetRenderViewHost(); | 2356 interstitial_page->GetMainFrame()->GetRenderViewHost(); |
2356 int result = -1; | 2357 int result = -1; |
2357 std::string javascript = base::StringPrintf( | 2358 std::string javascript = |
2358 "window.domAutomationController.send(%d);", | 2359 base::StringPrintf("window.domAutomationController.send(%d);", |
2359 SecurityInterstitialPage::CMD_DONT_PROCEED); | 2360 security_interstitials::CMD_DONT_PROCEED); |
2360 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( | 2361 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( |
2361 interstitial_rvh, javascript, &result)); | 2362 interstitial_rvh, javascript, &result)); |
2362 // The above will hang without the fix. | 2363 // The above will hang without the fix. |
2363 EXPECT_EQ(0, result); | 2364 EXPECT_EQ(0, result); |
2364 observer.Wait(); | 2365 observer.Wait(); |
2365 EXPECT_EQ("about:blank", tab->GetVisibleURL().spec()); | 2366 EXPECT_EQ("about:blank", tab->GetVisibleURL().spec()); |
2366 } | 2367 } |
2367 | 2368 |
2368 // Verifies that switching tabs, while showing interstitial page, will not | 2369 // Verifies that switching tabs, while showing interstitial page, will not |
2369 // affect the visibility of the interestitial. | 2370 // affect the visibility of the interestitial. |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2876 | 2877 |
2877 // Visit a page over https that contains a frame with a redirect. | 2878 // Visit a page over https that contains a frame with a redirect. |
2878 | 2879 |
2879 // XMLHttpRequest insecure content in synchronous mode. | 2880 // XMLHttpRequest insecure content in synchronous mode. |
2880 | 2881 |
2881 // XMLHttpRequest insecure content in asynchronous mode. | 2882 // XMLHttpRequest insecure content in asynchronous mode. |
2882 | 2883 |
2883 // XMLHttpRequest over bad ssl in synchronous mode. | 2884 // XMLHttpRequest over bad ssl in synchronous mode. |
2884 | 2885 |
2885 // XMLHttpRequest over OK ssl in synchronous mode. | 2886 // XMLHttpRequest over OK ssl in synchronous mode. |
OLD | NEW |