Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: chrome/browser/ssl/ssl_browser_tests.cc

Issue 789703004: Reflect the status of a request for accessing a blacklisted url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 13 matching lines...) Expand all
24 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
25 #include "chrome/test/base/in_process_browser_test.h" 25 #include "chrome/test/base/in_process_browser_test.h"
26 #include "chrome/test/base/ui_test_utils.h" 26 #include "chrome/test/base/ui_test_utils.h"
27 #include "components/content_settings/core/browser/host_content_settings_map.h" 27 #include "components/content_settings/core/browser/host_content_settings_map.h"
28 #include "components/web_modal/web_contents_modal_dialog_manager.h" 28 #include "components/web_modal/web_contents_modal_dialog_manager.h"
29 #include "content/public/browser/browser_context.h" 29 #include "content/public/browser/browser_context.h"
30 #include "content/public/browser/interstitial_page.h" 30 #include "content/public/browser/interstitial_page.h"
31 #include "content/public/browser/navigation_controller.h" 31 #include "content/public/browser/navigation_controller.h"
32 #include "content/public/browser/navigation_entry.h" 32 #include "content/public/browser/navigation_entry.h"
33 #include "content/public/browser/notification_service.h" 33 #include "content/public/browser/notification_service.h"
34 #include "content/public/browser/render_frame_host.h"
34 #include "content/public/browser/render_view_host.h" 35 #include "content/public/browser/render_view_host.h"
35 #include "content/public/browser/render_widget_host_view.h" 36 #include "content/public/browser/render_widget_host_view.h"
36 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
37 #include "content/public/browser/web_contents_observer.h" 38 #include "content/public/browser/web_contents_observer.h"
38 #include "content/public/common/security_style.h" 39 #include "content/public/common/security_style.h"
39 #include "content/public/common/ssl_status.h" 40 #include "content/public/common/ssl_status.h"
40 #include "content/public/test/browser_test_utils.h" 41 #include "content/public/test/browser_test_utils.h"
41 #include "content/public/test/download_test_observer.h" 42 #include "content/public/test/download_test_observer.h"
42 #include "content/public/test/test_renderer_host.h" 43 #include "content/public/test/test_renderer_host.h"
43 #include "net/base/net_errors.h" 44 #include "net/base/net_errors.h"
(...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after
1798 ui_test_utils::NavigateToURL(browser(), 1799 ui_test_utils::NavigateToURL(browser(),
1799 https_server_expired_.GetURL("files/ssl/google.html")); 1800 https_server_expired_.GetURL("files/ssl/google.html"));
1800 CheckAuthenticationBrokenState( 1801 CheckAuthenticationBrokenState(
1801 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL); 1802 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL);
1802 1803
1803 content::WindowedNotificationObserver observer( 1804 content::WindowedNotificationObserver observer(
1804 content::NOTIFICATION_LOAD_STOP, 1805 content::NOTIFICATION_LOAD_STOP,
1805 content::Source<NavigationController>(&tab->GetController())); 1806 content::Source<NavigationController>(&tab->GetController()));
1806 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); 1807 InterstitialPage* interstitial_page = tab->GetInterstitialPage();
1807 content::RenderViewHost* interstitial_rvh = 1808 content::RenderViewHost* interstitial_rvh =
1808 interstitial_page->GetRenderViewHostForTesting(); 1809 interstitial_page->GetMainFrame()->GetRenderViewHost();
1809 int result = -1; 1810 int result = -1;
1810 std::string javascript = base::StringPrintf( 1811 std::string javascript = base::StringPrintf(
1811 "window.domAutomationController.send(%d);", 1812 "window.domAutomationController.send(%d);",
1812 SSLBlockingPage::CMD_PROCEED); 1813 SSLBlockingPage::CMD_PROCEED);
1813 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( 1814 ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
1814 interstitial_rvh, javascript, &result)); 1815 interstitial_rvh, javascript, &result));
1815 // The above will hang without the fix. 1816 // The above will hang without the fix.
1816 EXPECT_EQ(1, result); 1817 EXPECT_EQ(1, result);
1817 observer.Wait(); 1818 observer.Wait();
1818 CheckAuthenticationBrokenState( 1819 CheckAuthenticationBrokenState(
(...skipping 11 matching lines...) Expand all
1830 ui_test_utils::NavigateToURL(browser(), 1831 ui_test_utils::NavigateToURL(browser(),
1831 https_server_expired_.GetURL("files/ssl/google.html")); 1832 https_server_expired_.GetURL("files/ssl/google.html"));
1832 CheckAuthenticationBrokenState( 1833 CheckAuthenticationBrokenState(
1833 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL); 1834 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL);
1834 1835
1835 content::WindowedNotificationObserver observer( 1836 content::WindowedNotificationObserver observer(
1836 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, 1837 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
1837 content::NotificationService::AllSources()); 1838 content::NotificationService::AllSources());
1838 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); 1839 InterstitialPage* interstitial_page = tab->GetInterstitialPage();
1839 content::RenderViewHost* interstitial_rvh = 1840 content::RenderViewHost* interstitial_rvh =
1840 interstitial_page->GetRenderViewHostForTesting(); 1841 interstitial_page->GetMainFrame()->GetRenderViewHost();
1841 int result = -1; 1842 int result = -1;
1842 std::string javascript = base::StringPrintf( 1843 std::string javascript = base::StringPrintf(
1843 "window.domAutomationController.send(%d);", 1844 "window.domAutomationController.send(%d);",
1844 SSLBlockingPage::CMD_DONT_PROCEED); 1845 SSLBlockingPage::CMD_DONT_PROCEED);
1845 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( 1846 ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
1846 interstitial_rvh, javascript, &result)); 1847 interstitial_rvh, javascript, &result));
1847 // The above will hang without the fix. 1848 // The above will hang without the fix.
1848 EXPECT_EQ(0, result); 1849 EXPECT_EQ(0, result);
1849 observer.Wait(); 1850 observer.Wait();
1850 EXPECT_EQ("about:blank", tab->GetVisibleURL().spec()); 1851 EXPECT_EQ("about:blank", tab->GetVisibleURL().spec());
(...skipping 28 matching lines...) Expand all
1879 1880
1880 // Visit a page over https that contains a frame with a redirect. 1881 // Visit a page over https that contains a frame with a redirect.
1881 1882
1882 // XMLHttpRequest insecure content in synchronous mode. 1883 // XMLHttpRequest insecure content in synchronous mode.
1883 1884
1884 // XMLHttpRequest insecure content in asynchronous mode. 1885 // XMLHttpRequest insecure content in asynchronous mode.
1885 1886
1886 // XMLHttpRequest over bad ssl in synchronous mode. 1887 // XMLHttpRequest over bad ssl in synchronous mode.
1887 1888
1888 // XMLHttpRequest over OK ssl in synchronous mode. 1889 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698