| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 EmbeddedWorkerTestHelper* helper_; | 64 EmbeddedWorkerTestHelper* helper_; |
| 65 ~TestingServiceWorkerDispatcherHost() override {} | 65 ~TestingServiceWorkerDispatcherHost() override {} |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 class ServiceWorkerHandleTest : public testing::Test { | 68 class ServiceWorkerHandleTest : public testing::Test { |
| 69 public: | 69 public: |
| 70 ServiceWorkerHandleTest() | 70 ServiceWorkerHandleTest() |
| 71 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} | 71 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} |
| 72 | 72 |
| 73 void SetUp() override { | 73 void SetUp() override { |
| 74 helper_.reset(new EmbeddedWorkerTestHelper(kRenderProcessId)); | 74 helper_.reset( |
| 75 new EmbeddedWorkerTestHelper(base::FilePath(), kRenderProcessId)); |
| 75 | 76 |
| 76 dispatcher_host_ = new TestingServiceWorkerDispatcherHost( | 77 dispatcher_host_ = new TestingServiceWorkerDispatcherHost( |
| 77 kRenderProcessId, helper_->context_wrapper(), | 78 kRenderProcessId, helper_->context_wrapper(), |
| 78 &resource_context_, helper_.get()); | 79 &resource_context_, helper_.get()); |
| 79 | 80 |
| 80 const GURL pattern("http://www.example.com/"); | 81 const GURL pattern("http://www.example.com/"); |
| 81 registration_ = new ServiceWorkerRegistration( | 82 registration_ = new ServiceWorkerRegistration( |
| 82 pattern, | 83 pattern, |
| 83 1L, | 84 1L, |
| 84 helper_->context()->AsWeakPtr()); | 85 helper_->context()->AsWeakPtr()); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // 3. SendMessageToWorker (to send InstallEvent), and | 165 // 3. SendMessageToWorker (to send InstallEvent), and |
| 165 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, | 166 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, |
| 166 ipc_sink()->GetMessageAt(2)->type()); | 167 ipc_sink()->GetMessageAt(2)->type()); |
| 167 // 4. StateChanged (state == Installed). | 168 // 4. StateChanged (state == Installed). |
| 168 VerifyStateChangedMessage(handle->handle_id(), | 169 VerifyStateChangedMessage(handle->handle_id(), |
| 169 blink::WebServiceWorkerStateInstalled, | 170 blink::WebServiceWorkerStateInstalled, |
| 170 ipc_sink()->GetMessageAt(3)); | 171 ipc_sink()->GetMessageAt(3)); |
| 171 } | 172 } |
| 172 | 173 |
| 173 } // namespace content | 174 } // namespace content |
| OLD | NEW |