| 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 <tuple> | 5 #include <tuple> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "content/browser/service_worker/embedded_worker_registry.h" | 10 #include "content/browser/service_worker/embedded_worker_registry.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 void SetUp() override { | 76 void SetUp() override { |
| 77 helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath())); | 77 helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath())); |
| 78 | 78 |
| 79 helper_->context()->RemoveDispatcherHost(helper_->mock_render_process_id()); | 79 helper_->context()->RemoveDispatcherHost(helper_->mock_render_process_id()); |
| 80 dispatcher_host_ = new TestingServiceWorkerDispatcherHost( | 80 dispatcher_host_ = new TestingServiceWorkerDispatcherHost( |
| 81 helper_->mock_render_process_id(), helper_->context_wrapper(), | 81 helper_->mock_render_process_id(), helper_->context_wrapper(), |
| 82 &resource_context_, helper_.get()); | 82 &resource_context_, helper_.get()); |
| 83 | 83 |
| 84 const GURL pattern("http://www.example.com/"); | 84 const GURL pattern("http://www.example.com/"); |
| 85 registration_ = new ServiceWorkerRegistration( | 85 registration_ = new ServiceWorkerRegistration( |
| 86 pattern, | 86 pattern, false /* use_cache */, 1L, helper_->context()->AsWeakPtr()); |
| 87 1L, | |
| 88 helper_->context()->AsWeakPtr()); | |
| 89 version_ = new ServiceWorkerVersion( | 87 version_ = new ServiceWorkerVersion( |
| 90 registration_.get(), | 88 registration_.get(), |
| 91 GURL("http://www.example.com/service_worker.js"), | 89 GURL("http://www.example.com/service_worker.js"), |
| 92 1L, | 90 1L, |
| 93 helper_->context()->AsWeakPtr()); | 91 helper_->context()->AsWeakPtr()); |
| 94 std::vector<ServiceWorkerDatabase::ResourceRecord> records; | 92 std::vector<ServiceWorkerDatabase::ResourceRecord> records; |
| 95 records.push_back( | 93 records.push_back( |
| 96 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); | 94 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); |
| 97 version_->script_cache_map()->SetResources(records); | 95 version_->script_cache_map()->SetResources(records); |
| 98 version_->SetMainScriptHttpResponseInfo(net::HttpResponseInfo()); | 96 version_->SetMainScriptHttpResponseInfo(net::HttpResponseInfo()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // StartWorker shouldn't be recorded here. | 161 // StartWorker shouldn't be recorded here. |
| 164 ASSERT_EQ(1UL, ipc_sink()->message_count()); | 162 ASSERT_EQ(1UL, ipc_sink()->message_count()); |
| 165 message = ipc_sink()->GetMessageAt(0); | 163 message = ipc_sink()->GetMessageAt(0); |
| 166 | 164 |
| 167 // StateChanged (state == Installed). | 165 // StateChanged (state == Installed). |
| 168 VerifyStateChangedMessage(handle->handle_id(), | 166 VerifyStateChangedMessage(handle->handle_id(), |
| 169 blink::WebServiceWorkerStateInstalled, message); | 167 blink::WebServiceWorkerStateInstalled, message); |
| 170 } | 168 } |
| 171 | 169 |
| 172 } // namespace content | 170 } // namespace content |
| OLD | NEW |