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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "content/browser/service_worker/embedded_worker_registry.h" | 7 #include "content/browser/service_worker/embedded_worker_registry.h" |
8 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 8 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
9 #include "content/browser/service_worker/service_worker_context_core.h" | 9 #include "content/browser/service_worker/service_worker_context_core.h" |
10 #include "content/browser/service_worker/service_worker_dispatcher_host.h" | 10 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 dispatcher_host_ = new TestingServiceWorkerDispatcherHost( | 77 dispatcher_host_ = new TestingServiceWorkerDispatcherHost( |
78 kRenderProcessId, helper_->context_wrapper(), | 78 kRenderProcessId, helper_->context_wrapper(), |
79 &resource_context_, helper_.get()); | 79 &resource_context_, helper_.get()); |
80 | 80 |
81 const GURL pattern("http://www.example.com/"); | 81 const GURL pattern("http://www.example.com/"); |
82 registration_ = new ServiceWorkerRegistration( | 82 registration_ = new ServiceWorkerRegistration( |
83 pattern, | 83 pattern, |
84 1L, | 84 1L, |
85 helper_->context()->AsWeakPtr()); | 85 helper_->context()->AsWeakPtr()); |
86 version_ = new ServiceWorkerVersion( | 86 version_ = new ServiceWorkerVersion( |
87 registration_.get(), | 87 registration_.get(), GURL("http://www.example.com/service_worker.js"), |
88 GURL("http://www.example.com/service_worker.js"), | 88 std::string("2d73e817-7136-4133-8d59-84105fe5417a"), |
89 1L, | |
90 helper_->context()->AsWeakPtr()); | 89 helper_->context()->AsWeakPtr()); |
91 std::vector<ServiceWorkerDatabase::ResourceRecord> records; | 90 std::vector<ServiceWorkerDatabase::ResourceRecord> records; |
92 records.push_back( | 91 records.push_back( |
93 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); | 92 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); |
94 version_->script_cache_map()->SetResources(records); | 93 version_->script_cache_map()->SetResources(records); |
95 | 94 |
96 // Make the registration findable via storage functions. | 95 // Make the registration findable via storage functions. |
97 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); | 96 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); |
98 base::RunLoop().RunUntilIdle(); | 97 base::RunLoop().RunUntilIdle(); |
99 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; | 98 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // 3. SendMessageToWorker (to send InstallEvent), and | 167 // 3. SendMessageToWorker (to send InstallEvent), and |
169 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, | 168 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, |
170 ipc_sink()->GetMessageAt(2)->type()); | 169 ipc_sink()->GetMessageAt(2)->type()); |
171 // 4. StateChanged (state == Installed). | 170 // 4. StateChanged (state == Installed). |
172 VerifyStateChangedMessage(handle->handle_id(), | 171 VerifyStateChangedMessage(handle->handle_id(), |
173 blink::WebServiceWorkerStateInstalled, | 172 blink::WebServiceWorkerStateInstalled, |
174 ipc_sink()->GetMessageAt(3)); | 173 ipc_sink()->GetMessageAt(3)); |
175 } | 174 } |
176 | 175 |
177 } // namespace content | 176 } // namespace content |
OLD | NEW |