OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
11 #include "net/http/http_cache_lookup_manager.h" | 11 #include "net/http/http_cache_lookup_manager.h" |
12 #include "net/http/http_transaction_test_util.h" | 12 #include "net/http/http_transaction_test_util.h" |
13 #include "net/http/mock_http_cache.h" | 13 #include "net/http/mock_http_cache.h" |
14 #include "net/test/gtest_util.h" | 14 #include "net/test/gtest_util.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 using net::test::IsOk; | 18 using net::test::IsOk; |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 class MockServerPushHelper : public ServerPushDelegate::ServerPushHelper { | 24 class MockServerPushHelper : public ServerPushDelegate::ServerPushHelper { |
25 public: | 25 public: |
26 explicit MockServerPushHelper(const GURL& url) : request_url_(url) {} | 26 explicit MockServerPushHelper(const GURL& url) : request_url_(url) {} |
27 | 27 |
28 const GURL& GetURL() override { return request_url_; } | 28 const GURL& GetURL() const override { return request_url_; } |
29 | 29 |
30 MOCK_METHOD0(Cancel, void()); | 30 MOCK_METHOD0(Cancel, void()); |
31 | 31 |
32 private: | 32 private: |
33 const GURL request_url_; | 33 const GURL request_url_; |
34 }; | 34 }; |
35 | 35 |
36 std::unique_ptr<MockTransaction> CreateMockTransaction(const GURL& url) { | 36 std::unique_ptr<MockTransaction> CreateMockTransaction(const GURL& url) { |
37 MockTransaction mock_trans = { | 37 MockTransaction mock_trans = { |
38 url.spec().c_str(), "GET", base::Time(), "", LOAD_NORMAL, | 38 url.spec().c_str(), "GET", base::Time(), "", LOAD_NORMAL, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 EXPECT_THAT(rv, IsOk()); | 77 EXPECT_THAT(rv, IsOk()); |
78 std::string expected(mock_trans->data); | 78 std::string expected(mock_trans->data); |
79 EXPECT_EQ(expected, content); | 79 EXPECT_EQ(expected, content); |
80 RemoveMockTransaction(mock_trans.get()); | 80 RemoveMockTransaction(mock_trans.get()); |
81 } | 81 } |
82 | 82 |
83 } // namespace | 83 } // namespace |
84 | 84 |
85 TEST(HttpCacheLookupManagerTest, ServerPushMissCache) { | 85 TEST(HttpCacheLookupManagerTest, ServerPushMissCache) { |
86 MockHttpCache mock_cache; | 86 MockHttpCache mock_cache; |
87 HttpCacheLookupManager push_delegate(mock_cache.http_cache(), | 87 HttpCacheLookupManager push_delegate(mock_cache.http_cache()); |
88 NetLogWithSource()); | |
89 GURL request_url("http://www.example.com/pushed.jpg"); | 88 GURL request_url("http://www.example.com/pushed.jpg"); |
90 | 89 |
91 std::unique_ptr<MockServerPushHelper> push_helper = | 90 std::unique_ptr<MockServerPushHelper> push_helper = |
92 base::MakeUnique<MockServerPushHelper>(request_url); | 91 base::MakeUnique<MockServerPushHelper>(request_url); |
93 MockServerPushHelper* push_helper_ptr = push_helper.get(); | 92 MockServerPushHelper* push_helper_ptr = push_helper.get(); |
94 | 93 |
95 // Receive a server push and should not cancel the push. | 94 // Receive a server push and should not cancel the push. |
96 EXPECT_CALL(*push_helper_ptr, Cancel()).Times(0); | 95 EXPECT_CALL(*push_helper_ptr, Cancel()).Times(0); |
97 push_delegate.OnPush(std::move(push_helper)); | 96 push_delegate.OnPush(std::move(push_helper), NetLogWithSource()); |
98 base::RunLoop().RunUntilIdle(); | 97 base::RunLoop().RunUntilIdle(); |
99 | 98 |
100 // Make sure no network transaction is created. | 99 // Make sure no network transaction is created. |
101 EXPECT_EQ(0, mock_cache.network_layer()->transaction_count()); | 100 EXPECT_EQ(0, mock_cache.network_layer()->transaction_count()); |
102 EXPECT_EQ(0, mock_cache.disk_cache()->open_count()); | 101 EXPECT_EQ(0, mock_cache.disk_cache()->open_count()); |
103 EXPECT_EQ(0, mock_cache.disk_cache()->create_count()); | 102 EXPECT_EQ(0, mock_cache.disk_cache()->create_count()); |
104 } | 103 } |
105 | 104 |
106 TEST(HttpCacheLookupManagerTest, ServerPushDoNotCreateCacheEntry) { | 105 TEST(HttpCacheLookupManagerTest, ServerPushDoNotCreateCacheEntry) { |
107 MockHttpCache mock_cache; | 106 MockHttpCache mock_cache; |
108 HttpCacheLookupManager push_delegate(mock_cache.http_cache(), | 107 HttpCacheLookupManager push_delegate(mock_cache.http_cache()); |
109 NetLogWithSource()); | |
110 GURL request_url("http://www.example.com/pushed.jpg"); | 108 GURL request_url("http://www.example.com/pushed.jpg"); |
111 | 109 |
112 std::unique_ptr<MockServerPushHelper> push_helper = | 110 std::unique_ptr<MockServerPushHelper> push_helper = |
113 base::MakeUnique<MockServerPushHelper>(request_url); | 111 base::MakeUnique<MockServerPushHelper>(request_url); |
114 MockServerPushHelper* push_helper_ptr = push_helper.get(); | 112 MockServerPushHelper* push_helper_ptr = push_helper.get(); |
115 | 113 |
116 // Receive a server push and should not cancel the push. | 114 // Receive a server push and should not cancel the push. |
117 EXPECT_CALL(*push_helper_ptr, Cancel()).Times(0); | 115 EXPECT_CALL(*push_helper_ptr, Cancel()).Times(0); |
118 push_delegate.OnPush(std::move(push_helper)); | 116 push_delegate.OnPush(std::move(push_helper), NetLogWithSource()); |
119 base::RunLoop().RunUntilIdle(); | 117 base::RunLoop().RunUntilIdle(); |
120 | 118 |
121 // Receive another server push for the same url. | 119 // Receive another server push for the same url. |
122 std::unique_ptr<MockServerPushHelper> push_helper2 = | 120 std::unique_ptr<MockServerPushHelper> push_helper2 = |
123 base::MakeUnique<MockServerPushHelper>(request_url); | 121 base::MakeUnique<MockServerPushHelper>(request_url); |
124 MockServerPushHelper* push_helper_ptr2 = push_helper2.get(); | 122 MockServerPushHelper* push_helper_ptr2 = push_helper2.get(); |
125 EXPECT_CALL(*push_helper_ptr2, Cancel()).Times(0); | 123 EXPECT_CALL(*push_helper_ptr2, Cancel()).Times(0); |
126 push_delegate.OnPush(std::move(push_helper2)); | 124 push_delegate.OnPush(std::move(push_helper2), NetLogWithSource()); |
127 base::RunLoop().RunUntilIdle(); | 125 base::RunLoop().RunUntilIdle(); |
128 | 126 |
129 // Verify no network transaction is created. | 127 // Verify no network transaction is created. |
130 EXPECT_EQ(0, mock_cache.network_layer()->transaction_count()); | 128 EXPECT_EQ(0, mock_cache.network_layer()->transaction_count()); |
131 EXPECT_EQ(0, mock_cache.disk_cache()->open_count()); | 129 EXPECT_EQ(0, mock_cache.disk_cache()->open_count()); |
132 // Verify no cache entry is created for server push lookup. | 130 // Verify no cache entry is created for server push lookup. |
133 EXPECT_EQ(0, mock_cache.disk_cache()->create_count()); | 131 EXPECT_EQ(0, mock_cache.disk_cache()->create_count()); |
134 } | 132 } |
135 | 133 |
136 TEST(HttpCacheLookupManagerTest, ServerPushHitCache) { | 134 TEST(HttpCacheLookupManagerTest, ServerPushHitCache) { |
137 MockHttpCache mock_cache; | 135 MockHttpCache mock_cache; |
138 HttpCacheLookupManager push_delegate(mock_cache.http_cache(), | 136 HttpCacheLookupManager push_delegate(mock_cache.http_cache()); |
139 NetLogWithSource()); | |
140 GURL request_url("http://www.example.com/pushed.jpg"); | 137 GURL request_url("http://www.example.com/pushed.jpg"); |
141 | 138 |
142 // Populate the cache entry so that the cache lookup for server push hits. | 139 // Populate the cache entry so that the cache lookup for server push hits. |
143 PopulateCacheEntry(mock_cache.http_cache(), request_url); | 140 PopulateCacheEntry(mock_cache.http_cache(), request_url); |
144 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); | 141 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); |
145 EXPECT_EQ(0, mock_cache.disk_cache()->open_count()); | 142 EXPECT_EQ(0, mock_cache.disk_cache()->open_count()); |
146 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); | 143 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); |
147 | 144 |
148 // Add another mock transaction since the OnPush will create a new cache | 145 // Add another mock transaction since the OnPush will create a new cache |
149 // transaction. | 146 // transaction. |
150 std::unique_ptr<MockTransaction> mock_trans = | 147 std::unique_ptr<MockTransaction> mock_trans = |
151 CreateMockTransaction(request_url); | 148 CreateMockTransaction(request_url); |
152 AddMockTransaction(mock_trans.get()); | 149 AddMockTransaction(mock_trans.get()); |
153 | 150 |
154 std::unique_ptr<MockServerPushHelper> push_helper = | 151 std::unique_ptr<MockServerPushHelper> push_helper = |
155 base::MakeUnique<MockServerPushHelper>(request_url); | 152 base::MakeUnique<MockServerPushHelper>(request_url); |
156 MockServerPushHelper* push_helper_ptr = push_helper.get(); | 153 MockServerPushHelper* push_helper_ptr = push_helper.get(); |
157 | 154 |
158 // Receive a server push and should cancel the push. | 155 // Receive a server push and should cancel the push. |
159 EXPECT_CALL(*push_helper_ptr, Cancel()).Times(1); | 156 EXPECT_CALL(*push_helper_ptr, Cancel()).Times(1); |
160 push_delegate.OnPush(std::move(push_helper)); | 157 push_delegate.OnPush(std::move(push_helper), NetLogWithSource()); |
161 base::RunLoop().RunUntilIdle(); | 158 base::RunLoop().RunUntilIdle(); |
162 | 159 |
163 // Make sure no new net layer transaction is created. | 160 // Make sure no new net layer transaction is created. |
164 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); | 161 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); |
165 EXPECT_EQ(1, mock_cache.disk_cache()->open_count()); | 162 EXPECT_EQ(1, mock_cache.disk_cache()->open_count()); |
166 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); | 163 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); |
167 | 164 |
168 RemoveMockTransaction(mock_trans.get()); | 165 RemoveMockTransaction(mock_trans.get()); |
169 } | 166 } |
170 | 167 |
171 // Test when a server push is received while the HttpCacheLookupManager has a | 168 // Test when a server push is received while the HttpCacheLookupManager has a |
172 // pending lookup transaction for the same URL, the new server push will not | 169 // pending lookup transaction for the same URL, the new server push will not |
173 // send a new lookup transaction and should not be canceled. | 170 // send a new lookup transaction and should not be canceled. |
174 TEST(HttpCacheLookupManagerTest, ServerPushPendingLookup) { | 171 TEST(HttpCacheLookupManagerTest, ServerPushPendingLookup) { |
175 MockHttpCache mock_cache; | 172 MockHttpCache mock_cache; |
176 HttpCacheLookupManager push_delegate(mock_cache.http_cache(), | 173 HttpCacheLookupManager push_delegate(mock_cache.http_cache()); |
177 NetLogWithSource()); | |
178 GURL request_url("http://www.example.com/pushed.jpg"); | 174 GURL request_url("http://www.example.com/pushed.jpg"); |
179 | 175 |
180 // Populate the cache entry so that the cache lookup for server push hits. | 176 // Populate the cache entry so that the cache lookup for server push hits. |
181 PopulateCacheEntry(mock_cache.http_cache(), request_url); | 177 PopulateCacheEntry(mock_cache.http_cache(), request_url); |
182 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); | 178 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); |
183 EXPECT_EQ(0, mock_cache.disk_cache()->open_count()); | 179 EXPECT_EQ(0, mock_cache.disk_cache()->open_count()); |
184 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); | 180 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); |
185 | 181 |
186 // Add another mock transaction since the OnPush will create a new cache | 182 // Add another mock transaction since the OnPush will create a new cache |
187 // transaction. | 183 // transaction. |
188 std::unique_ptr<MockTransaction> mock_trans = | 184 std::unique_ptr<MockTransaction> mock_trans = |
189 CreateMockTransaction(request_url); | 185 CreateMockTransaction(request_url); |
190 AddMockTransaction(mock_trans.get()); | 186 AddMockTransaction(mock_trans.get()); |
191 | 187 |
192 std::unique_ptr<MockServerPushHelper> push_helper = | 188 std::unique_ptr<MockServerPushHelper> push_helper = |
193 base::MakeUnique<MockServerPushHelper>(request_url); | 189 base::MakeUnique<MockServerPushHelper>(request_url); |
194 MockServerPushHelper* push_helper_ptr = push_helper.get(); | 190 MockServerPushHelper* push_helper_ptr = push_helper.get(); |
195 | 191 |
196 // Receive a server push and should cancel the push eventually. | 192 // Receive a server push and should cancel the push eventually. |
197 EXPECT_CALL(*push_helper_ptr, Cancel()).Times(1); | 193 EXPECT_CALL(*push_helper_ptr, Cancel()).Times(1); |
198 push_delegate.OnPush(std::move(push_helper)); | 194 push_delegate.OnPush(std::move(push_helper), NetLogWithSource()); |
199 | 195 |
200 std::unique_ptr<MockServerPushHelper> push_helper2 = | 196 std::unique_ptr<MockServerPushHelper> push_helper2 = |
201 base::MakeUnique<MockServerPushHelper>(request_url); | 197 base::MakeUnique<MockServerPushHelper>(request_url); |
202 MockServerPushHelper* push_helper_ptr2 = push_helper2.get(); | 198 MockServerPushHelper* push_helper_ptr2 = push_helper2.get(); |
203 | 199 |
204 // Receive another server push and should not cancel the push. | 200 // Receive another server push and should not cancel the push. |
205 EXPECT_CALL(*push_helper_ptr2, Cancel()).Times(0); | 201 EXPECT_CALL(*push_helper_ptr2, Cancel()).Times(0); |
206 push_delegate.OnPush(std::move(push_helper2)); | 202 push_delegate.OnPush(std::move(push_helper2), NetLogWithSource()); |
207 | 203 |
208 base::RunLoop().RunUntilIdle(); | 204 base::RunLoop().RunUntilIdle(); |
209 | 205 |
210 // Make sure no new net layer transaction is created. | 206 // Make sure no new net layer transaction is created. |
211 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); | 207 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); |
212 EXPECT_EQ(1, mock_cache.disk_cache()->open_count()); | 208 EXPECT_EQ(1, mock_cache.disk_cache()->open_count()); |
213 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); | 209 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); |
214 | 210 |
215 RemoveMockTransaction(mock_trans.get()); | 211 RemoveMockTransaction(mock_trans.get()); |
216 } | 212 } |
217 | 213 |
218 // Test the server push lookup is based on the full url. | 214 // Test the server push lookup is based on the full url. |
219 TEST(HttpCacheLookupManagerTest, ServerPushLookupOnUrl) { | 215 TEST(HttpCacheLookupManagerTest, ServerPushLookupOnUrl) { |
220 MockHttpCache mock_cache; | 216 MockHttpCache mock_cache; |
221 HttpCacheLookupManager push_delegate(mock_cache.http_cache(), | 217 HttpCacheLookupManager push_delegate(mock_cache.http_cache()); |
222 NetLogWithSource()); | |
223 GURL request_url("http://www.example.com/pushed.jpg?u=0"); | 218 GURL request_url("http://www.example.com/pushed.jpg?u=0"); |
224 GURL request_url2("http://www.example.com/pushed.jpg?u=1"); | 219 GURL request_url2("http://www.example.com/pushed.jpg?u=1"); |
225 | 220 |
226 // Populate the cache entry so that the cache lookup for server push hits. | 221 // Populate the cache entry so that the cache lookup for server push hits. |
227 PopulateCacheEntry(mock_cache.http_cache(), request_url); | 222 PopulateCacheEntry(mock_cache.http_cache(), request_url); |
228 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); | 223 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); |
229 EXPECT_EQ(0, mock_cache.disk_cache()->open_count()); | 224 EXPECT_EQ(0, mock_cache.disk_cache()->open_count()); |
230 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); | 225 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); |
231 | 226 |
232 // Add another mock transaction since the OnPush will create a new cache | 227 // Add another mock transaction since the OnPush will create a new cache |
233 // transaction. | 228 // transaction. |
234 std::unique_ptr<MockTransaction> mock_trans = | 229 std::unique_ptr<MockTransaction> mock_trans = |
235 CreateMockTransaction(request_url); | 230 CreateMockTransaction(request_url); |
236 AddMockTransaction(mock_trans.get()); | 231 AddMockTransaction(mock_trans.get()); |
237 | 232 |
238 std::unique_ptr<MockServerPushHelper> push_helper = | 233 std::unique_ptr<MockServerPushHelper> push_helper = |
239 base::MakeUnique<MockServerPushHelper>(request_url); | 234 base::MakeUnique<MockServerPushHelper>(request_url); |
240 MockServerPushHelper* push_helper_ptr = push_helper.get(); | 235 MockServerPushHelper* push_helper_ptr = push_helper.get(); |
241 | 236 |
242 // Receive a server push and should cancel the push eventually. | 237 // Receive a server push and should cancel the push eventually. |
243 EXPECT_CALL(*push_helper_ptr, Cancel()).Times(1); | 238 EXPECT_CALL(*push_helper_ptr, Cancel()).Times(1); |
244 push_delegate.OnPush(std::move(push_helper)); | 239 push_delegate.OnPush(std::move(push_helper), NetLogWithSource()); |
245 // Run until the lookup transaction finishes for the first server push. | 240 // Run until the lookup transaction finishes for the first server push. |
246 base::RunLoop().RunUntilIdle(); | 241 base::RunLoop().RunUntilIdle(); |
247 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); | 242 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); |
248 EXPECT_EQ(1, mock_cache.disk_cache()->open_count()); | 243 EXPECT_EQ(1, mock_cache.disk_cache()->open_count()); |
249 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); | 244 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); |
250 RemoveMockTransaction(mock_trans.get()); | 245 RemoveMockTransaction(mock_trans.get()); |
251 | 246 |
252 AddMockTransaction(mock_trans.get()); | 247 AddMockTransaction(mock_trans.get()); |
253 // Receive the second server push with same url after the first lookup | 248 // Receive the second server push with same url after the first lookup |
254 // finishes, and should cancel the push. | 249 // finishes, and should cancel the push. |
255 std::unique_ptr<MockServerPushHelper> push_helper2 = | 250 std::unique_ptr<MockServerPushHelper> push_helper2 = |
256 base::MakeUnique<MockServerPushHelper>(request_url); | 251 base::MakeUnique<MockServerPushHelper>(request_url); |
257 MockServerPushHelper* push_helper_ptr2 = push_helper2.get(); | 252 MockServerPushHelper* push_helper_ptr2 = push_helper2.get(); |
258 | 253 |
259 EXPECT_CALL(*push_helper_ptr2, Cancel()).Times(1); | 254 EXPECT_CALL(*push_helper_ptr2, Cancel()).Times(1); |
260 push_delegate.OnPush(std::move(push_helper2)); | 255 push_delegate.OnPush(std::move(push_helper2), NetLogWithSource()); |
261 // Run until the lookup transaction finishes for the second server push. | 256 // Run until the lookup transaction finishes for the second server push. |
262 base::RunLoop().RunUntilIdle(); | 257 base::RunLoop().RunUntilIdle(); |
263 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); | 258 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); |
264 EXPECT_EQ(2, mock_cache.disk_cache()->open_count()); | 259 EXPECT_EQ(2, mock_cache.disk_cache()->open_count()); |
265 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); | 260 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); |
266 RemoveMockTransaction(mock_trans.get()); | 261 RemoveMockTransaction(mock_trans.get()); |
267 | 262 |
268 std::unique_ptr<MockTransaction> mock_trans3 = | 263 std::unique_ptr<MockTransaction> mock_trans3 = |
269 CreateMockTransaction(request_url2); | 264 CreateMockTransaction(request_url2); |
270 AddMockTransaction(mock_trans3.get()); | 265 AddMockTransaction(mock_trans3.get()); |
271 // Receive the third server push with a different url after lookup for a | 266 // Receive the third server push with a different url after lookup for a |
272 // similar server push has been completed, should not cancel the push. | 267 // similar server push has been completed, should not cancel the push. |
273 std::unique_ptr<MockServerPushHelper> push_helper3 = | 268 std::unique_ptr<MockServerPushHelper> push_helper3 = |
274 base::MakeUnique<MockServerPushHelper>(request_url2); | 269 base::MakeUnique<MockServerPushHelper>(request_url2); |
275 MockServerPushHelper* push_helper_ptr3 = push_helper3.get(); | 270 MockServerPushHelper* push_helper_ptr3 = push_helper3.get(); |
276 | 271 |
277 EXPECT_CALL(*push_helper_ptr3, Cancel()).Times(0); | 272 EXPECT_CALL(*push_helper_ptr3, Cancel()).Times(0); |
278 push_delegate.OnPush(std::move(push_helper3)); | 273 push_delegate.OnPush(std::move(push_helper3), NetLogWithSource()); |
279 | 274 |
280 base::RunLoop().RunUntilIdle(); | 275 base::RunLoop().RunUntilIdle(); |
281 // Make sure no new net layer transaction is created. | 276 // Make sure no new net layer transaction is created. |
282 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); | 277 EXPECT_EQ(1, mock_cache.network_layer()->transaction_count()); |
283 EXPECT_EQ(2, mock_cache.disk_cache()->open_count()); | 278 EXPECT_EQ(2, mock_cache.disk_cache()->open_count()); |
284 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); | 279 EXPECT_EQ(1, mock_cache.disk_cache()->create_count()); |
285 RemoveMockTransaction(mock_trans3.get()); | 280 RemoveMockTransaction(mock_trans3.get()); |
286 } | 281 } |
287 | 282 |
288 } // namespace net | 283 } // namespace net |
OLD | NEW |