Chromium Code Reviews| 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 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2109 // From a good HTTPS top frame: | 2109 // From a good HTTPS top frame: |
| 2110 // - navigate to an OK HTTPS frame | 2110 // - navigate to an OK HTTPS frame |
| 2111 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then | 2111 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then |
| 2112 // back | 2112 // back |
| 2113 // - navigate to HTTP (expect insecure content), then back | 2113 // - navigate to HTTP (expect insecure content), then back |
| 2114 IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { | 2114 IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { |
| 2115 ASSERT_TRUE(embedded_test_server()->Start()); | 2115 ASSERT_TRUE(embedded_test_server()->Start()); |
| 2116 ASSERT_TRUE(https_server_.Start()); | 2116 ASSERT_TRUE(https_server_.Start()); |
| 2117 ASSERT_TRUE(https_server_expired_.Start()); | 2117 ASSERT_TRUE(https_server_expired_.Start()); |
| 2118 | 2118 |
| 2119 // Make sure to add this hostname to the resolver so that it's not blocked | |
| 2120 // (browser_test_base.cc has a resolver that blocks all non-local hostnames | |
| 2121 // by default to ensure tests don't hit the network). This is critical to do | |
| 2122 // because for PlzNavigate the request would otherwise get cancelled in the | |
| 2123 // browser before the renderer sees it. | |
| 2124 host_resolver()->AddRule( | |
| 2125 "example.test", | |
| 2126 embedded_test_server()->GetURL("/title1.html").host()); | |
| 2127 | |
| 2119 std::string top_frame_path; | 2128 std::string top_frame_path; |
| 2120 GetTopFramePath(*embedded_test_server(), https_server_, https_server_expired_, | 2129 GetTopFramePath(*embedded_test_server(), https_server_, https_server_expired_, |
| 2121 &top_frame_path); | 2130 &top_frame_path); |
| 2122 | 2131 |
| 2123 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 2132 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 2124 ui_test_utils::NavigateToURL(browser(), | 2133 ui_test_utils::NavigateToURL(browser(), |
| 2125 https_server_.GetURL(top_frame_path)); | 2134 https_server_.GetURL(top_frame_path)); |
| 2126 | 2135 |
| 2127 CheckAuthenticatedState(tab, AuthState::NONE); | 2136 CheckAuthenticatedState(tab, AuthState::NONE); |
| 2128 | 2137 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2186 content::NOTIFICATION_LOAD_STOP, | 2195 content::NOTIFICATION_LOAD_STOP, |
| 2187 content::Source<NavigationController>(&tab->GetController())); | 2196 content::Source<NavigationController>(&tab->GetController())); |
| 2188 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 2197 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 2189 tab, | 2198 tab, |
| 2190 "window.domAutomationController.send(clickLink('HTTPLink'));", | 2199 "window.domAutomationController.send(clickLink('HTTPLink'));", |
| 2191 &success)); | 2200 &success)); |
| 2192 ASSERT_TRUE(success); | 2201 ASSERT_TRUE(success); |
| 2193 observer.Wait(); | 2202 observer.Wait(); |
| 2194 } | 2203 } |
| 2195 | 2204 |
| 2196 // Our state should be unathenticated (in the ran mixed script sense) | 2205 // Our state should be unathenticated (in the ran mixed script sense). Note |
| 2206 // this also displayed images from the http page (google.com). | |
|
scottmg
2016/09/12 23:13:30
displayed -> displays
jam
2016/09/12 23:21:54
Done.
| |
| 2197 CheckAuthenticationBrokenState( | 2207 CheckAuthenticationBrokenState( |
| 2198 tab, | 2208 tab, |
| 2199 CertError::NONE, | 2209 CertError::NONE, |
| 2200 AuthState::RAN_INSECURE_CONTENT); | 2210 AuthState::RAN_INSECURE_CONTENT | AuthState::DISPLAYED_INSECURE_CONTENT); |
| 2201 | 2211 |
| 2202 // Go back, our state should be unchanged. | 2212 // Go back, our state should be unchanged. |
| 2203 { | 2213 { |
| 2204 content::WindowedNotificationObserver observer( | 2214 content::WindowedNotificationObserver observer( |
| 2205 content::NOTIFICATION_LOAD_STOP, | 2215 content::NOTIFICATION_LOAD_STOP, |
| 2206 content::Source<NavigationController>(&tab->GetController())); | 2216 content::Source<NavigationController>(&tab->GetController())); |
| 2207 tab->GetController().GoBack(); | 2217 tab->GetController().GoBack(); |
| 2208 observer.Wait(); | 2218 observer.Wait(); |
| 2209 } | 2219 } |
| 2210 | 2220 |
| 2211 CheckAuthenticationBrokenState( | 2221 CheckAuthenticationBrokenState( |
| 2212 tab, | 2222 tab, |
| 2213 CertError::NONE, | 2223 CertError::NONE, |
| 2214 AuthState::RAN_INSECURE_CONTENT); | 2224 AuthState::RAN_INSECURE_CONTENT | AuthState::DISPLAYED_INSECURE_CONTENT); |
| 2215 } | 2225 } |
| 2216 | 2226 |
| 2217 // From a bad HTTPS top frame: | 2227 // From a bad HTTPS top frame: |
| 2218 // - navigate to an OK HTTPS frame (expected to be still authentication broken). | 2228 // - navigate to an OK HTTPS frame (expected to be still authentication broken). |
| 2219 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadFrameNavigation) { | 2229 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadFrameNavigation) { |
| 2220 ASSERT_TRUE(embedded_test_server()->Start()); | 2230 ASSERT_TRUE(embedded_test_server()->Start()); |
| 2221 ASSERT_TRUE(https_server_.Start()); | 2231 ASSERT_TRUE(https_server_.Start()); |
| 2222 ASSERT_TRUE(https_server_expired_.Start()); | 2232 ASSERT_TRUE(https_server_expired_.Start()); |
| 2223 | 2233 |
| 2224 std::string top_frame_path; | 2234 std::string top_frame_path; |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3251 | 3261 |
| 3252 // Visit a page over https that contains a frame with a redirect. | 3262 // Visit a page over https that contains a frame with a redirect. |
| 3253 | 3263 |
| 3254 // XMLHttpRequest insecure content in synchronous mode. | 3264 // XMLHttpRequest insecure content in synchronous mode. |
| 3255 | 3265 |
| 3256 // XMLHttpRequest insecure content in asynchronous mode. | 3266 // XMLHttpRequest insecure content in asynchronous mode. |
| 3257 | 3267 |
| 3258 // XMLHttpRequest over bad ssl in synchronous mode. | 3268 // XMLHttpRequest over bad ssl in synchronous mode. |
| 3259 | 3269 |
| 3260 // XMLHttpRequest over OK ssl in synchronous mode. | 3270 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |