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

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

Issue 1129753002: [content/browser/service_worker] Using ThreadTaskRunnerHandle in lieu of MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « content/browser/service_worker/service_worker_storage.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/thread_task_runner_handle.h"
10 #include "content/browser/fileapi/chrome_blob_storage_context.h" 11 #include "content/browser/fileapi/chrome_blob_storage_context.h"
11 #include "content/browser/fileapi/mock_url_request_delegate.h" 12 #include "content/browser/fileapi/mock_url_request_delegate.h"
12 #include "content/browser/resource_context_impl.h" 13 #include "content/browser/resource_context_impl.h"
13 #include "content/browser/service_worker/embedded_worker_registry.h" 14 #include "content/browser/service_worker/embedded_worker_registry.h"
14 #include "content/browser/service_worker/embedded_worker_test_helper.h" 15 #include "content/browser/service_worker/embedded_worker_test_helper.h"
15 #include "content/browser/service_worker/service_worker_context_core.h" 16 #include "content/browser/service_worker/service_worker_context_core.h"
16 #include "content/browser/service_worker/service_worker_provider_host.h" 17 #include "content/browser/service_worker/service_worker_provider_host.h"
17 #include "content/browser/service_worker/service_worker_registration.h" 18 #include "content/browser/service_worker/service_worker_registration.h"
18 #include "content/browser/service_worker/service_worker_test_utils.h" 19 #include "content/browser/service_worker/service_worker_test_utils.h"
19 #include "content/browser/service_worker/service_worker_url_request_job.h" 20 #include "content/browser/service_worker/service_worker_url_request_job.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; 92 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
92 }; 93 };
93 94
94 // Returns a BlobProtocolHandler that uses |blob_storage_context|. Caller owns 95 // Returns a BlobProtocolHandler that uses |blob_storage_context|. Caller owns
95 // the memory. 96 // the memory.
96 storage::BlobProtocolHandler* CreateMockBlobProtocolHandler( 97 storage::BlobProtocolHandler* CreateMockBlobProtocolHandler(
97 storage::BlobStorageContext* blob_storage_context) { 98 storage::BlobStorageContext* blob_storage_context) {
98 // The FileSystemContext and MessageLoopProxy are not actually used but a 99 // The FileSystemContext and MessageLoopProxy are not actually used but a
99 // MessageLoopProxy is needed to avoid a DCHECK in BlobURLRequestJob ctor. 100 // MessageLoopProxy is needed to avoid a DCHECK in BlobURLRequestJob ctor.
100 return new storage::BlobProtocolHandler( 101 return new storage::BlobProtocolHandler(
101 blob_storage_context, nullptr, base::MessageLoopProxy::current().get()); 102 blob_storage_context, nullptr, base::ThreadTaskRunnerHandle::Get().get());
102 } 103 }
103 104
104 } // namespace 105 } // namespace
105 106
106 class ServiceWorkerURLRequestJobTest : public testing::Test { 107 class ServiceWorkerURLRequestJobTest : public testing::Test {
107 protected: 108 protected:
108 ServiceWorkerURLRequestJobTest() 109 ServiceWorkerURLRequestJobTest()
109 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), 110 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP),
110 blob_data_(new storage::BlobDataBuilder("blob-id:myblob")) {} 111 blob_data_(new storage::BlobDataBuilder("blob-id:myblob")) {}
111 ~ServiceWorkerURLRequestJobTest() override {} 112 ~ServiceWorkerURLRequestJobTest() override {}
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 stream->Finalize(); 575 stream->Finalize();
575 576
576 base::RunLoop().RunUntilIdle(); 577 base::RunLoop().RunUntilIdle();
577 EXPECT_FALSE(request_->status().is_success()); 578 EXPECT_FALSE(request_->status().is_success());
578 } 579 }
579 580
580 // TODO(kinuko): Add more tests with different response data and also for 581 // TODO(kinuko): Add more tests with different response data and also for
581 // FallbackToNetwork case. 582 // FallbackToNetwork case.
582 583
583 } // namespace content 584 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_storage.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698