| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} | 210 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} |
| 211 | 211 |
| 212 void SetUp() override { | 212 void SetUp() override { |
| 213 helper_ = GetMessageReceiver(); | 213 helper_ = GetMessageReceiver(); |
| 214 | 214 |
| 215 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); | 215 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); |
| 216 base::RunLoop().RunUntilIdle(); | 216 base::RunLoop().RunUntilIdle(); |
| 217 | 217 |
| 218 pattern_ = GURL("http://www.example.com/test/"); | 218 pattern_ = GURL("http://www.example.com/test/"); |
| 219 registration_ = new ServiceWorkerRegistration( | 219 registration_ = new ServiceWorkerRegistration( |
| 220 pattern_, | 220 pattern_, false /* use_cache */, 1L, helper_->context()->AsWeakPtr()); |
| 221 1L, | |
| 222 helper_->context()->AsWeakPtr()); | |
| 223 version_ = new ServiceWorkerVersion( | 221 version_ = new ServiceWorkerVersion( |
| 224 registration_.get(), | 222 registration_.get(), |
| 225 GURL("http://www.example.com/test/service_worker.js"), | 223 GURL("http://www.example.com/test/service_worker.js"), |
| 226 helper_->context()->storage()->NewVersionId(), | 224 helper_->context()->storage()->NewVersionId(), |
| 227 helper_->context()->AsWeakPtr()); | 225 helper_->context()->AsWeakPtr()); |
| 228 std::vector<ServiceWorkerDatabase::ResourceRecord> records; | 226 std::vector<ServiceWorkerDatabase::ResourceRecord> records; |
| 229 records.push_back( | 227 records.push_back( |
| 230 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); | 228 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); |
| 231 version_->script_cache_map()->SetResources(records); | 229 version_->script_cache_map()->SetResources(records); |
| 232 version_->SetMainScriptHttpResponseInfo( | 230 version_->SetMainScriptHttpResponseInfo( |
| (...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1847 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1); | 1845 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1); |
| 1848 histogram_tester_.ExpectTotalCount(kLinkTapDown, 0); | 1846 histogram_tester_.ExpectTotalCount(kLinkTapDown, 0); |
| 1849 EXPECT_EQ(SERVICE_WORKER_OK, status); | 1847 EXPECT_EQ(SERVICE_WORKER_OK, status); |
| 1850 StopWorker(); | 1848 StopWorker(); |
| 1851 // The UMA for kLinkMouseDown must be recorded when the worker stopped. | 1849 // The UMA for kLinkMouseDown must be recorded when the worker stopped. |
| 1852 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1); | 1850 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1); |
| 1853 histogram_tester_.ExpectTotalCount(kLinkTapDown, 1); | 1851 histogram_tester_.ExpectTotalCount(kLinkTapDown, 1); |
| 1854 } | 1852 } |
| 1855 | 1853 |
| 1856 } // namespace content | 1854 } // namespace content |
| OLD | NEW |