| 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_has_fetch_handler(true); |
| 226 | 227 |
| 227 // Make the registration findable via storage functions. | 228 // Make the registration findable via storage functions. |
| 228 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; | 229 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; |
| 229 helper_->context()->storage()->StoreRegistration( | 230 helper_->context()->storage()->StoreRegistration( |
| 230 registration_.get(), | 231 registration_.get(), |
| 231 version_.get(), | 232 version_.get(), |
| 232 CreateReceiverOnCurrentThread(&status)); | 233 CreateReceiverOnCurrentThread(&status)); |
| 233 base::RunLoop().RunUntilIdle(); | 234 base::RunLoop().RunUntilIdle(); |
| 234 ASSERT_EQ(SERVICE_WORKER_OK, status); | 235 ASSERT_EQ(SERVICE_WORKER_OK, status); |
| 235 | 236 |
| (...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1); | 1718 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1); |
| 1718 histogram_tester_.ExpectTotalCount(kLinkTapDown, 0); | 1719 histogram_tester_.ExpectTotalCount(kLinkTapDown, 0); |
| 1719 EXPECT_EQ(SERVICE_WORKER_OK, status); | 1720 EXPECT_EQ(SERVICE_WORKER_OK, status); |
| 1720 StopWorker(); | 1721 StopWorker(); |
| 1721 // The UMA for kLinkMouseDown must be recorded when the worker stopped. | 1722 // The UMA for kLinkMouseDown must be recorded when the worker stopped. |
| 1722 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1); | 1723 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1); |
| 1723 histogram_tester_.ExpectTotalCount(kLinkTapDown, 1); | 1724 histogram_tester_.ExpectTotalCount(kLinkTapDown, 1); |
| 1724 } | 1725 } |
| 1725 | 1726 |
| 1726 } // namespace content | 1727 } // namespace content |
| OLD | NEW |