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

Side by Side Diff: content/browser/service_worker/service_worker_cache_unittest.cc

Issue 637183002: Replace FINAL and OVERRIDE with their C++11 counterparts in content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased the patch Created 6 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 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 28 matching lines...) Expand all
39 } 39 }
40 40
41 } // namespace 41 } // namespace
42 42
43 class ServiceWorkerCacheTest : public testing::Test { 43 class ServiceWorkerCacheTest : public testing::Test {
44 public: 44 public:
45 ServiceWorkerCacheTest() 45 ServiceWorkerCacheTest()
46 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), 46 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP),
47 callback_error_(ServiceWorkerCache::ErrorTypeOK) {} 47 callback_error_(ServiceWorkerCache::ErrorTypeOK) {}
48 48
49 virtual void SetUp() OVERRIDE { 49 virtual void SetUp() override {
50 ChromeBlobStorageContext* blob_storage_context = 50 ChromeBlobStorageContext* blob_storage_context =
51 ChromeBlobStorageContext::GetFor(&browser_context_); 51 ChromeBlobStorageContext::GetFor(&browser_context_);
52 // Wait for chrome_blob_storage_context to finish initializing. 52 // Wait for chrome_blob_storage_context to finish initializing.
53 base::RunLoop().RunUntilIdle(); 53 base::RunLoop().RunUntilIdle();
54 blob_storage_context_ = blob_storage_context->context(); 54 blob_storage_context_ = blob_storage_context->context();
55 55
56 url_request_job_factory_.reset(new net::URLRequestJobFactoryImpl); 56 url_request_job_factory_.reset(new net::URLRequestJobFactoryImpl);
57 url_request_job_factory_->SetProtocolHandler( 57 url_request_job_factory_->SetProtocolHandler(
58 "blob", CreateMockBlobProtocolHandler(blob_storage_context->context())); 58 "blob", CreateMockBlobProtocolHandler(blob_storage_context->context()));
59 59
(...skipping 10 matching lines...) Expand all
70 blob_storage_context->context()->AsWeakPtr()); 70 blob_storage_context->context()->AsWeakPtr());
71 } else { 71 } else {
72 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 72 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
73 cache_ = ServiceWorkerCache::CreatePersistentCache( 73 cache_ = ServiceWorkerCache::CreatePersistentCache(
74 temp_dir_.path(), 74 temp_dir_.path(),
75 url_request_context, 75 url_request_context,
76 blob_storage_context->context()->AsWeakPtr()); 76 blob_storage_context->context()->AsWeakPtr());
77 } 77 }
78 } 78 }
79 79
80 virtual void TearDown() OVERRIDE { 80 virtual void TearDown() override {
81 base::RunLoop().RunUntilIdle(); 81 base::RunLoop().RunUntilIdle();
82 } 82 }
83 83
84 void CreateRequests(ChromeBlobStorageContext* blob_storage_context) { 84 void CreateRequests(ChromeBlobStorageContext* blob_storage_context) {
85 ServiceWorkerHeaderMap headers; 85 ServiceWorkerHeaderMap headers;
86 headers.insert(std::make_pair("a", "a")); 86 headers.insert(std::make_pair("a", "a"));
87 headers.insert(std::make_pair("b", "b")); 87 headers.insert(std::make_pair("b", "b"));
88 body_request_ = ServiceWorkerFetchRequest( 88 body_request_ = ServiceWorkerFetchRequest(
89 GURL("http://example.com/body.html"), "GET", headers, GURL(""), false); 89 GURL("http://example.com/body.html"), "GET", headers, GURL(""), false);
90 no_body_request_ = 90 no_body_request_ =
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 std::string expected_blob_data_; 276 std::string expected_blob_data_;
277 277
278 ServiceWorkerCache::ErrorType callback_error_; 278 ServiceWorkerCache::ErrorType callback_error_;
279 scoped_ptr<ServiceWorkerResponse> callback_response_; 279 scoped_ptr<ServiceWorkerResponse> callback_response_;
280 scoped_ptr<storage::BlobDataHandle> callback_response_data_; 280 scoped_ptr<storage::BlobDataHandle> callback_response_data_;
281 std::vector<std::string> callback_strings_; 281 std::vector<std::string> callback_strings_;
282 }; 282 };
283 283
284 class ServiceWorkerCacheTestP : public ServiceWorkerCacheTest, 284 class ServiceWorkerCacheTestP : public ServiceWorkerCacheTest,
285 public testing::WithParamInterface<bool> { 285 public testing::WithParamInterface<bool> {
286 virtual bool MemoryOnly() OVERRIDE { return !GetParam(); } 286 virtual bool MemoryOnly() override { return !GetParam(); }
287 }; 287 };
288 288
289 TEST_P(ServiceWorkerCacheTestP, PutNoBody) { 289 TEST_P(ServiceWorkerCacheTestP, PutNoBody) {
290 EXPECT_TRUE(Put(no_body_request_, no_body_response_)); 290 EXPECT_TRUE(Put(no_body_request_, no_body_response_));
291 EXPECT_TRUE(callback_response_); 291 EXPECT_TRUE(callback_response_);
292 EXPECT_STREQ(no_body_response_.url.spec().c_str(), 292 EXPECT_STREQ(no_body_response_.url.spec().c_str(),
293 callback_response_->url.spec().c_str()); 293 callback_response_->url.spec().c_str());
294 EXPECT_FALSE(callback_response_data_); 294 EXPECT_FALSE(callback_response_data_);
295 } 295 }
296 296
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 request.headers["content-type"] = "foo"; 514 request.headers["content-type"] = "foo";
515 request.headers["Content-Type"] = "bar"; 515 request.headers["Content-Type"] = "bar";
516 EXPECT_EQ("bar", request.headers["content-type"]); 516 EXPECT_EQ("bar", request.headers["content-type"]);
517 } 517 }
518 518
519 INSTANTIATE_TEST_CASE_P(ServiceWorkerCacheTest, 519 INSTANTIATE_TEST_CASE_P(ServiceWorkerCacheTest,
520 ServiceWorkerCacheTestP, 520 ServiceWorkerCacheTestP,
521 ::testing::Values(false, true)); 521 ::testing::Values(false, true));
522 522
523 } // namespace content 523 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698