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

Side by Side Diff: chrome/browser/ui/browser_browsertest.cc

Issue 1358063002: Switch warning_explanations (yellow) to be unauthenticated_explanations (neutral). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 1 month 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 | « chrome/browser/ui/browser.cc ('k') | content/browser/devtools/protocol/security_handler.cc » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 // Check that |observer|'s latest event was for an expired certificate 396 // Check that |observer|'s latest event was for an expired certificate
397 // and that it saw the proper SecurityStyle and explanations. 397 // and that it saw the proper SecurityStyle and explanations.
398 void CheckBrokenSecurityStyle(const SecurityStyleTestObserver& observer, 398 void CheckBrokenSecurityStyle(const SecurityStyleTestObserver& observer,
399 int error, 399 int error,
400 Browser* browser) { 400 Browser* browser) {
401 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, 401 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATION_BROKEN,
402 observer.latest_security_style()); 402 observer.latest_security_style());
403 403
404 const content::SecurityStyleExplanations& expired_explanation = 404 const content::SecurityStyleExplanations& expired_explanation =
405 observer.latest_explanations(); 405 observer.latest_explanations();
406 EXPECT_EQ(0u, expired_explanation.warning_explanations.size()); 406 EXPECT_EQ(0u, expired_explanation.unauthenticated_explanations.size());
407 ASSERT_EQ(1u, expired_explanation.broken_explanations.size()); 407 ASSERT_EQ(1u, expired_explanation.broken_explanations.size());
408 408
409 // Check that the summary and description are as expected. 409 // Check that the summary and description are as expected.
410 EXPECT_EQ(l10n_util::GetStringUTF8(IDS_CERTIFICATE_CHAIN_ERROR), 410 EXPECT_EQ(l10n_util::GetStringUTF8(IDS_CERTIFICATE_CHAIN_ERROR),
411 expired_explanation.broken_explanations[0].summary); 411 expired_explanation.broken_explanations[0].summary);
412 412
413 base::string16 error_string = base::UTF8ToUTF16(net::ErrorToString(error)); 413 base::string16 error_string = base::UTF8ToUTF16(net::ErrorToString(error));
414 EXPECT_EQ(l10n_util::GetStringFUTF8( 414 EXPECT_EQ(l10n_util::GetStringFUTF8(
415 IDS_CERTIFICATE_CHAIN_ERROR_DESCRIPTION_FORMAT, error_string), 415 IDS_CERTIFICATE_CHAIN_ERROR_DESCRIPTION_FORMAT, error_string),
416 expired_explanation.broken_explanations[0].description); 416 expired_explanation.broken_explanations[0].description);
(...skipping 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after
2925 2925
2926 content::WebContents* web_contents = 2926 content::WebContents* web_contents =
2927 browser()->tab_strip_model()->GetActiveWebContents(); 2927 browser()->tab_strip_model()->GetActiveWebContents();
2928 SecurityStyleTestObserver observer(web_contents); 2928 SecurityStyleTestObserver observer(web_contents);
2929 2929
2930 // Visit an HTTP url. 2930 // Visit an HTTP url.
2931 GURL http_url(embedded_test_server()->GetURL("/")); 2931 GURL http_url(embedded_test_server()->GetURL("/"));
2932 ui_test_utils::NavigateToURL(browser(), http_url); 2932 ui_test_utils::NavigateToURL(browser(), http_url);
2933 EXPECT_EQ(content::SECURITY_STYLE_UNAUTHENTICATED, 2933 EXPECT_EQ(content::SECURITY_STYLE_UNAUTHENTICATED,
2934 observer.latest_security_style()); 2934 observer.latest_security_style());
2935 EXPECT_EQ(0u, observer.latest_explanations().warning_explanations.size()); 2935 EXPECT_EQ(0u,
2936 observer.latest_explanations().unauthenticated_explanations.size());
2936 EXPECT_EQ(0u, observer.latest_explanations().broken_explanations.size()); 2937 EXPECT_EQ(0u, observer.latest_explanations().broken_explanations.size());
2937 EXPECT_EQ(0u, observer.latest_explanations().secure_explanations.size()); 2938 EXPECT_EQ(0u, observer.latest_explanations().secure_explanations.size());
2938 EXPECT_FALSE(observer.latest_explanations().scheme_is_cryptographic); 2939 EXPECT_FALSE(observer.latest_explanations().scheme_is_cryptographic);
2939 EXPECT_FALSE(observer.latest_explanations().ran_insecure_content); 2940 EXPECT_FALSE(observer.latest_explanations().ran_insecure_content);
2940 EXPECT_FALSE(observer.latest_explanations().displayed_insecure_content); 2941 EXPECT_FALSE(observer.latest_explanations().displayed_insecure_content);
2941 2942
2942 // Visit an (otherwise valid) HTTPS page that displays mixed content. 2943 // Visit an (otherwise valid) HTTPS page that displays mixed content.
2943 std::string replacement_path; 2944 std::string replacement_path;
2944 GetFilePathWithHostAndPortReplacement( 2945 GetFilePathWithHostAndPortReplacement(
2945 "/ssl/page_displays_insecure_content.html", 2946 "/ssl/page_displays_insecure_content.html",
2946 embedded_test_server()->host_port_pair(), &replacement_path); 2947 embedded_test_server()->host_port_pair(), &replacement_path);
2947 2948
2948 GURL mixed_content_url(https_test_server.GetURL(replacement_path)); 2949 GURL mixed_content_url(https_test_server.GetURL(replacement_path));
2949 ui_test_utils::NavigateToURL(browser(), mixed_content_url); 2950 ui_test_utils::NavigateToURL(browser(), mixed_content_url);
2950 EXPECT_EQ(content::SECURITY_STYLE_UNAUTHENTICATED, 2951 EXPECT_EQ(content::SECURITY_STYLE_UNAUTHENTICATED,
2951 observer.latest_security_style()); 2952 observer.latest_security_style());
2952 2953
2953 const content::SecurityStyleExplanations& mixed_content_explanation = 2954 const content::SecurityStyleExplanations& mixed_content_explanation =
2954 observer.latest_explanations(); 2955 observer.latest_explanations();
2955 ASSERT_EQ(0u, mixed_content_explanation.warning_explanations.size()); 2956 ASSERT_EQ(0u, mixed_content_explanation.unauthenticated_explanations.size());
2956 ASSERT_EQ(0u, mixed_content_explanation.broken_explanations.size()); 2957 ASSERT_EQ(0u, mixed_content_explanation.broken_explanations.size());
2957 CheckSecureExplanations(mixed_content_explanation.secure_explanations, 2958 CheckSecureExplanations(mixed_content_explanation.secure_explanations,
2958 VALID_CERTIFICATE, browser()); 2959 VALID_CERTIFICATE, browser());
2959 EXPECT_TRUE(mixed_content_explanation.scheme_is_cryptographic); 2960 EXPECT_TRUE(mixed_content_explanation.scheme_is_cryptographic);
2960 EXPECT_TRUE(mixed_content_explanation.displayed_insecure_content); 2961 EXPECT_TRUE(mixed_content_explanation.displayed_insecure_content);
2961 EXPECT_FALSE(mixed_content_explanation.ran_insecure_content); 2962 EXPECT_FALSE(mixed_content_explanation.ran_insecure_content);
2962 EXPECT_EQ(content::SECURITY_STYLE_UNAUTHENTICATED, 2963 EXPECT_EQ(content::SECURITY_STYLE_UNAUTHENTICATED,
2963 mixed_content_explanation.displayed_insecure_content_style); 2964 mixed_content_explanation.displayed_insecure_content_style);
2964 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, 2965 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATION_BROKEN,
2965 mixed_content_explanation.ran_insecure_content_style); 2966 mixed_content_explanation.ran_insecure_content_style);
(...skipping 12 matching lines...) Expand all
2978 EXPECT_TRUE(observer.latest_explanations().scheme_is_cryptographic); 2979 EXPECT_TRUE(observer.latest_explanations().scheme_is_cryptographic);
2979 EXPECT_FALSE(observer.latest_explanations().displayed_insecure_content); 2980 EXPECT_FALSE(observer.latest_explanations().displayed_insecure_content);
2980 EXPECT_FALSE(observer.latest_explanations().ran_insecure_content); 2981 EXPECT_FALSE(observer.latest_explanations().ran_insecure_content);
2981 2982
2982 // Before clicking through, navigate to a different page, and then go 2983 // Before clicking through, navigate to a different page, and then go
2983 // back to the interstitial. 2984 // back to the interstitial.
2984 GURL valid_https_url(https_test_server.GetURL(std::string("/"))); 2985 GURL valid_https_url(https_test_server.GetURL(std::string("/")));
2985 ui_test_utils::NavigateToURL(browser(), valid_https_url); 2986 ui_test_utils::NavigateToURL(browser(), valid_https_url);
2986 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATED, 2987 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATED,
2987 observer.latest_security_style()); 2988 observer.latest_security_style());
2988 EXPECT_EQ(0u, observer.latest_explanations().warning_explanations.size()); 2989 EXPECT_EQ(0u,
2990 observer.latest_explanations().unauthenticated_explanations.size());
2989 EXPECT_EQ(0u, observer.latest_explanations().broken_explanations.size()); 2991 EXPECT_EQ(0u, observer.latest_explanations().broken_explanations.size());
2990 CheckSecureExplanations(observer.latest_explanations().secure_explanations, 2992 CheckSecureExplanations(observer.latest_explanations().secure_explanations,
2991 VALID_CERTIFICATE, browser()); 2993 VALID_CERTIFICATE, browser());
2992 EXPECT_TRUE(observer.latest_explanations().scheme_is_cryptographic); 2994 EXPECT_TRUE(observer.latest_explanations().scheme_is_cryptographic);
2993 EXPECT_FALSE(observer.latest_explanations().displayed_insecure_content); 2995 EXPECT_FALSE(observer.latest_explanations().displayed_insecure_content);
2994 EXPECT_FALSE(observer.latest_explanations().ran_insecure_content); 2996 EXPECT_FALSE(observer.latest_explanations().ran_insecure_content);
2995 2997
2996 // After going back to the interstitial, an event for a broken lock 2998 // After going back to the interstitial, an event for a broken lock
2997 // icon should fire again. 2999 // icon should fire again.
2998 ui_test_utils::NavigateToURL(browser(), expired_url); 3000 ui_test_utils::NavigateToURL(browser(), expired_url);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
3039 3041
3040 content::WebContents* web_contents = 3042 content::WebContents* web_contents =
3041 browser()->tab_strip_model()->GetActiveWebContents(); 3043 browser()->tab_strip_model()->GetActiveWebContents();
3042 SecurityStyleTestObserver observer(web_contents); 3044 SecurityStyleTestObserver observer(web_contents);
3043 3045
3044 // Visit a valid HTTPS url. 3046 // Visit a valid HTTPS url.
3045 GURL valid_https_url(https_test_server.GetURL(std::string("/"))); 3047 GURL valid_https_url(https_test_server.GetURL(std::string("/")));
3046 ui_test_utils::NavigateToURL(browser(), valid_https_url); 3048 ui_test_utils::NavigateToURL(browser(), valid_https_url);
3047 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATED, 3049 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATED,
3048 observer.latest_security_style()); 3050 observer.latest_security_style());
3049 EXPECT_EQ(0u, observer.latest_explanations().warning_explanations.size()); 3051 EXPECT_EQ(0u,
3052 observer.latest_explanations().unauthenticated_explanations.size());
3050 EXPECT_EQ(0u, observer.latest_explanations().broken_explanations.size()); 3053 EXPECT_EQ(0u, observer.latest_explanations().broken_explanations.size());
3051 CheckSecureExplanations(observer.latest_explanations().secure_explanations, 3054 CheckSecureExplanations(observer.latest_explanations().secure_explanations,
3052 VALID_CERTIFICATE, browser()); 3055 VALID_CERTIFICATE, browser());
3053 EXPECT_TRUE(observer.latest_explanations().scheme_is_cryptographic); 3056 EXPECT_TRUE(observer.latest_explanations().scheme_is_cryptographic);
3054 EXPECT_FALSE(observer.latest_explanations().displayed_insecure_content); 3057 EXPECT_FALSE(observer.latest_explanations().displayed_insecure_content);
3055 EXPECT_FALSE(observer.latest_explanations().ran_insecure_content); 3058 EXPECT_FALSE(observer.latest_explanations().ran_insecure_content);
3056 3059
3057 // Navigate to a bad HTTPS page on a different host, and then click 3060 // Navigate to a bad HTTPS page on a different host, and then click
3058 // Back to verify that the previous good security style is seen again. 3061 // Back to verify that the previous good security style is seen again.
3059 GURL expired_https_url(https_test_server_expired.GetURL(std::string("/"))); 3062 GURL expired_https_url(https_test_server_expired.GetURL(std::string("/")));
(...skipping 19 matching lines...) Expand all
3079 EXPECT_FALSE(observer.latest_explanations().ran_insecure_content); 3082 EXPECT_FALSE(observer.latest_explanations().ran_insecure_content);
3080 3083
3081 content::WindowedNotificationObserver back_nav_load_observer( 3084 content::WindowedNotificationObserver back_nav_load_observer(
3082 content::NOTIFICATION_LOAD_STOP, 3085 content::NOTIFICATION_LOAD_STOP,
3083 content::Source<NavigationController>(&web_contents->GetController())); 3086 content::Source<NavigationController>(&web_contents->GetController()));
3084 chrome::GoBack(browser(), CURRENT_TAB); 3087 chrome::GoBack(browser(), CURRENT_TAB);
3085 back_nav_load_observer.Wait(); 3088 back_nav_load_observer.Wait();
3086 3089
3087 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATED, 3090 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATED,
3088 observer.latest_security_style()); 3091 observer.latest_security_style());
3089 EXPECT_EQ(0u, observer.latest_explanations().warning_explanations.size()); 3092 EXPECT_EQ(0u,
3093 observer.latest_explanations().unauthenticated_explanations.size());
3090 EXPECT_EQ(0u, observer.latest_explanations().broken_explanations.size()); 3094 EXPECT_EQ(0u, observer.latest_explanations().broken_explanations.size());
3091 CheckSecureExplanations(observer.latest_explanations().secure_explanations, 3095 CheckSecureExplanations(observer.latest_explanations().secure_explanations,
3092 VALID_CERTIFICATE, browser()); 3096 VALID_CERTIFICATE, browser());
3093 EXPECT_TRUE(observer.latest_explanations().scheme_is_cryptographic); 3097 EXPECT_TRUE(observer.latest_explanations().scheme_is_cryptographic);
3094 EXPECT_FALSE(observer.latest_explanations().displayed_insecure_content); 3098 EXPECT_FALSE(observer.latest_explanations().displayed_insecure_content);
3095 EXPECT_FALSE(observer.latest_explanations().ran_insecure_content); 3099 EXPECT_FALSE(observer.latest_explanations().ran_insecure_content);
3096 } 3100 }
3097 3101
3098 namespace { 3102 namespace {
3099 3103
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
3212 false); 3216 false);
3213 3217
3214 // Sync navigation just to make sure IPC has passed (updated 3218 // Sync navigation just to make sure IPC has passed (updated
3215 // display mode is delivered to RP). 3219 // display mode is delivered to RP).
3216 content::TestNavigationObserver observer(app_contents, 1); 3220 content::TestNavigationObserver observer(app_contents, 1);
3217 ui_test_utils::NavigateToURL(app_browser, GURL(url::kAboutBlankURL)); 3221 ui_test_utils::NavigateToURL(app_browser, GURL(url::kAboutBlankURL));
3218 observer.Wait(); 3222 observer.Wait();
3219 3223
3220 CheckDisplayModeMQ(ASCIIToUTF16("fullscreen"), app_contents); 3224 CheckDisplayModeMQ(ASCIIToUTF16("fullscreen"), app_contents);
3221 } 3225 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | content/browser/devtools/protocol/security_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698