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

Side by Side Diff: content/browser/cache_storage/cache_storage_cache_unittest.cc

Issue 1750333002: Reland of Pipe response_time from FetchManager to CacheStorage and ServiceWorkerURLRequestJob. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/cache_storage/cache_storage_cache.h" 5 #include "content/browser/cache_storage/cache_storage_cache.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 new storage::BlobDataBuilder("blob-id:myblob")); 321 new storage::BlobDataBuilder("blob-id:myblob"));
322 blob_data->AppendData(expected_blob_data_); 322 blob_data->AppendData(expected_blob_data_);
323 323
324 blob_handle_ = 324 blob_handle_ =
325 blob_storage_context->context()->AddFinishedBlob(blob_data.get()); 325 blob_storage_context->context()->AddFinishedBlob(blob_data.get());
326 326
327 body_response_ = ServiceWorkerResponse( 327 body_response_ = ServiceWorkerResponse(
328 GURL("http://example.com/body.html"), 200, "OK", 328 GURL("http://example.com/body.html"), 200, "OK",
329 blink::WebServiceWorkerResponseTypeDefault, headers, 329 blink::WebServiceWorkerResponseTypeDefault, headers,
330 blob_handle_->uuid(), expected_blob_data_.size(), GURL(), 330 blob_handle_->uuid(), expected_blob_data_.size(), GURL(),
331 blink::WebServiceWorkerResponseErrorUnknown); 331 blink::WebServiceWorkerResponseErrorUnknown, base::Time());
332 332
333 body_response_with_query_ = ServiceWorkerResponse( 333 body_response_with_query_ = ServiceWorkerResponse(
334 GURL("http://example.com/body.html?query=test"), 200, "OK", 334 GURL("http://example.com/body.html?query=test"), 200, "OK",
335 blink::WebServiceWorkerResponseTypeDefault, headers, 335 blink::WebServiceWorkerResponseTypeDefault, headers,
336 blob_handle_->uuid(), expected_blob_data_.size(), GURL(), 336 blob_handle_->uuid(), expected_blob_data_.size(), GURL(),
337 blink::WebServiceWorkerResponseErrorUnknown); 337 blink::WebServiceWorkerResponseErrorUnknown, base::Time());
338 338
339 no_body_response_ = ServiceWorkerResponse( 339 no_body_response_ = ServiceWorkerResponse(
340 GURL("http://example.com/no_body.html"), 200, "OK", 340 GURL("http://example.com/no_body.html"), 200, "OK",
341 blink::WebServiceWorkerResponseTypeDefault, headers, "", 0, GURL(), 341 blink::WebServiceWorkerResponseTypeDefault, headers, "", 0, GURL(),
342 blink::WebServiceWorkerResponseErrorUnknown); 342 blink::WebServiceWorkerResponseErrorUnknown, base::Time());
343 } 343 }
344 344
345 scoped_ptr<ServiceWorkerFetchRequest> CopyFetchRequest( 345 scoped_ptr<ServiceWorkerFetchRequest> CopyFetchRequest(
346 const ServiceWorkerFetchRequest& request) { 346 const ServiceWorkerFetchRequest& request) {
347 return make_scoped_ptr(new ServiceWorkerFetchRequest( 347 return make_scoped_ptr(new ServiceWorkerFetchRequest(
348 request.url, request.method, request.headers, request.referrer, 348 request.url, request.method, request.headers, request.referrer,
349 request.is_reload)); 349 request.is_reload));
350 } 350 }
351 351
352 CacheStorageError BatchOperation( 352 CacheStorageError BatchOperation(
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 EXPECT_TRUE(TestResponseType(blink::WebServiceWorkerResponseTypeBasic)); 1022 EXPECT_TRUE(TestResponseType(blink::WebServiceWorkerResponseTypeBasic));
1023 EXPECT_TRUE(TestResponseType(blink::WebServiceWorkerResponseTypeCORS)); 1023 EXPECT_TRUE(TestResponseType(blink::WebServiceWorkerResponseTypeCORS));
1024 EXPECT_TRUE(TestResponseType(blink::WebServiceWorkerResponseTypeDefault)); 1024 EXPECT_TRUE(TestResponseType(blink::WebServiceWorkerResponseTypeDefault));
1025 EXPECT_TRUE(TestResponseType(blink::WebServiceWorkerResponseTypeError)); 1025 EXPECT_TRUE(TestResponseType(blink::WebServiceWorkerResponseTypeError));
1026 EXPECT_TRUE(TestResponseType(blink::WebServiceWorkerResponseTypeOpaque)); 1026 EXPECT_TRUE(TestResponseType(blink::WebServiceWorkerResponseTypeOpaque));
1027 } 1027 }
1028 1028
1029 TEST_F(CacheStorageCacheTest, CaselessServiceWorkerResponseHeaders) { 1029 TEST_F(CacheStorageCacheTest, CaselessServiceWorkerResponseHeaders) {
1030 // CacheStorageCache depends on ServiceWorkerResponse having caseless 1030 // CacheStorageCache depends on ServiceWorkerResponse having caseless
1031 // headers so that it can quickly lookup vary headers. 1031 // headers so that it can quickly lookup vary headers.
1032 ServiceWorkerResponse response(GURL("http://www.example.com"), 200, "OK", 1032 ServiceWorkerResponse response(
1033 blink::WebServiceWorkerResponseTypeDefault, 1033 GURL("http://www.example.com"), 200, "OK",
1034 ServiceWorkerHeaderMap(), "", 0, GURL(), 1034 blink::WebServiceWorkerResponseTypeDefault, ServiceWorkerHeaderMap(), "",
1035 blink::WebServiceWorkerResponseErrorUnknown); 1035 0, GURL(), blink::WebServiceWorkerResponseErrorUnknown, base::Time());
1036 response.headers["content-type"] = "foo"; 1036 response.headers["content-type"] = "foo";
1037 response.headers["Content-Type"] = "bar"; 1037 response.headers["Content-Type"] = "bar";
1038 EXPECT_EQ("bar", response.headers["content-type"]); 1038 EXPECT_EQ("bar", response.headers["content-type"]);
1039 } 1039 }
1040 1040
1041 TEST_F(CacheStorageCacheTest, CaselessServiceWorkerFetchRequestHeaders) { 1041 TEST_F(CacheStorageCacheTest, CaselessServiceWorkerFetchRequestHeaders) {
1042 // CacheStorageCache depends on ServiceWorkerFetchRequest having caseless 1042 // CacheStorageCache depends on ServiceWorkerFetchRequest having caseless
1043 // headers so that it can quickly lookup vary headers. 1043 // headers so that it can quickly lookup vary headers.
1044 ServiceWorkerFetchRequest request(GURL("http://www.example.com"), "GET", 1044 ServiceWorkerFetchRequest request(GURL("http://www.example.com"), "GET",
1045 ServiceWorkerHeaderMap(), Referrer(), 1045 ServiceWorkerHeaderMap(), Referrer(),
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 EXPECT_EQ(1, sequence_out); 1167 EXPECT_EQ(1, sequence_out);
1168 close_loop2->Run(); 1168 close_loop2->Run();
1169 EXPECT_EQ(2, sequence_out); 1169 EXPECT_EQ(2, sequence_out);
1170 } 1170 }
1171 1171
1172 INSTANTIATE_TEST_CASE_P(CacheStorageCacheTest, 1172 INSTANTIATE_TEST_CASE_P(CacheStorageCacheTest,
1173 CacheStorageCacheTestP, 1173 CacheStorageCacheTestP,
1174 ::testing::Values(false, true)); 1174 ::testing::Values(false, true));
1175 1175
1176 } // namespace content 1176 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/cache_storage/cache_storage_cache.cc ('k') | content/browser/cache_storage/cache_storage_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698