| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_registration.h" | 5 #include "content/browser/service_worker/service_worker_registration.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 version_1->set_fetch_handler_existence( | 242 version_1->set_fetch_handler_existence( |
| 243 ServiceWorkerVersion::FetchHandlerExistence::EXISTS); | 243 ServiceWorkerVersion::FetchHandlerExistence::EXISTS); |
| 244 registration_->SetActiveVersion(version_1); | 244 registration_->SetActiveVersion(version_1); |
| 245 version_1->SetStatus(ServiceWorkerVersion::ACTIVATED); | 245 version_1->SetStatus(ServiceWorkerVersion::ACTIVATED); |
| 246 | 246 |
| 247 // Store the registration. | 247 // Store the registration. |
| 248 std::vector<ServiceWorkerDatabase::ResourceRecord> records; | 248 std::vector<ServiceWorkerDatabase::ResourceRecord> records; |
| 249 records.push_back(ServiceWorkerDatabase::ResourceRecord( | 249 records.push_back(ServiceWorkerDatabase::ResourceRecord( |
| 250 10, version_1->script_url(), 100)); | 250 10, version_1->script_url(), 100)); |
| 251 version_1->script_cache_map()->SetResources(records); | 251 version_1->script_cache_map()->SetResources(records); |
| 252 version_1->SetMainScriptHttpResponseInfo( |
| 253 EmbeddedWorkerTestHelper::CreateHttpResponseInfo()); |
| 252 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_MAX_VALUE; | 254 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_MAX_VALUE; |
| 253 context()->storage()->StoreRegistration( | 255 context()->storage()->StoreRegistration( |
| 254 registration_.get(), version_1.get(), | 256 registration_.get(), version_1.get(), |
| 255 CreateReceiverOnCurrentThread(&status)); | 257 CreateReceiverOnCurrentThread(&status)); |
| 256 base::RunLoop().RunUntilIdle(); | 258 base::RunLoop().RunUntilIdle(); |
| 257 ASSERT_EQ(SERVICE_WORKER_OK, status); | 259 ASSERT_EQ(SERVICE_WORKER_OK, status); |
| 258 | 260 |
| 259 // Give the active version a controllee. | 261 // Give the active version a controllee. |
| 260 host_.reset(new ServiceWorkerProviderHost( | 262 host_.reset(new ServiceWorkerProviderHost( |
| 261 33 /* dummy render process id */, | 263 33 /* dummy render process id */, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 | 379 |
| 378 INSTANTIATE_TEST_CASE_P(ServiceWorkerRegistrationTest, | 380 INSTANTIATE_TEST_CASE_P(ServiceWorkerRegistrationTest, |
| 379 ServiceWorkerRegistrationTestP, | 381 ServiceWorkerRegistrationTestP, |
| 380 testing::Bool()); | 382 testing::Bool()); |
| 381 | 383 |
| 382 INSTANTIATE_TEST_CASE_P(ServiceWorkerActivationTest, | 384 INSTANTIATE_TEST_CASE_P(ServiceWorkerActivationTest, |
| 383 ServiceWorkerActivationTest, | 385 ServiceWorkerActivationTest, |
| 384 testing::Bool()); | 386 testing::Bool()); |
| 385 | 387 |
| 386 } // namespace content | 388 } // namespace content |
| OLD | NEW |