OLD | NEW |
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/service_worker/service_worker_cache.h" | 5 #include "content/browser/service_worker/service_worker_cache.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 std::string expected_blob_data_; | 279 std::string expected_blob_data_; |
280 | 280 |
281 ServiceWorkerCache::ErrorType callback_error_; | 281 ServiceWorkerCache::ErrorType callback_error_; |
282 scoped_ptr<ServiceWorkerResponse> callback_response_; | 282 scoped_ptr<ServiceWorkerResponse> callback_response_; |
283 scoped_ptr<storage::BlobDataHandle> callback_response_data_; | 283 scoped_ptr<storage::BlobDataHandle> callback_response_data_; |
284 std::vector<std::string> callback_strings_; | 284 std::vector<std::string> callback_strings_; |
285 }; | 285 }; |
286 | 286 |
287 class ServiceWorkerCacheTestP : public ServiceWorkerCacheTest, | 287 class ServiceWorkerCacheTestP : public ServiceWorkerCacheTest, |
288 public testing::WithParamInterface<bool> { | 288 public testing::WithParamInterface<bool> { |
289 virtual bool MemoryOnly() override { return !GetParam(); } | 289 bool MemoryOnly() override { return !GetParam(); } |
290 }; | 290 }; |
291 | 291 |
292 TEST_P(ServiceWorkerCacheTestP, PutNoBody) { | 292 TEST_P(ServiceWorkerCacheTestP, PutNoBody) { |
293 EXPECT_TRUE(Put(no_body_request_, no_body_response_)); | 293 EXPECT_TRUE(Put(no_body_request_, no_body_response_)); |
294 EXPECT_TRUE(callback_response_); | 294 EXPECT_TRUE(callback_response_); |
295 EXPECT_STREQ(no_body_response_.url.spec().c_str(), | 295 EXPECT_STREQ(no_body_response_.url.spec().c_str(), |
296 callback_response_->url.spec().c_str()); | 296 callback_response_->url.spec().c_str()); |
297 EXPECT_FALSE(callback_response_data_); | 297 EXPECT_FALSE(callback_response_data_); |
298 EXPECT_STREQ("", callback_response_->blob_uuid.c_str()); | 298 EXPECT_STREQ("", callback_response_->blob_uuid.c_str()); |
299 EXPECT_EQ(0u, callback_response_->blob_size); | 299 EXPECT_EQ(0u, callback_response_->blob_size); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 request.headers["content-type"] = "foo"; | 528 request.headers["content-type"] = "foo"; |
529 request.headers["Content-Type"] = "bar"; | 529 request.headers["Content-Type"] = "bar"; |
530 EXPECT_EQ("bar", request.headers["content-type"]); | 530 EXPECT_EQ("bar", request.headers["content-type"]); |
531 } | 531 } |
532 | 532 |
533 INSTANTIATE_TEST_CASE_P(ServiceWorkerCacheTest, | 533 INSTANTIATE_TEST_CASE_P(ServiceWorkerCacheTest, |
534 ServiceWorkerCacheTestP, | 534 ServiceWorkerCacheTestP, |
535 ::testing::Values(false, true)); | 535 ::testing::Values(false, true)); |
536 | 536 |
537 } // namespace content | 537 } // namespace content |
OLD | NEW |