| 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 "content/browser/service_worker/service_worker_version.h" | 5 #include "content/browser/service_worker/service_worker_version.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} | 173 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} |
| 174 | 174 |
| 175 void SetUp() override { | 175 void SetUp() override { |
| 176 helper_ = GetMessageReceiver(); | 176 helper_ = GetMessageReceiver(); |
| 177 | 177 |
| 178 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); | 178 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); |
| 179 base::RunLoop().RunUntilIdle(); | 179 base::RunLoop().RunUntilIdle(); |
| 180 | 180 |
| 181 pattern_ = GURL("http://www.example.com/test/"); | 181 pattern_ = GURL("http://www.example.com/test/"); |
| 182 registration_ = new ServiceWorkerRegistration( | 182 registration_ = new ServiceWorkerRegistration( |
| 183 pattern_, | 183 ServiceWorkerRegistrationOptions(pattern_), 1L, |
| 184 1L, | |
| 185 helper_->context()->AsWeakPtr()); | 184 helper_->context()->AsWeakPtr()); |
| 186 version_ = new ServiceWorkerVersion( | 185 version_ = new ServiceWorkerVersion( |
| 187 registration_.get(), | 186 registration_.get(), |
| 188 GURL("http://www.example.com/test/service_worker.js"), | 187 GURL("http://www.example.com/test/service_worker.js"), |
| 189 helper_->context()->storage()->NewVersionId(), | 188 helper_->context()->storage()->NewVersionId(), |
| 190 helper_->context()->AsWeakPtr()); | 189 helper_->context()->AsWeakPtr()); |
| 191 std::vector<ServiceWorkerDatabase::ResourceRecord> records; | 190 std::vector<ServiceWorkerDatabase::ResourceRecord> records; |
| 192 records.push_back( | 191 records.push_back( |
| 193 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); | 192 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); |
| 194 version_->script_cache_map()->SetResources(records); | 193 version_->script_cache_map()->SetResources(records); |
| (...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 // OnStarted. | 1441 // OnStarted. |
| 1443 version_->StopWorker(CreateReceiverOnCurrentThread(&status2)); | 1442 version_->StopWorker(CreateReceiverOnCurrentThread(&status2)); |
| 1444 base::RunLoop().RunUntilIdle(); | 1443 base::RunLoop().RunUntilIdle(); |
| 1445 | 1444 |
| 1446 EXPECT_EQ(SERVICE_WORKER_OK, status1); | 1445 EXPECT_EQ(SERVICE_WORKER_OK, status1); |
| 1447 EXPECT_EQ(SERVICE_WORKER_OK, status2); | 1446 EXPECT_EQ(SERVICE_WORKER_OK, status2); |
| 1448 EXPECT_EQ(EmbeddedWorkerStatus::RUNNING, version_->running_status()); | 1447 EXPECT_EQ(EmbeddedWorkerStatus::RUNNING, version_->running_status()); |
| 1449 } | 1448 } |
| 1450 | 1449 |
| 1451 } // namespace content | 1450 } // namespace content |
| OLD | NEW |