| 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_handle.h" | 10 #include "content/browser/service_worker/service_worker_handle.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 version_ = NULL; | 64 version_ = NULL; |
| 65 helper_.reset(); | 65 helper_.reset(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 IPC::TestSink* ipc_sink() { return helper_->ipc_sink(); } | 68 IPC::TestSink* ipc_sink() { return helper_->ipc_sink(); } |
| 69 | 69 |
| 70 TestBrowserThreadBundle browser_thread_bundle_; | 70 TestBrowserThreadBundle browser_thread_bundle_; |
| 71 scoped_ptr<EmbeddedWorkerTestHelper> helper_; | 71 scoped_ptr<EmbeddedWorkerTestHelper> helper_; |
| 72 scoped_refptr<ServiceWorkerRegistration> registration_; | 72 scoped_refptr<ServiceWorkerRegistration> registration_; |
| 73 scoped_refptr<ServiceWorkerVersion> version_; | 73 scoped_refptr<ServiceWorkerVersion> version_; |
| 74 |
| 75 private: |
| 74 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandleTest); | 76 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandleTest); |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 TEST_F(ServiceWorkerHandleTest, OnVersionStateChanged) { | 79 TEST_F(ServiceWorkerHandleTest, OnVersionStateChanged) { |
| 78 scoped_ptr<ServiceWorkerHandle> handle = | 80 scoped_ptr<ServiceWorkerHandle> handle = |
| 79 ServiceWorkerHandle::Create(helper_->context()->AsWeakPtr(), | 81 ServiceWorkerHandle::Create(helper_->context()->AsWeakPtr(), |
| 80 helper_.get(), | 82 helper_.get(), |
| 81 1 /* thread_id */, | 83 1 /* thread_id */, |
| 82 version_); | 84 version_); |
| 83 | 85 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 108 // 3. SendMessageToWorker (to send InstallEvent), and | 110 // 3. SendMessageToWorker (to send InstallEvent), and |
| 109 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, | 111 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, |
| 110 ipc_sink()->GetMessageAt(2)->type()); | 112 ipc_sink()->GetMessageAt(2)->type()); |
| 111 // 4. StateChanged (state == Installed). | 113 // 4. StateChanged (state == Installed). |
| 112 VerifyStateChangedMessage(handle->handle_id(), | 114 VerifyStateChangedMessage(handle->handle_id(), |
| 113 blink::WebServiceWorkerStateInstalled, | 115 blink::WebServiceWorkerStateInstalled, |
| 114 ipc_sink()->GetMessageAt(3)); | 116 ipc_sink()->GetMessageAt(3)); |
| 115 } | 117 } |
| 116 | 118 |
| 117 } // namespace content | 119 } // namespace content |
| OLD | NEW |