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

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

Issue 2305093002: Fix incorrect SSL state being shown for client redirects. (Closed)
Patch Set: more tests Created 4 years, 3 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
« no previous file with comments | « no previous file | chrome/test/data/ssl/in_page_navigation_during_load.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <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 3180 matching lines...) Expand 10 before | Expand all | Expand 10 after
3191 content::TestNavigationObserver observer(tab); 3191 content::TestNavigationObserver observer(tab);
3192 tab->GetController().LoadURL(tab->GetLastCommittedURL(), 3192 tab->GetController().LoadURL(tab->GetLastCommittedURL(),
3193 content::Referrer(), ui::PAGE_TRANSITION_LINK, 3193 content::Referrer(), ui::PAGE_TRANSITION_LINK,
3194 std::string()); 3194 std::string());
3195 observer.Wait(); 3195 observer.Wait();
3196 } 3196 }
3197 3197
3198 CheckAuthenticatedState(tab, AuthState::NONE); 3198 CheckAuthenticatedState(tab, AuthState::NONE);
3199 } 3199 }
3200 3200
3201 // Checks that if a redirect occurs while the page is loading, the SSL state
3202 // reflects the final URL.
3203 IN_PROC_BROWSER_TEST_F(SSLUITest, ClientRedirectSSLState) {
3204 ASSERT_TRUE(embedded_test_server()->Start());
3205 ASSERT_TRUE(https_server_.Start());
3206
3207 GURL https_url = https_server_.GetURL("/ssl/redirect.html?");
3208 GURL http_url = embedded_test_server()->GetURL("/ssl/google.html");
3209
3210 GURL url(https_url.spec() + http_url.spec());
3211 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 2);
3212 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
3213 CheckUnauthenticatedState(tab, AuthState::NONE);
3214 }
3215
3216 // Checks that if a redirect occurs while the page is loading from a mixed
3217 // content to a valid HTTPS page, the SSL state reflects the final URL.
3218 IN_PROC_BROWSER_TEST_F(SSLUITest, ClientRedirectFromMixedContentSSLState) {
3219 ASSERT_TRUE(https_server_.Start());
3220
3221 GURL url =
3222 GURL(https_server_.GetURL("/ssl/redirect_with_mixed_content.html").spec()
3223 + "?" +
3224 https_server_.GetURL("/ssl/google.html").spec());
3225
3226 // Load a page that displays insecure content.
3227 ui_test_utils::NavigateToURL(browser(), url);
3228 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
3229 CheckAuthenticatedState(tab, AuthState::NONE);
3230 }
3231
3232 // Checks that if a redirect occurs while the page is loading from a valid HTTPS
3233 // page to a mixed content page, the SSL state reflects the final URL.
3234 IN_PROC_BROWSER_TEST_F(SSLUITest, ClientRedirectToMixedContentSSLState) {
3235 ASSERT_TRUE(embedded_test_server()->Start());
3236 ASSERT_TRUE(https_server_.Start());
3237
3238 GURL url =
3239 GURL(https_server_.GetURL("/ssl/redirect.html").spec()
3240 + "?" +
3241 https_server_.GetURL("/ssl/page_displays_insecure_content.html").spec());
3242
3243 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 2);
3244 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
3245 CheckAuthenticatedState(tab, AuthState::DISPLAYED_INSECURE_CONTENT);
3246 }
3247
3248 // Checks that in-page navigations during page load preserves SSL state.
3249 IN_PROC_BROWSER_TEST_F(SSLUITest, InPageNavigationDuringLoadSSLState) {
3250 ASSERT_TRUE(https_server_.Start());
3251
3252 ui_test_utils::NavigateToURL(
3253 browser(),
3254 https_server_.GetURL("/ssl/in_page_navigation_during_load.html"));
3255 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
3256 CheckAuthenticatedState(tab, AuthState::NONE);
3257 }
3258
3259 // Checks that in-page navigations after the page load preserves SSL state.
3260 IN_PROC_BROWSER_TEST_F(SSLUITest, InPageNavigationAfterLoadSSLState) {
3261 ASSERT_TRUE(https_server_.Start());
3262
3263 ui_test_utils::NavigateToURL(browser(),
3264 https_server_.GetURL("/ssl/google.html"));
3265 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
3266 ASSERT_TRUE(content::ExecuteScript(tab, "location.hash = Math.random()"));
3267 CheckAuthenticatedState(tab, AuthState::NONE);
3268 }
3269
3201 // TODO(jcampan): more tests to do below. 3270 // TODO(jcampan): more tests to do below.
3202 3271
3203 // Visit a page over https that contains a frame with a redirect. 3272 // Visit a page over https that contains a frame with a redirect.
3204 3273
3205 // XMLHttpRequest insecure content in synchronous mode. 3274 // XMLHttpRequest insecure content in synchronous mode.
3206 3275
3207 // XMLHttpRequest insecure content in asynchronous mode. 3276 // XMLHttpRequest insecure content in asynchronous mode.
3208 3277
3209 // XMLHttpRequest over bad ssl in synchronous mode. 3278 // XMLHttpRequest over bad ssl in synchronous mode.
3210 3279
3211 // XMLHttpRequest over OK ssl in synchronous mode. 3280 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/ssl/in_page_navigation_during_load.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698