| 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 <utility> | 5 #include <utility> | 
| 6 | 6 | 
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" | 
| 8 #include "base/bind.h" | 8 #include "base/bind.h" | 
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" | 
| 10 #include "base/callback.h" | 10 #include "base/callback.h" | 
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 407     // The "frame_left.html" page contained in the top_frame.html page contains | 407     // The "frame_left.html" page contained in the top_frame.html page contains | 
| 408     // <a href>'s to three different servers. This sets up all of the | 408     // <a href>'s to three different servers. This sets up all of the | 
| 409     // replacement text to work with test servers which listen on ephemeral | 409     // replacement text to work with test servers which listen on ephemeral | 
| 410     // ports. | 410     // ports. | 
| 411     GURL http_url = http_server.GetURL("/ssl/google.html"); | 411     GURL http_url = http_server.GetURL("/ssl/google.html"); | 
| 412     GURL good_https_url = good_https_server.GetURL("/ssl/google.html"); | 412     GURL good_https_url = good_https_server.GetURL("/ssl/google.html"); | 
| 413     GURL bad_https_url = bad_https_server.GetURL("/ssl/bad_iframe.html"); | 413     GURL bad_https_url = bad_https_server.GetURL("/ssl/bad_iframe.html"); | 
| 414 | 414 | 
| 415     base::StringPairs replacement_text_frame_left; | 415     base::StringPairs replacement_text_frame_left; | 
| 416     replacement_text_frame_left.push_back( | 416     replacement_text_frame_left.push_back( | 
| 417         make_pair("REPLACE_WITH_HTTP_PAGE", http_url.spec())); | 417         make_pair("REPLACE_WITH_HTTP_PORT", http_url.port())); | 
| 418     replacement_text_frame_left.push_back( | 418     replacement_text_frame_left.push_back( | 
| 419         make_pair("REPLACE_WITH_GOOD_HTTPS_PAGE", good_https_url.spec())); | 419         make_pair("REPLACE_WITH_GOOD_HTTPS_PAGE", good_https_url.spec())); | 
| 420     replacement_text_frame_left.push_back( | 420     replacement_text_frame_left.push_back( | 
| 421         make_pair("REPLACE_WITH_BAD_HTTPS_PAGE", bad_https_url.spec())); | 421         make_pair("REPLACE_WITH_BAD_HTTPS_PAGE", bad_https_url.spec())); | 
| 422     std::string frame_left_path; | 422     std::string frame_left_path; | 
| 423     net::test_server::GetFilePathWithReplacements( | 423     net::test_server::GetFilePathWithReplacements( | 
| 424         "frame_left.html", replacement_text_frame_left, &frame_left_path); | 424         "frame_left.html", replacement_text_frame_left, &frame_left_path); | 
| 425 | 425 | 
| 426     // Substitute the generated frame_left URL into the top_frame page. | 426     // Substitute the generated frame_left URL into the top_frame page. | 
| 427     base::StringPairs replacement_text_top_frame; | 427     base::StringPairs replacement_text_top_frame; | 
| (...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1610     DISABLED_TestDisplaysInsecureContentLoadedFromJS | 1610     DISABLED_TestDisplaysInsecureContentLoadedFromJS | 
| 1611 #else | 1611 #else | 
| 1612 #define MAYBE_TestDisplaysInsecureContentLoadedFromJS \ | 1612 #define MAYBE_TestDisplaysInsecureContentLoadedFromJS \ | 
| 1613     TestDisplaysInsecureContentLoadedFromJS | 1613     TestDisplaysInsecureContentLoadedFromJS | 
| 1614 #endif | 1614 #endif | 
| 1615 IN_PROC_BROWSER_TEST_F(SSLUITest, | 1615 IN_PROC_BROWSER_TEST_F(SSLUITest, | 
| 1616                        MAYBE_TestDisplaysInsecureContentLoadedFromJS) { | 1616                        MAYBE_TestDisplaysInsecureContentLoadedFromJS) { | 
| 1617   ASSERT_TRUE(embedded_test_server()->Start()); | 1617   ASSERT_TRUE(embedded_test_server()->Start()); | 
| 1618   ASSERT_TRUE(https_server_.Start()); | 1618   ASSERT_TRUE(https_server_.Start()); | 
| 1619 | 1619 | 
|  | 1620   host_resolver()->AddRule("example.test", | 
|  | 1621                            https_server_.GetURL("/").host()); | 
|  | 1622 | 
|  | 1623   net::HostPortPair replacement_pair = embedded_test_server()->host_port_pair(); | 
|  | 1624   replacement_pair.set_host("example.test"); | 
|  | 1625 | 
| 1620   std::string replacement_path; | 1626   std::string replacement_path; | 
| 1621   GetFilePathWithHostAndPortReplacement( | 1627   GetFilePathWithHostAndPortReplacement( | 
| 1622       "/ssl/page_with_dynamic_insecure_content.html", | 1628       "/ssl/page_with_dynamic_insecure_content.html", | 
| 1623       embedded_test_server()->host_port_pair(), &replacement_path); | 1629       replacement_pair, &replacement_path); | 
| 1624   ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( | 1630   ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( | 
| 1625       replacement_path)); | 1631       replacement_path)); | 
| 1626 | 1632 | 
| 1627   WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1633   WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 
| 1628   CheckAuthenticatedState(tab, AuthState::NONE); | 1634   CheckAuthenticatedState(tab, AuthState::NONE); | 
| 1629 | 1635 | 
| 1630   // Load the insecure image. | 1636   // Load the insecure image. | 
| 1631   bool js_result = false; | 1637   bool js_result = false; | 
| 1632   EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 1638   EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 
| 1633       tab, | 1639       tab, | 
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2112         "window.domAutomationController.send(clickLink('HTTPLink'));", | 2118         "window.domAutomationController.send(clickLink('HTTPLink'));", | 
| 2113         &success)); | 2119         &success)); | 
| 2114     ASSERT_TRUE(success); | 2120     ASSERT_TRUE(success); | 
| 2115     observer.Wait(); | 2121     observer.Wait(); | 
| 2116   } | 2122   } | 
| 2117 | 2123 | 
| 2118   // Our state should be unathenticated (in the ran mixed script sense) | 2124   // Our state should be unathenticated (in the ran mixed script sense) | 
| 2119   CheckAuthenticationBrokenState( | 2125   CheckAuthenticationBrokenState( | 
| 2120       tab, | 2126       tab, | 
| 2121       CertError::NONE, | 2127       CertError::NONE, | 
| 2122       AuthState::DISPLAYED_INSECURE_CONTENT | AuthState::RAN_INSECURE_CONTENT); | 2128       AuthState::RAN_INSECURE_CONTENT); | 
| 2123 | 2129 | 
| 2124   // Go back, our state should be unchanged. | 2130   // Go back, our state should be unchanged. | 
| 2125   { | 2131   { | 
| 2126     content::WindowedNotificationObserver observer( | 2132     content::WindowedNotificationObserver observer( | 
| 2127         content::NOTIFICATION_LOAD_STOP, | 2133         content::NOTIFICATION_LOAD_STOP, | 
| 2128         content::Source<NavigationController>(&tab->GetController())); | 2134         content::Source<NavigationController>(&tab->GetController())); | 
| 2129     tab->GetController().GoBack(); | 2135     tab->GetController().GoBack(); | 
| 2130     observer.Wait(); | 2136     observer.Wait(); | 
| 2131   } | 2137   } | 
| 2132 | 2138 | 
| 2133   CheckAuthenticationBrokenState( | 2139   CheckAuthenticationBrokenState( | 
| 2134       tab, | 2140       tab, | 
| 2135       CertError::NONE, | 2141       CertError::NONE, | 
| 2136       AuthState::DISPLAYED_INSECURE_CONTENT | AuthState::RAN_INSECURE_CONTENT); | 2142       AuthState::RAN_INSECURE_CONTENT); | 
| 2137 } | 2143 } | 
| 2138 | 2144 | 
| 2139 // From a bad HTTPS top frame: | 2145 // From a bad HTTPS top frame: | 
| 2140 // - navigate to an OK HTTPS frame (expected to be still authentication broken). | 2146 // - navigate to an OK HTTPS frame (expected to be still authentication broken). | 
| 2141 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadFrameNavigation) { | 2147 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadFrameNavigation) { | 
| 2142   ASSERT_TRUE(embedded_test_server()->Start()); | 2148   ASSERT_TRUE(embedded_test_server()->Start()); | 
| 2143   ASSERT_TRUE(https_server_.Start()); | 2149   ASSERT_TRUE(https_server_.Start()); | 
| 2144   ASSERT_TRUE(https_server_expired_.Start()); | 2150   ASSERT_TRUE(https_server_expired_.Start()); | 
| 2145 | 2151 | 
| 2146   std::string top_frame_path; | 2152   std::string top_frame_path; | 
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3016 | 3022 | 
| 3017 // Visit a page over https that contains a frame with a redirect. | 3023 // Visit a page over https that contains a frame with a redirect. | 
| 3018 | 3024 | 
| 3019 // XMLHttpRequest insecure content in synchronous mode. | 3025 // XMLHttpRequest insecure content in synchronous mode. | 
| 3020 | 3026 | 
| 3021 // XMLHttpRequest insecure content in asynchronous mode. | 3027 // XMLHttpRequest insecure content in asynchronous mode. | 
| 3022 | 3028 | 
| 3023 // XMLHttpRequest over bad ssl in synchronous mode. | 3029 // XMLHttpRequest over bad ssl in synchronous mode. | 
| 3024 | 3030 | 
| 3025 // XMLHttpRequest over OK ssl in synchronous mode. | 3031 // XMLHttpRequest over OK ssl in synchronous mode. | 
| OLD | NEW | 
|---|