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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 578553004: Remove the "snionly" concept from the HSTS preload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ... Created 6 years, 2 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 | « net/url_request/url_request_http_job.cc ('k') | 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 (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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #endif 10 #endif
(...skipping 6614 matching lines...) Expand 10 before | Expand all | Expand 10 after
6625 6625
6626 MockHostResolver host_resolver; 6626 MockHostResolver host_resolver;
6627 TestNetworkDelegate network_delegate; // Must outlive URLRequest. 6627 TestNetworkDelegate network_delegate; // Must outlive URLRequest.
6628 TestURLRequestContext context(true); 6628 TestURLRequestContext context(true);
6629 context.set_network_delegate(&network_delegate); 6629 context.set_network_delegate(&network_delegate);
6630 context.set_host_resolver(&host_resolver); 6630 context.set_host_resolver(&host_resolver);
6631 TransportSecurityState transport_security_state; 6631 TransportSecurityState transport_security_state;
6632 6632
6633 TransportSecurityState::DomainState static_domain_state; 6633 TransportSecurityState::DomainState static_domain_state;
6634 EXPECT_TRUE(transport_security_state.GetStaticDomainState( 6634 EXPECT_TRUE(transport_security_state.GetStaticDomainState(
6635 "www.google.com", true, &static_domain_state)); 6635 "www.google.com", &static_domain_state));
6636 context.set_transport_security_state(&transport_security_state); 6636 context.set_transport_security_state(&transport_security_state);
6637 context.Init(); 6637 context.Init();
6638 6638
6639 TransportSecurityState::DomainState dynamic_domain_state; 6639 TransportSecurityState::DomainState dynamic_domain_state;
6640 EXPECT_FALSE(transport_security_state.GetDynamicDomainState( 6640 EXPECT_FALSE(transport_security_state.GetDynamicDomainState(
6641 "www.google.com", &dynamic_domain_state)); 6641 "www.google.com", &dynamic_domain_state));
6642 6642
6643 TestDelegate d; 6643 TestDelegate d;
6644 scoped_ptr<URLRequest> r(context.CreateRequest( 6644 scoped_ptr<URLRequest> r(context.CreateRequest(
6645 GURL(base::StringPrintf("https://www.google.com:%d", 6645 GURL(base::StringPrintf("https://www.google.com:%d",
6646 test_server.host_port_pair().port())), 6646 test_server.host_port_pair().port())),
6647 DEFAULT_PRIORITY, &d, NULL)); 6647 DEFAULT_PRIORITY, &d, NULL));
6648 6648
6649 r->Start(); 6649 r->Start();
6650 EXPECT_TRUE(r->is_pending()); 6650 EXPECT_TRUE(r->is_pending());
6651 6651
6652 base::RunLoop().Run(); 6652 base::RunLoop().Run();
6653 6653
6654 EXPECT_EQ(1, d.response_started_count()); 6654 EXPECT_EQ(1, d.response_started_count());
6655 EXPECT_FALSE(d.received_data_before_response()); 6655 EXPECT_FALSE(d.received_data_before_response());
6656 EXPECT_TRUE(d.have_certificate_errors()); 6656 EXPECT_TRUE(d.have_certificate_errors());
6657 EXPECT_TRUE(d.certificate_errors_are_fatal()); 6657 EXPECT_TRUE(d.certificate_errors_are_fatal());
6658 6658
6659 // Get a fresh copy of the states, and check that they haven't changed. 6659 // Get a fresh copy of the states, and check that they haven't changed.
6660 TransportSecurityState::DomainState new_static_domain_state; 6660 TransportSecurityState::DomainState new_static_domain_state;
6661 EXPECT_TRUE(transport_security_state.GetStaticDomainState( 6661 EXPECT_TRUE(transport_security_state.GetStaticDomainState(
6662 "www.google.com", true, &new_static_domain_state)); 6662 "www.google.com", &new_static_domain_state));
6663 TransportSecurityState::DomainState new_dynamic_domain_state; 6663 TransportSecurityState::DomainState new_dynamic_domain_state;
6664 EXPECT_FALSE(transport_security_state.GetDynamicDomainState( 6664 EXPECT_FALSE(transport_security_state.GetDynamicDomainState(
6665 "www.google.com", &new_dynamic_domain_state)); 6665 "www.google.com", &new_dynamic_domain_state));
6666 6666
6667 EXPECT_EQ(new_static_domain_state.sts.upgrade_mode, 6667 EXPECT_EQ(new_static_domain_state.sts.upgrade_mode,
6668 static_domain_state.sts.upgrade_mode); 6668 static_domain_state.sts.upgrade_mode);
6669 EXPECT_EQ(new_static_domain_state.sts.include_subdomains, 6669 EXPECT_EQ(new_static_domain_state.sts.include_subdomains,
6670 static_domain_state.sts.include_subdomains); 6670 static_domain_state.sts.include_subdomains);
6671 EXPECT_EQ(new_static_domain_state.pkp.include_subdomains, 6671 EXPECT_EQ(new_static_domain_state.pkp.include_subdomains,
6672 static_domain_state.pkp.include_subdomains); 6672 static_domain_state.pkp.include_subdomains);
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after
8178 8178
8179 EXPECT_FALSE(r->is_pending()); 8179 EXPECT_FALSE(r->is_pending());
8180 EXPECT_EQ(1, d->response_started_count()); 8180 EXPECT_EQ(1, d->response_started_count());
8181 EXPECT_FALSE(d->received_data_before_response()); 8181 EXPECT_FALSE(d->received_data_before_response());
8182 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); 8182 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size));
8183 } 8183 }
8184 } 8184 }
8185 #endif // !defined(DISABLE_FTP_SUPPORT) 8185 #endif // !defined(DISABLE_FTP_SUPPORT)
8186 8186
8187 } // namespace net 8187 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_http_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698