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

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

Issue 1899003002: Remove URLRequestNonsecureConnection as it's unused (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed unused include as well Created 4 years, 8 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 | no next file » | 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 "chrome/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 #include "content/public/test/browser_test_utils.h" 99 #include "content/public/test/browser_test_utils.h"
100 #include "content/public/test/test_navigation_observer.h" 100 #include "content/public/test/test_navigation_observer.h"
101 #include "extensions/browser/extension_registry.h" 101 #include "extensions/browser/extension_registry.h"
102 #include "extensions/browser/extension_system.h" 102 #include "extensions/browser/extension_system.h"
103 #include "extensions/browser/uninstall_reason.h" 103 #include "extensions/browser/uninstall_reason.h"
104 #include "extensions/common/constants.h" 104 #include "extensions/common/constants.h"
105 #include "extensions/common/extension.h" 105 #include "extensions/common/extension.h"
106 #include "extensions/common/extension_set.h" 106 #include "extensions/common/extension_set.h"
107 #include "net/base/net_errors.h" 107 #include "net/base/net_errors.h"
108 #include "net/dns/mock_host_resolver.h" 108 #include "net/dns/mock_host_resolver.h"
109 #include "net/ssl/ssl_connection_status_flags.h"
110 #include "net/test/embedded_test_server/embedded_test_server.h" 109 #include "net/test/embedded_test_server/embedded_test_server.h"
111 #include "net/test/embedded_test_server/request_handler_util.h" 110 #include "net/test/embedded_test_server/request_handler_util.h"
112 #include "net/test/spawned_test_server/spawned_test_server.h" 111 #include "net/test/spawned_test_server/spawned_test_server.h"
113 #include "net/test/url_request/url_request_mock_http_job.h" 112 #include "net/test/url_request/url_request_mock_http_job.h"
114 #include "net/url_request/url_request_filter.h" 113 #include "net/url_request/url_request_filter.h"
115 #include "net/url_request/url_request_test_util.h" 114 #include "net/url_request/url_request_test_util.h"
116 #include "ui/base/l10n/l10n_util.h" 115 #include "ui/base/l10n/l10n_util.h"
117 #include "ui/base/page_transition_types.h" 116 #include "ui/base/page_transition_types.h"
118 117
119 #if defined(OS_MACOSX) 118 #if defined(OS_MACOSX)
(...skipping 2967 matching lines...) Expand 10 before | Expand all | Expand 10 after
3087 EXPECT_EQ(0u, observer.latest_explanations().broken_explanations.size()); 3086 EXPECT_EQ(0u, observer.latest_explanations().broken_explanations.size());
3088 CheckSecureExplanations(observer.latest_explanations().secure_explanations, 3087 CheckSecureExplanations(observer.latest_explanations().secure_explanations,
3089 VALID_CERTIFICATE, browser()); 3088 VALID_CERTIFICATE, browser());
3090 EXPECT_TRUE(observer.latest_explanations().scheme_is_cryptographic); 3089 EXPECT_TRUE(observer.latest_explanations().scheme_is_cryptographic);
3091 EXPECT_FALSE(observer.latest_explanations().displayed_insecure_content); 3090 EXPECT_FALSE(observer.latest_explanations().displayed_insecure_content);
3092 EXPECT_FALSE(observer.latest_explanations().ran_insecure_content); 3091 EXPECT_FALSE(observer.latest_explanations().ran_insecure_content);
3093 } 3092 }
3094 3093
3095 namespace { 3094 namespace {
3096 3095
3097 // A URLRequestMockHTTPJob that mocks an SSL connection with an
3098 // obsolete protocol version.
3099 class URLRequestNonsecureConnection : public net::URLRequestMockHTTPJob {
3100 public:
3101 void GetResponseInfo(net::HttpResponseInfo* info) override {
3102 info->ssl_info.connection_status = (net::SSL_CONNECTION_VERSION_TLS1_1
3103 << net::SSL_CONNECTION_VERSION_SHIFT);
3104 // TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 from
3105 // http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-par ameters-4
3106 const uint16_t ciphersuite = 0xc02f;
3107 net::SSLConnectionStatusSetCipherSuite(ciphersuite,
3108 &info->ssl_info.connection_status);
3109 }
3110
3111 protected:
3112 ~URLRequestNonsecureConnection() override {}
3113
3114 private:
3115 DISALLOW_COPY_AND_ASSIGN(URLRequestNonsecureConnection);
3116 };
3117
3118 class BrowserTestNonsecureURLRequest : public BrowserTest { 3096 class BrowserTestNonsecureURLRequest : public BrowserTest {
3119 public: 3097 public:
3120 BrowserTestNonsecureURLRequest() : BrowserTest() {} 3098 BrowserTestNonsecureURLRequest() : BrowserTest() {}
3121 void SetUpOnMainThread() override { 3099 void SetUpOnMainThread() override {
3122 base::FilePath root_http; 3100 base::FilePath root_http;
3123 PathService::Get(chrome::DIR_TEST_DATA, &root_http); 3101 PathService::Get(chrome::DIR_TEST_DATA, &root_http);
3124 content::BrowserThread::PostTask( 3102 content::BrowserThread::PostTask(
3125 content::BrowserThread::IO, FROM_HERE, 3103 content::BrowserThread::IO, FROM_HERE,
3126 base::Bind( 3104 base::Bind(
3127 &URLRequestNonsecureConnection::AddUrlHandlers, root_http, 3105 &net::URLRequestMockHTTPJob::AddUrlHandlers, root_http,
3128 make_scoped_refptr(content::BrowserThread::GetBlockingPool()))); 3106 make_scoped_refptr(content::BrowserThread::GetBlockingPool())));
3129 } 3107 }
3130 3108
3131 private: 3109 private:
3132 DISALLOW_COPY_AND_ASSIGN(BrowserTestNonsecureURLRequest); 3110 DISALLOW_COPY_AND_ASSIGN(BrowserTestNonsecureURLRequest);
3133 }; 3111 };
3134 3112
3135 } // namespace 3113 } // namespace
3136 3114
3137 // Tests that a nonsecure connection does not get a secure connection 3115 // Tests that a nonsecure connection does not get a secure connection
3138 // explanation. 3116 // explanation.
3139 IN_PROC_BROWSER_TEST_F(BrowserTestNonsecureURLRequest, 3117 IN_PROC_BROWSER_TEST_F(BrowserTestNonsecureURLRequest,
3140 SecurityStyleChangedObserverNonsecureConnection) { 3118 SecurityStyleChangedObserverNonsecureConnection) {
3141 content::WebContents* web_contents = 3119 content::WebContents* web_contents =
3142 browser()->tab_strip_model()->GetActiveWebContents(); 3120 browser()->tab_strip_model()->GetActiveWebContents();
3143 SecurityStyleTestObserver observer(web_contents); 3121 SecurityStyleTestObserver observer(web_contents);
3144 3122
3145 ui_test_utils::NavigateToURL( 3123 ui_test_utils::NavigateToURL(
3146 browser(), URLRequestNonsecureConnection::GetMockHttpsUrl(std::string())); 3124 browser(), net::URLRequestMockHTTPJob::GetMockHttpsUrl(std::string()));
3147 for (const auto& explanation : 3125 for (const auto& explanation :
3148 observer.latest_explanations().secure_explanations) { 3126 observer.latest_explanations().secure_explanations) {
3149 EXPECT_NE(l10n_util::GetStringUTF8(IDS_SECURE_PROTOCOL_AND_CIPHERSUITE), 3127 EXPECT_NE(l10n_util::GetStringUTF8(IDS_SECURE_PROTOCOL_AND_CIPHERSUITE),
3150 explanation.summary); 3128 explanation.summary);
3151 } 3129 }
3152 } 3130 }
3153 3131
3154 namespace { 3132 namespace {
3155 class JSBooleanResultGetter { 3133 class JSBooleanResultGetter {
3156 public: 3134 public:
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
3299 Browser* browser = new Browser(params); 3277 Browser* browser = new Browser(params);
3300 gfx::Rect bounds = browser->window()->GetBounds(); 3278 gfx::Rect bounds = browser->window()->GetBounds();
3301 3279
3302 // Should be EXPECT_EQ, but this width is inconsistent across platforms. 3280 // Should be EXPECT_EQ, but this width is inconsistent across platforms.
3303 // See https://crbug.com/567925. 3281 // See https://crbug.com/567925.
3304 EXPECT_GE(bounds.width(), 100); 3282 EXPECT_GE(bounds.width(), 100);
3305 EXPECT_EQ(122, bounds.height()); 3283 EXPECT_EQ(122, bounds.height());
3306 browser->window()->Close(); 3284 browser->window()->Close();
3307 } 3285 }
3308 } 3286 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698