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

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

Issue 1084533002: Rename NetLogLogger and CapturingNetLog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename NetLogLogger and CapturingNetLog(removed compiler error for chromeOS) Created 5 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 | « net/udp/udp_socket_unittest.cc ('k') | net/websockets/websocket_basic_stream_test.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 (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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "net/disk_cache/disk_cache.h" 51 #include "net/disk_cache/disk_cache.h"
52 #include "net/dns/mock_host_resolver.h" 52 #include "net/dns/mock_host_resolver.h"
53 #include "net/ftp/ftp_network_layer.h" 53 #include "net/ftp/ftp_network_layer.h"
54 #include "net/http/http_byte_range.h" 54 #include "net/http/http_byte_range.h"
55 #include "net/http/http_cache.h" 55 #include "net/http/http_cache.h"
56 #include "net/http/http_network_layer.h" 56 #include "net/http/http_network_layer.h"
57 #include "net/http/http_network_session.h" 57 #include "net/http/http_network_session.h"
58 #include "net/http/http_request_headers.h" 58 #include "net/http/http_request_headers.h"
59 #include "net/http/http_response_headers.h" 59 #include "net/http/http_response_headers.h"
60 #include "net/http/http_util.h" 60 #include "net/http/http_util.h"
61 #include "net/log/capturing_net_log.h"
62 #include "net/log/net_log.h" 61 #include "net/log/net_log.h"
63 #include "net/log/net_log_unittest.h" 62 #include "net/log/net_log_unittest.h"
63 #include "net/log/test_net_log.h"
64 #include "net/proxy/proxy_service.h" 64 #include "net/proxy/proxy_service.h"
65 #include "net/socket/ssl_client_socket.h" 65 #include "net/socket/ssl_client_socket.h"
66 #include "net/ssl/ssl_cipher_suite_names.h" 66 #include "net/ssl/ssl_cipher_suite_names.h"
67 #include "net/ssl/ssl_connection_status_flags.h" 67 #include "net/ssl/ssl_connection_status_flags.h"
68 #include "net/test/cert_test_util.h" 68 #include "net/test/cert_test_util.h"
69 #include "net/test/spawned_test_server/spawned_test_server.h" 69 #include "net/test/spawned_test_server/spawned_test_server.h"
70 #include "net/url_request/data_protocol_handler.h" 70 #include "net/url_request/data_protocol_handler.h"
71 #include "net/url_request/static_http_user_agent_settings.h" 71 #include "net/url_request/static_http_user_agent_settings.h"
72 #include "net/url_request/url_request.h" 72 #include "net/url_request/url_request.h"
73 #include "net/url_request/url_request_http_job.h" 73 #include "net/url_request/url_request_http_job.h"
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 644
645 // Adds the TestJobInterceptor to the default context. 645 // Adds the TestJobInterceptor to the default context.
646 TestJobInterceptor* AddTestInterceptor() { 646 TestJobInterceptor* AddTestInterceptor() {
647 TestJobInterceptor* protocol_handler_ = new TestJobInterceptor(); 647 TestJobInterceptor* protocol_handler_ = new TestJobInterceptor();
648 job_factory_impl_->SetProtocolHandler("http", NULL); 648 job_factory_impl_->SetProtocolHandler("http", NULL);
649 job_factory_impl_->SetProtocolHandler("http", protocol_handler_); 649 job_factory_impl_->SetProtocolHandler("http", protocol_handler_);
650 return protocol_handler_; 650 return protocol_handler_;
651 } 651 }
652 652
653 protected: 653 protected:
654 CapturingNetLog net_log_; 654 TestNetLog net_log_;
655 TestNetworkDelegate default_network_delegate_; // Must outlive URLRequest. 655 TestNetworkDelegate default_network_delegate_; // Must outlive URLRequest.
656 URLRequestJobFactoryImpl* job_factory_impl_; 656 URLRequestJobFactoryImpl* job_factory_impl_;
657 scoped_ptr<URLRequestJobFactory> job_factory_; 657 scoped_ptr<URLRequestJobFactory> job_factory_;
658 TestURLRequestContext default_context_; 658 TestURLRequestContext default_context_;
659 }; 659 };
660 660
661 TEST_F(URLRequestTest, AboutBlankTest) { 661 TEST_F(URLRequestTest, AboutBlankTest) {
662 TestDelegate d; 662 TestDelegate d;
663 { 663 {
664 scoped_ptr<URLRequest> r(default_context_.CreateRequest( 664 scoped_ptr<URLRequest> r(default_context_.CreateRequest(
(...skipping 3487 matching lines...) Expand 10 before | Expand all | Expand 10 after
4152 expected_second_load_state, 4152 expected_second_load_state,
4153 expected_third_load_state, 4153 expected_third_load_state,
4154 callback); 4154 callback);
4155 logger->Start(); 4155 logger->Start();
4156 } 4156 }
4157 4157
4158 // Checks that the log entries, starting with log_position, contain the 4158 // Checks that the log entries, starting with log_position, contain the
4159 // DELEGATE_INFO NetLog events that an AsyncDelegateLogger should have 4159 // DELEGATE_INFO NetLog events that an AsyncDelegateLogger should have
4160 // recorded. Returns the index of entry after the expected number of 4160 // recorded. Returns the index of entry after the expected number of
4161 // events this logged, or entries.size() if there aren't enough entries. 4161 // events this logged, or entries.size() if there aren't enough entries.
4162 static size_t CheckDelegateInfo( 4162 static size_t CheckDelegateInfo(const TestNetLog::CapturedEntryList& entries,
4163 const CapturingNetLog::CapturedEntryList& entries, size_t log_position) { 4163 size_t log_position) {
4164 // There should be 4 DELEGATE_INFO events: Two begins and two ends. 4164 // There should be 4 DELEGATE_INFO events: Two begins and two ends.
4165 if (log_position + 3 >= entries.size()) { 4165 if (log_position + 3 >= entries.size()) {
4166 ADD_FAILURE() << "Not enough log entries"; 4166 ADD_FAILURE() << "Not enough log entries";
4167 return entries.size(); 4167 return entries.size();
4168 } 4168 }
4169 std::string delegate_info; 4169 std::string delegate_info;
4170 EXPECT_EQ(NetLog::TYPE_DELEGATE_INFO, entries[log_position].type); 4170 EXPECT_EQ(NetLog::TYPE_DELEGATE_INFO, entries[log_position].type);
4171 EXPECT_EQ(NetLog::PHASE_BEGIN, entries[log_position].phase); 4171 EXPECT_EQ(NetLog::PHASE_BEGIN, entries[log_position].phase);
4172 EXPECT_TRUE(entries[log_position].GetStringValue("delegate_info", 4172 EXPECT_TRUE(entries[log_position].GetStringValue("delegate_info",
4173 &delegate_info)); 4173 &delegate_info));
(...skipping 13 matching lines...) Expand all
4187 ++log_position; 4187 ++log_position;
4188 EXPECT_EQ(NetLog::TYPE_DELEGATE_INFO, entries[log_position].type); 4188 EXPECT_EQ(NetLog::TYPE_DELEGATE_INFO, entries[log_position].type);
4189 EXPECT_EQ(NetLog::PHASE_END, entries[log_position].phase); 4189 EXPECT_EQ(NetLog::PHASE_END, entries[log_position].phase);
4190 4190
4191 return log_position + 1; 4191 return log_position + 1;
4192 } 4192 }
4193 4193
4194 // Find delegate request begin and end messages for OnBeforeNetworkStart. 4194 // Find delegate request begin and end messages for OnBeforeNetworkStart.
4195 // Returns the position of the end message. 4195 // Returns the position of the end message.
4196 static size_t ExpectBeforeNetworkEvents( 4196 static size_t ExpectBeforeNetworkEvents(
4197 const CapturingNetLog::CapturedEntryList& entries, 4197 const TestNetLog::CapturedEntryList& entries,
4198 size_t log_position) { 4198 size_t log_position) {
4199 log_position = 4199 log_position =
4200 ExpectLogContainsSomewhereAfter(entries, 4200 ExpectLogContainsSomewhereAfter(entries,
4201 log_position, 4201 log_position,
4202 NetLog::TYPE_URL_REQUEST_DELEGATE, 4202 NetLog::TYPE_URL_REQUEST_DELEGATE,
4203 NetLog::PHASE_BEGIN); 4203 NetLog::PHASE_BEGIN);
4204 EXPECT_EQ(NetLog::TYPE_URL_REQUEST_DELEGATE, 4204 EXPECT_EQ(NetLog::TYPE_URL_REQUEST_DELEGATE,
4205 entries[log_position + 1].type); 4205 entries[log_position + 1].type);
4206 EXPECT_EQ(NetLog::PHASE_END, entries[log_position + 1].phase); 4206 EXPECT_EQ(NetLog::PHASE_END, entries[log_position + 1].phase);
4207 return log_position + 1; 4207 return log_position + 1;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
4454 LOAD_STATE_WAITING_FOR_DELEGATE, 4454 LOAD_STATE_WAITING_FOR_DELEGATE,
4455 LOAD_STATE_IDLE, 4455 LOAD_STATE_IDLE,
4456 base::Bind(&URLRequest::Start, base::Unretained(r.get()))); 4456 base::Bind(&URLRequest::Start, base::Unretained(r.get())));
4457 4457
4458 base::RunLoop().Run(); 4458 base::RunLoop().Run();
4459 4459
4460 EXPECT_EQ(200, r->GetResponseCode()); 4460 EXPECT_EQ(200, r->GetResponseCode());
4461 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 4461 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
4462 } 4462 }
4463 4463
4464 CapturingNetLog::CapturedEntryList entries; 4464 TestNetLog::CapturedEntryList entries;
4465 net_log_.GetEntries(&entries); 4465 net_log_.GetEntries(&entries);
4466 size_t log_position = ExpectLogContainsSomewhereAfter( 4466 size_t log_position = ExpectLogContainsSomewhereAfter(
4467 entries, 4467 entries,
4468 0, 4468 0,
4469 NetLog::TYPE_DELEGATE_INFO, 4469 NetLog::TYPE_DELEGATE_INFO,
4470 NetLog::PHASE_BEGIN); 4470 NetLog::PHASE_BEGIN);
4471 4471
4472 log_position = AsyncDelegateLogger::CheckDelegateInfo(entries, log_position); 4472 log_position = AsyncDelegateLogger::CheckDelegateInfo(entries, log_position);
4473 4473
4474 // Nothing else should add any delegate info to the request. 4474 // Nothing else should add any delegate info to the request.
(...skipping 24 matching lines...) Expand all
4499 base::RunLoop().Run(); 4499 base::RunLoop().Run();
4500 4500
4501 EXPECT_EQ(200, r->GetResponseCode()); 4501 EXPECT_EQ(200, r->GetResponseCode());
4502 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 4502 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
4503 EXPECT_EQ(1, network_delegate.created_requests()); 4503 EXPECT_EQ(1, network_delegate.created_requests());
4504 EXPECT_EQ(0, network_delegate.destroyed_requests()); 4504 EXPECT_EQ(0, network_delegate.destroyed_requests());
4505 } 4505 }
4506 EXPECT_EQ(1, network_delegate.destroyed_requests()); 4506 EXPECT_EQ(1, network_delegate.destroyed_requests());
4507 4507
4508 size_t log_position = 0; 4508 size_t log_position = 0;
4509 CapturingNetLog::CapturedEntryList entries; 4509 TestNetLog::CapturedEntryList entries;
4510 net_log_.GetEntries(&entries); 4510 net_log_.GetEntries(&entries);
4511 for (size_t i = 0; i < 3; ++i) { 4511 for (size_t i = 0; i < 3; ++i) {
4512 log_position = ExpectLogContainsSomewhereAfter( 4512 log_position = ExpectLogContainsSomewhereAfter(
4513 entries, 4513 entries,
4514 log_position + 1, 4514 log_position + 1,
4515 NetLog::TYPE_URL_REQUEST_DELEGATE, 4515 NetLog::TYPE_URL_REQUEST_DELEGATE,
4516 NetLog::PHASE_BEGIN); 4516 NetLog::PHASE_BEGIN);
4517 4517
4518 log_position = AsyncDelegateLogger::CheckDelegateInfo(entries, 4518 log_position = AsyncDelegateLogger::CheckDelegateInfo(entries,
4519 log_position + 1); 4519 log_position + 1);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
4556 base::RunLoop().Run(); 4556 base::RunLoop().Run();
4557 4557
4558 EXPECT_EQ(200, r->GetResponseCode()); 4558 EXPECT_EQ(200, r->GetResponseCode());
4559 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 4559 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
4560 EXPECT_EQ(2, network_delegate.created_requests()); 4560 EXPECT_EQ(2, network_delegate.created_requests());
4561 EXPECT_EQ(0, network_delegate.destroyed_requests()); 4561 EXPECT_EQ(0, network_delegate.destroyed_requests());
4562 } 4562 }
4563 EXPECT_EQ(1, network_delegate.destroyed_requests()); 4563 EXPECT_EQ(1, network_delegate.destroyed_requests());
4564 4564
4565 size_t log_position = 0; 4565 size_t log_position = 0;
4566 CapturingNetLog::CapturedEntryList entries; 4566 TestNetLog::CapturedEntryList entries;
4567 net_log_.GetEntries(&entries); 4567 net_log_.GetEntries(&entries);
4568 // The NetworkDelegate logged information in OnBeforeURLRequest, 4568 // The NetworkDelegate logged information in OnBeforeURLRequest,
4569 // OnBeforeSendHeaders, and OnHeadersReceived. 4569 // OnBeforeSendHeaders, and OnHeadersReceived.
4570 for (size_t i = 0; i < 3; ++i) { 4570 for (size_t i = 0; i < 3; ++i) {
4571 log_position = ExpectLogContainsSomewhereAfter( 4571 log_position = ExpectLogContainsSomewhereAfter(
4572 entries, 4572 entries,
4573 log_position + 1, 4573 log_position + 1,
4574 NetLog::TYPE_URL_REQUEST_DELEGATE, 4574 NetLog::TYPE_URL_REQUEST_DELEGATE,
4575 NetLog::PHASE_BEGIN); 4575 NetLog::PHASE_BEGIN);
4576 4576
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
4638 base::RunLoop().Run(); 4638 base::RunLoop().Run();
4639 4639
4640 EXPECT_EQ(200, r->GetResponseCode()); 4640 EXPECT_EQ(200, r->GetResponseCode());
4641 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 4641 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
4642 EXPECT_EQ(1, network_delegate.created_requests()); 4642 EXPECT_EQ(1, network_delegate.created_requests());
4643 EXPECT_EQ(0, network_delegate.destroyed_requests()); 4643 EXPECT_EQ(0, network_delegate.destroyed_requests());
4644 } 4644 }
4645 EXPECT_EQ(1, network_delegate.destroyed_requests()); 4645 EXPECT_EQ(1, network_delegate.destroyed_requests());
4646 4646
4647 size_t log_position = 0; 4647 size_t log_position = 0;
4648 CapturingNetLog::CapturedEntryList entries; 4648 TestNetLog::CapturedEntryList entries;
4649 net_log_.GetEntries(&entries); 4649 net_log_.GetEntries(&entries);
4650 // The NetworkDelegate should have logged information in OnBeforeURLRequest, 4650 // The NetworkDelegate should have logged information in OnBeforeURLRequest,
4651 // OnBeforeSendHeaders, OnHeadersReceived, OnAuthRequired, and then again in 4651 // OnBeforeSendHeaders, OnHeadersReceived, OnAuthRequired, and then again in
4652 // OnBeforeURLRequest and OnBeforeSendHeaders. 4652 // OnBeforeURLRequest and OnBeforeSendHeaders.
4653 for (size_t i = 0; i < 6; ++i) { 4653 for (size_t i = 0; i < 6; ++i) {
4654 log_position = ExpectLogContainsSomewhereAfter( 4654 log_position = ExpectLogContainsSomewhereAfter(
4655 entries, 4655 entries,
4656 log_position + 1, 4656 log_position + 1,
4657 NetLog::TYPE_URL_REQUEST_DELEGATE, 4657 NetLog::TYPE_URL_REQUEST_DELEGATE,
4658 NetLog::PHASE_BEGIN); 4658 NetLog::PHASE_BEGIN);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
4695 test_server_.GetURL("chunked?waitBetweenChunks=20"), DEFAULT_PRIORITY, 4695 test_server_.GetURL("chunked?waitBetweenChunks=20"), DEFAULT_PRIORITY,
4696 &request_delegate)); 4696 &request_delegate));
4697 LoadStateWithParam load_state = r->GetLoadState(); 4697 LoadStateWithParam load_state = r->GetLoadState();
4698 r->Start(); 4698 r->Start();
4699 base::RunLoop().Run(); 4699 base::RunLoop().Run();
4700 4700
4701 EXPECT_EQ(200, r->GetResponseCode()); 4701 EXPECT_EQ(200, r->GetResponseCode());
4702 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 4702 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
4703 } 4703 }
4704 4704
4705 CapturingNetLog::CapturedEntryList entries; 4705 TestNetLog::CapturedEntryList entries;
4706 net_log_.GetEntries(&entries); 4706 net_log_.GetEntries(&entries);
4707 4707
4708 size_t log_position = 0; 4708 size_t log_position = 0;
4709 4709
4710 log_position = AsyncDelegateLogger::ExpectBeforeNetworkEvents( 4710 log_position = AsyncDelegateLogger::ExpectBeforeNetworkEvents(
4711 entries, log_position); 4711 entries, log_position);
4712 4712
4713 // The delegate info should only have been logged on header complete. Other 4713 // The delegate info should only have been logged on header complete. Other
4714 // times it should silently be ignored. 4714 // times it should silently be ignored.
4715 log_position = 4715 log_position =
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
4748 test_server_.GetURL("server-redirect?simple.html"), DEFAULT_PRIORITY, 4748 test_server_.GetURL("server-redirect?simple.html"), DEFAULT_PRIORITY,
4749 &request_delegate)); 4749 &request_delegate));
4750 LoadStateWithParam load_state = r->GetLoadState(); 4750 LoadStateWithParam load_state = r->GetLoadState();
4751 r->Start(); 4751 r->Start();
4752 base::RunLoop().Run(); 4752 base::RunLoop().Run();
4753 4753
4754 EXPECT_EQ(200, r->GetResponseCode()); 4754 EXPECT_EQ(200, r->GetResponseCode());
4755 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 4755 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
4756 } 4756 }
4757 4757
4758 CapturingNetLog::CapturedEntryList entries; 4758 TestNetLog::CapturedEntryList entries;
4759 net_log_.GetEntries(&entries); 4759 net_log_.GetEntries(&entries);
4760 4760
4761 // Delegate info should only have been logged in OnReceivedRedirect and 4761 // Delegate info should only have been logged in OnReceivedRedirect and
4762 // OnResponseStarted. 4762 // OnResponseStarted.
4763 size_t log_position = 0; 4763 size_t log_position = 0;
4764 for (int i = 0; i < 2; ++i) { 4764 for (int i = 0; i < 2; ++i) {
4765 if (i == 0) { 4765 if (i == 0) {
4766 log_position = AsyncDelegateLogger::ExpectBeforeNetworkEvents( 4766 log_position = AsyncDelegateLogger::ExpectBeforeNetworkEvents(
4767 entries, log_position) + 1; 4767 entries, log_position) + 1;
4768 } 4768 }
(...skipping 26 matching lines...) Expand all
4795 const AsyncLoggingUrlRequestDelegate::CancelStage kCancelStages[] = { 4795 const AsyncLoggingUrlRequestDelegate::CancelStage kCancelStages[] = {
4796 AsyncLoggingUrlRequestDelegate::CANCEL_ON_RECEIVED_REDIRECT, 4796 AsyncLoggingUrlRequestDelegate::CANCEL_ON_RECEIVED_REDIRECT,
4797 AsyncLoggingUrlRequestDelegate::CANCEL_ON_RESPONSE_STARTED, 4797 AsyncLoggingUrlRequestDelegate::CANCEL_ON_RESPONSE_STARTED,
4798 AsyncLoggingUrlRequestDelegate::CANCEL_ON_READ_COMPLETED, 4798 AsyncLoggingUrlRequestDelegate::CANCEL_ON_READ_COMPLETED,
4799 }; 4799 };
4800 4800
4801 for (size_t test_case = 0; test_case < arraysize(kCancelStages); 4801 for (size_t test_case = 0; test_case < arraysize(kCancelStages);
4802 ++test_case) { 4802 ++test_case) {
4803 AsyncLoggingUrlRequestDelegate request_delegate(kCancelStages[test_case]); 4803 AsyncLoggingUrlRequestDelegate request_delegate(kCancelStages[test_case]);
4804 TestURLRequestContext context(true); 4804 TestURLRequestContext context(true);
4805 CapturingNetLog net_log; 4805 TestNetLog net_log;
4806 context.set_network_delegate(NULL); 4806 context.set_network_delegate(NULL);
4807 context.set_net_log(&net_log); 4807 context.set_net_log(&net_log);
4808 context.Init(); 4808 context.Init();
4809 4809
4810 { 4810 {
4811 scoped_ptr<URLRequest> r(context.CreateRequest( 4811 scoped_ptr<URLRequest> r(context.CreateRequest(
4812 test_server_.GetURL("server-redirect?simple.html"), DEFAULT_PRIORITY, 4812 test_server_.GetURL("server-redirect?simple.html"), DEFAULT_PRIORITY,
4813 &request_delegate)); 4813 &request_delegate));
4814 LoadStateWithParam load_state = r->GetLoadState(); 4814 LoadStateWithParam load_state = r->GetLoadState();
4815 r->Start(); 4815 r->Start();
4816 base::RunLoop().Run(); 4816 base::RunLoop().Run();
4817 EXPECT_EQ(URLRequestStatus::CANCELED, r->status().status()); 4817 EXPECT_EQ(URLRequestStatus::CANCELED, r->status().status());
4818 } 4818 }
4819 4819
4820 CapturingNetLog::CapturedEntryList entries; 4820 TestNetLog::CapturedEntryList entries;
4821 net_log.GetEntries(&entries); 4821 net_log.GetEntries(&entries);
4822 4822
4823 // Delegate info is always logged in both OnReceivedRedirect and 4823 // Delegate info is always logged in both OnReceivedRedirect and
4824 // OnResponseStarted. In the CANCEL_ON_RECEIVED_REDIRECT, the 4824 // OnResponseStarted. In the CANCEL_ON_RECEIVED_REDIRECT, the
4825 // OnResponseStarted delegate call is after cancellation, but logging is 4825 // OnResponseStarted delegate call is after cancellation, but logging is
4826 // still currently supported in that call. 4826 // still currently supported in that call.
4827 size_t log_position = 0; 4827 size_t log_position = 0;
4828 for (int i = 0; i < 2; ++i) { 4828 for (int i = 0; i < 2; ++i) {
4829 if (i == 0) { 4829 if (i == 0) {
4830 log_position = AsyncDelegateLogger::ExpectBeforeNetworkEvents( 4830 log_position = AsyncDelegateLogger::ExpectBeforeNetworkEvents(
(...skipping 2423 matching lines...) Expand 10 before | Expand all | Expand 10 after
7254 CheckSSLInfo(r->ssl_info()); 7254 CheckSSLInfo(r->ssl_info());
7255 } else { 7255 } else {
7256 EXPECT_EQ(0, d.bytes_received()); 7256 EXPECT_EQ(0, d.bytes_received());
7257 } 7257 }
7258 } 7258 }
7259 } 7259 }
7260 } 7260 }
7261 7261
7262 // Tests that servers which require a deprecated cipher suite still work. 7262 // Tests that servers which require a deprecated cipher suite still work.
7263 TEST_F(HTTPSRequestTest, CipherFallbackTest) { 7263 TEST_F(HTTPSRequestTest, CipherFallbackTest) {
7264 CapturingNetLog net_log; 7264 TestNetLog net_log;
7265 default_context_.set_net_log(&net_log); 7265 default_context_.set_net_log(&net_log);
7266 7266
7267 SpawnedTestServer::SSLOptions ssl_options; 7267 SpawnedTestServer::SSLOptions ssl_options;
7268 ssl_options.bulk_ciphers = SpawnedTestServer::SSLOptions::BULK_CIPHER_RC4; 7268 ssl_options.bulk_ciphers = SpawnedTestServer::SSLOptions::BULK_CIPHER_RC4;
7269 SpawnedTestServer test_server( 7269 SpawnedTestServer test_server(
7270 SpawnedTestServer::TYPE_HTTPS, ssl_options, 7270 SpawnedTestServer::TYPE_HTTPS, ssl_options,
7271 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); 7271 base::FilePath(FILE_PATH_LITERAL("net/data/ssl")));
7272 ASSERT_TRUE(test_server.Start()); 7272 ASSERT_TRUE(test_server.Start());
7273 7273
7274 TestDelegate d; 7274 TestDelegate d;
(...skipping 15 matching lines...) Expand all
7290 EXPECT_FALSE(r->ssl_info().connection_status & 7290 EXPECT_FALSE(r->ssl_info().connection_status &
7291 SSL_CONNECTION_VERSION_FALLBACK); 7291 SSL_CONNECTION_VERSION_FALLBACK);
7292 int expected_version = SSL_CONNECTION_VERSION_TLS1_2; 7292 int expected_version = SSL_CONNECTION_VERSION_TLS1_2;
7293 if (SSLClientSocket::GetMaxSupportedSSLVersion() < 7293 if (SSLClientSocket::GetMaxSupportedSSLVersion() <
7294 SSL_PROTOCOL_VERSION_TLS1_2) { 7294 SSL_PROTOCOL_VERSION_TLS1_2) {
7295 expected_version = SSL_CONNECTION_VERSION_TLS1_1; 7295 expected_version = SSL_CONNECTION_VERSION_TLS1_1;
7296 } 7296 }
7297 EXPECT_EQ(expected_version, 7297 EXPECT_EQ(expected_version,
7298 SSLConnectionStatusToVersion(r->ssl_info().connection_status)); 7298 SSLConnectionStatusToVersion(r->ssl_info().connection_status));
7299 7299
7300 CapturingNetLog::CapturedEntryList entries; 7300 TestNetLog::CapturedEntryList entries;
7301 net_log.GetEntries(&entries); 7301 net_log.GetEntries(&entries);
7302 ExpectLogContainsSomewhere(entries, 0, NetLog::TYPE_SSL_CIPHER_FALLBACK, 7302 ExpectLogContainsSomewhere(entries, 0, NetLog::TYPE_SSL_CIPHER_FALLBACK,
7303 NetLog::PHASE_NONE); 7303 NetLog::PHASE_NONE);
7304 } 7304 }
7305 7305
7306 // This tests that a load of www.google.com with a certificate error sets 7306 // This tests that a load of www.google.com with a certificate error sets
7307 // the |certificate_errors_are_fatal| flag correctly. This flag will cause 7307 // the |certificate_errors_are_fatal| flag correctly. This flag will cause
7308 // the interstitial to be fatal. 7308 // the interstitial to be fatal.
7309 TEST_F(HTTPSRequestTest, HTTPSPreloadedHSTSTest) { 7309 TEST_F(HTTPSRequestTest, HTTPSPreloadedHSTSTest) {
7310 SpawnedTestServer::SSLOptions ssl_options( 7310 SpawnedTestServer::SSLOptions ssl_options(
(...skipping 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after
9109 9109
9110 EXPECT_FALSE(r->is_pending()); 9110 EXPECT_FALSE(r->is_pending());
9111 EXPECT_EQ(1, d->response_started_count()); 9111 EXPECT_EQ(1, d->response_started_count());
9112 EXPECT_FALSE(d->received_data_before_response()); 9112 EXPECT_FALSE(d->received_data_before_response());
9113 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); 9113 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size));
9114 } 9114 }
9115 } 9115 }
9116 #endif // !defined(DISABLE_FTP_SUPPORT) 9116 #endif // !defined(DISABLE_FTP_SUPPORT)
9117 9117
9118 } // namespace net 9118 } // namespace net
OLDNEW
« no previous file with comments | « net/udp/udp_socket_unittest.cc ('k') | net/websockets/websocket_basic_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698