| 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 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 helper_->context()->AsWeakPtr()); | 216 helper_->context()->AsWeakPtr()); |
| 217 version_ = new ServiceWorkerVersion( | 217 version_ = new ServiceWorkerVersion( |
| 218 registration_.get(), | 218 registration_.get(), |
| 219 GURL("http://www.example.com/test/service_worker.js"), | 219 GURL("http://www.example.com/test/service_worker.js"), |
| 220 helper_->context()->storage()->NewVersionId(), | 220 helper_->context()->storage()->NewVersionId(), |
| 221 helper_->context()->AsWeakPtr()); | 221 helper_->context()->AsWeakPtr()); |
| 222 std::vector<ServiceWorkerDatabase::ResourceRecord> records; | 222 std::vector<ServiceWorkerDatabase::ResourceRecord> records; |
| 223 records.push_back( | 223 records.push_back( |
| 224 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); | 224 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); |
| 225 version_->script_cache_map()->SetResources(records); | 225 version_->script_cache_map()->SetResources(records); |
| 226 version_->set_fetch_handler_existence( |
| 227 ServiceWorkerVersion::FetchHandlerExistence::EXISTS); |
| 226 | 228 |
| 227 // Make the registration findable via storage functions. | 229 // Make the registration findable via storage functions. |
| 228 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; | 230 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; |
| 229 helper_->context()->storage()->StoreRegistration( | 231 helper_->context()->storage()->StoreRegistration( |
| 230 registration_.get(), | 232 registration_.get(), |
| 231 version_.get(), | 233 version_.get(), |
| 232 CreateReceiverOnCurrentThread(&status)); | 234 CreateReceiverOnCurrentThread(&status)); |
| 233 base::RunLoop().RunUntilIdle(); | 235 base::RunLoop().RunUntilIdle(); |
| 234 ASSERT_EQ(SERVICE_WORKER_OK, status); | 236 ASSERT_EQ(SERVICE_WORKER_OK, status); |
| 235 | 237 |
| (...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1); | 1719 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1); |
| 1718 histogram_tester_.ExpectTotalCount(kLinkTapDown, 0); | 1720 histogram_tester_.ExpectTotalCount(kLinkTapDown, 0); |
| 1719 EXPECT_EQ(SERVICE_WORKER_OK, status); | 1721 EXPECT_EQ(SERVICE_WORKER_OK, status); |
| 1720 StopWorker(); | 1722 StopWorker(); |
| 1721 // The UMA for kLinkMouseDown must be recorded when the worker stopped. | 1723 // The UMA for kLinkMouseDown must be recorded when the worker stopped. |
| 1722 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1); | 1724 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1); |
| 1723 histogram_tester_.ExpectTotalCount(kLinkTapDown, 1); | 1725 histogram_tester_.ExpectTotalCount(kLinkTapDown, 1); |
| 1724 } | 1726 } |
| 1725 | 1727 |
| 1726 } // namespace content | 1728 } // namespace content |
| OLD | NEW |