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

Side by Side Diff: net/http/http_cache_unittest.cc

Issue 2333923004: Extracting NetLog inner classes into their own classes. (Closed)
Patch Set: Some nit fixes and better, impl-agnostic naming of net_log_parameters_callback_typedef.h -> net/log… Created 4 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
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 "net/http/http_cache.h" 5 #include "net/http/http_cache.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 26 matching lines...) Expand all
37 #include "net/http/http_cache_transaction.h" 37 #include "net/http/http_cache_transaction.h"
38 #include "net/http/http_request_headers.h" 38 #include "net/http/http_request_headers.h"
39 #include "net/http/http_request_info.h" 39 #include "net/http/http_request_info.h"
40 #include "net/http/http_response_headers.h" 40 #include "net/http/http_response_headers.h"
41 #include "net/http/http_response_info.h" 41 #include "net/http/http_response_info.h"
42 #include "net/http/http_transaction.h" 42 #include "net/http/http_transaction.h"
43 #include "net/http/http_transaction_test_util.h" 43 #include "net/http/http_transaction_test_util.h"
44 #include "net/http/http_util.h" 44 #include "net/http/http_util.h"
45 #include "net/http/mock_http_cache.h" 45 #include "net/http/mock_http_cache.h"
46 #include "net/log/net_log_event_type.h" 46 #include "net/log/net_log_event_type.h"
47 #include "net/log/net_log_source.h"
48 #include "net/log/net_log_with_source.h"
47 #include "net/log/test_net_log.h" 49 #include "net/log/test_net_log.h"
48 #include "net/log/test_net_log_entry.h" 50 #include "net/log/test_net_log_entry.h"
49 #include "net/log/test_net_log_util.h" 51 #include "net/log/test_net_log_util.h"
50 #include "net/socket/client_socket_handle.h" 52 #include "net/socket/client_socket_handle.h"
51 #include "net/ssl/ssl_cert_request_info.h" 53 #include "net/ssl/ssl_cert_request_info.h"
52 #include "net/ssl/ssl_connection_status_flags.h" 54 #include "net/ssl/ssl_connection_status_flags.h"
53 #include "net/test/cert_test_util.h" 55 #include "net/test/cert_test_util.h"
54 #include "net/test/gtest_util.h" 56 #include "net/test/gtest_util.h"
55 #include "net/test/test_data_directory.h" 57 #include "net/test/test_data_directory.h"
56 #include "net/websockets/websocket_handshake_stream_base.h" 58 #include "net/websockets/websocket_handshake_stream_base.h"
57 #include "testing/gmock/include/gmock/gmock.h" 59 #include "testing/gmock/include/gmock/gmock.h"
58 #include "testing/gtest/include/gtest/gtest.h" 60 #include "testing/gtest/include/gtest/gtest.h"
59 61
60 using net::test::IsError; 62 using net::test::IsError;
61 using net::test::IsOk; 63 using net::test::IsOk;
62 64
63 using base::Time; 65 using base::Time;
64 66
65 namespace net { 67 namespace net {
66 68
67 using CacheEntryStatus = HttpResponseInfo::CacheEntryStatus; 69 using CacheEntryStatus = HttpResponseInfo::CacheEntryStatus;
68 70
69 namespace { 71 namespace {
70 72
71 // Tests the load timing values of a request that goes through a 73 // Tests the load timing values of a request that goes through a
72 // MockNetworkTransaction. 74 // MockNetworkTransaction.
73 void TestLoadTimingNetworkRequest(const LoadTimingInfo& load_timing_info) { 75 void TestLoadTimingNetworkRequest(const LoadTimingInfo& load_timing_info) {
74 EXPECT_FALSE(load_timing_info.socket_reused); 76 EXPECT_FALSE(load_timing_info.socket_reused);
75 EXPECT_NE(NetLog::Source::kInvalidId, load_timing_info.socket_log_id); 77 EXPECT_NE(NetLogSource::kInvalidId, load_timing_info.socket_log_id);
76 78
77 EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null()); 79 EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null());
78 EXPECT_TRUE(load_timing_info.proxy_resolve_end.is_null()); 80 EXPECT_TRUE(load_timing_info.proxy_resolve_end.is_null());
79 81
80 ExpectConnectTimingHasTimes(load_timing_info.connect_timing, 82 ExpectConnectTimingHasTimes(load_timing_info.connect_timing,
81 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); 83 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY);
82 EXPECT_LE(load_timing_info.connect_timing.connect_end, 84 EXPECT_LE(load_timing_info.connect_timing.connect_end,
83 load_timing_info.send_start); 85 load_timing_info.send_start);
84 86
85 EXPECT_LE(load_timing_info.send_start, load_timing_info.send_end); 87 EXPECT_LE(load_timing_info.send_start, load_timing_info.send_end);
86 88
87 // Set by URLRequest / URLRequestHttpJob, at a higher level. 89 // Set by URLRequest / URLRequestHttpJob, at a higher level.
88 EXPECT_TRUE(load_timing_info.request_start_time.is_null()); 90 EXPECT_TRUE(load_timing_info.request_start_time.is_null());
89 EXPECT_TRUE(load_timing_info.request_start.is_null()); 91 EXPECT_TRUE(load_timing_info.request_start.is_null());
90 EXPECT_TRUE(load_timing_info.receive_headers_end.is_null()); 92 EXPECT_TRUE(load_timing_info.receive_headers_end.is_null());
91 } 93 }
92 94
93 // Tests the load timing values of a request that receives a cached response. 95 // Tests the load timing values of a request that receives a cached response.
94 void TestLoadTimingCachedResponse(const LoadTimingInfo& load_timing_info) { 96 void TestLoadTimingCachedResponse(const LoadTimingInfo& load_timing_info) {
95 EXPECT_FALSE(load_timing_info.socket_reused); 97 EXPECT_FALSE(load_timing_info.socket_reused);
96 EXPECT_EQ(NetLog::Source::kInvalidId, load_timing_info.socket_log_id); 98 EXPECT_EQ(NetLogSource::kInvalidId, load_timing_info.socket_log_id);
97 99
98 EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null()); 100 EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null());
99 EXPECT_TRUE(load_timing_info.proxy_resolve_end.is_null()); 101 EXPECT_TRUE(load_timing_info.proxy_resolve_end.is_null());
100 102
101 ExpectConnectTimingHasNoTimes(load_timing_info.connect_timing); 103 ExpectConnectTimingHasNoTimes(load_timing_info.connect_timing);
102 104
103 // Only the send start / end times should be sent, and they should have the 105 // Only the send start / end times should be sent, and they should have the
104 // same value. 106 // same value.
105 EXPECT_FALSE(load_timing_info.send_start.is_null()); 107 EXPECT_FALSE(load_timing_info.send_start.is_null());
106 EXPECT_EQ(load_timing_info.send_start, load_timing_info.send_end); 108 EXPECT_EQ(load_timing_info.send_start, load_timing_info.send_end);
(...skipping 7993 matching lines...) Expand 10 before | Expand all | Expand 10 after
8100 RunTransactionTestWithResponseInfo(cache.http_cache(), 8102 RunTransactionTestWithResponseInfo(cache.http_cache(),
8101 kTypicalGET_Transaction, &response_info); 8103 kTypicalGET_Transaction, &response_info);
8102 8104
8103 EXPECT_FALSE(response_info.was_cached); 8105 EXPECT_FALSE(response_info.was_cached);
8104 EXPECT_TRUE(response_info.network_accessed); 8106 EXPECT_TRUE(response_info.network_accessed);
8105 EXPECT_EQ(CacheEntryStatus::ENTRY_CANT_CONDITIONALIZE, 8107 EXPECT_EQ(CacheEntryStatus::ENTRY_CANT_CONDITIONALIZE,
8106 response_info.cache_entry_status); 8108 response_info.cache_entry_status);
8107 } 8109 }
8108 8110
8109 } // namespace net 8111 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698