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 <tuple> | 5 #include <tuple> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "content/browser/service_worker/embedded_worker_registry.h" | 10 #include "content/browser/service_worker/embedded_worker_registry.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 helper_->context()->AsWeakPtr()); | 87 helper_->context()->AsWeakPtr()); |
88 version_ = new ServiceWorkerVersion( | 88 version_ = new ServiceWorkerVersion( |
89 registration_.get(), | 89 registration_.get(), |
90 GURL("http://www.example.com/service_worker.js"), | 90 GURL("http://www.example.com/service_worker.js"), |
91 1L, | 91 1L, |
92 helper_->context()->AsWeakPtr()); | 92 helper_->context()->AsWeakPtr()); |
93 std::vector<ServiceWorkerDatabase::ResourceRecord> records; | 93 std::vector<ServiceWorkerDatabase::ResourceRecord> records; |
94 records.push_back( | 94 records.push_back( |
95 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); | 95 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); |
96 version_->script_cache_map()->SetResources(records); | 96 version_->script_cache_map()->SetResources(records); |
| 97 version_->SetMainScriptHttpResponseInfo(net::HttpResponseInfo()); |
97 version_->set_fetch_handler_existence( | 98 version_->set_fetch_handler_existence( |
98 ServiceWorkerVersion::FetchHandlerExistence::EXISTS); | 99 ServiceWorkerVersion::FetchHandlerExistence::EXISTS); |
99 version_->SetStatus(ServiceWorkerVersion::INSTALLING); | 100 version_->SetStatus(ServiceWorkerVersion::INSTALLING); |
100 | 101 |
101 // Make the registration findable via storage functions. | 102 // Make the registration findable via storage functions. |
102 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); | 103 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); |
103 base::RunLoop().RunUntilIdle(); | 104 base::RunLoop().RunUntilIdle(); |
104 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; | 105 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; |
105 helper_->context()->storage()->StoreRegistration( | 106 helper_->context()->storage()->StoreRegistration( |
106 registration_.get(), | 107 registration_.get(), |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // StateChanged (state == Installed). | 178 // StateChanged (state == Installed). |
178 VerifyStateChangedMessage(handle->handle_id(), | 179 VerifyStateChangedMessage(handle->handle_id(), |
179 blink::WebServiceWorkerStateInstalled, message); | 180 blink::WebServiceWorkerStateInstalled, message); |
180 } | 181 } |
181 | 182 |
182 INSTANTIATE_TEST_CASE_P(ServiceWorkerHandleTest, | 183 INSTANTIATE_TEST_CASE_P(ServiceWorkerHandleTest, |
183 ServiceWorkerHandleTestP, | 184 ServiceWorkerHandleTestP, |
184 ::testing::Values(false, true)); | 185 ::testing::Values(false, true)); |
185 | 186 |
186 } // namespace content | 187 } // namespace content |
OLD | NEW |