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 "base/files/scoped_temp_dir.h" | 5 #include "base/files/scoped_temp_dir.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "content/browser/browser_thread_impl.h" | 8 #include "content/browser/browser_thread_impl.h" |
9 #include "content/browser/fileapi/mock_url_request_delegate.h" | 9 #include "content/browser/fileapi/mock_url_request_delegate.h" |
10 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 10 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 void SetUp() override { | 37 void SetUp() override { |
38 helper_.reset( | 38 helper_.reset( |
39 new EmbeddedWorkerTestHelper(base::FilePath(), kMockRenderProcessId)); | 39 new EmbeddedWorkerTestHelper(base::FilePath(), kMockRenderProcessId)); |
40 | 40 |
41 // A new unstored registration/version. | 41 // A new unstored registration/version. |
42 scope_ = GURL("http://host/scope/"); | 42 scope_ = GURL("http://host/scope/"); |
43 script_url_ = GURL("http://host/script.js"); | 43 script_url_ = GURL("http://host/script.js"); |
44 registration_ = new ServiceWorkerRegistration( | 44 registration_ = new ServiceWorkerRegistration( |
45 scope_, 1L, context()->AsWeakPtr()); | 45 scope_, 1L, context()->AsWeakPtr()); |
46 version_ = new ServiceWorkerVersion( | 46 version_ = new ServiceWorkerVersion( |
47 registration_.get(), script_url_, 1L, context()->AsWeakPtr()); | 47 registration_.get(), script_url_, |
| 48 std::string("df95cef9-34ac-46a7-be64-53f68d7d6d08"), |
| 49 context()->AsWeakPtr()); |
48 | 50 |
49 // An empty host. | 51 // An empty host. |
50 scoped_ptr<ServiceWorkerProviderHost> host(new ServiceWorkerProviderHost( | 52 scoped_ptr<ServiceWorkerProviderHost> host(new ServiceWorkerProviderHost( |
51 kMockRenderProcessId, MSG_ROUTING_NONE /* render_frame_id */, | 53 kMockRenderProcessId, MSG_ROUTING_NONE /* render_frame_id */, |
52 1 /* provider_id */, SERVICE_WORKER_PROVIDER_FOR_WINDOW, | 54 1 /* provider_id */, SERVICE_WORKER_PROVIDER_FOR_WINDOW, |
53 context()->AsWeakPtr(), nullptr)); | 55 context()->AsWeakPtr(), nullptr)); |
54 provider_host_ = host->AsWeakPtr(); | 56 provider_host_ = host->AsWeakPtr(); |
55 context()->AddProviderHost(host.Pass()); | 57 context()->AddProviderHost(host.Pass()); |
56 | 58 |
57 context()->storage()->LazyInitialize(base::Bind(&EmptyCallback)); | 59 context()->storage()->LazyInitialize(base::Bind(&EmptyCallback)); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 handler->MaybeCreateJob(request.get(), nullptr, nullptr); | 156 handler->MaybeCreateJob(request.get(), nullptr, nullptr); |
155 ASSERT_TRUE(job.get()); | 157 ASSERT_TRUE(job.get()); |
156 ServiceWorkerWriteToCacheJob* sw_job = | 158 ServiceWorkerWriteToCacheJob* sw_job = |
157 static_cast<ServiceWorkerWriteToCacheJob*>(job.get()); | 159 static_cast<ServiceWorkerWriteToCacheJob*>(job.get()); |
158 | 160 |
159 // Verify the net request is initialized to bypass the browser cache. | 161 // Verify the net request is initialized to bypass the browser cache. |
160 EXPECT_TRUE(sw_job->net_request_->load_flags() & net::LOAD_BYPASS_CACHE); | 162 EXPECT_TRUE(sw_job->net_request_->load_flags() & net::LOAD_BYPASS_CACHE); |
161 } | 163 } |
162 | 164 |
163 } // namespace content | 165 } // namespace content |
OLD | NEW |