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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 private: | 75 private: |
76 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandleTest); | 76 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandleTest); |
77 }; | 77 }; |
78 | 78 |
79 TEST_F(ServiceWorkerHandleTest, OnVersionStateChanged) { | 79 TEST_F(ServiceWorkerHandleTest, OnVersionStateChanged) { |
80 scoped_ptr<ServiceWorkerHandle> handle = | 80 scoped_ptr<ServiceWorkerHandle> handle = |
81 ServiceWorkerHandle::Create(helper_->context()->AsWeakPtr(), | 81 ServiceWorkerHandle::Create(helper_->context()->AsWeakPtr(), |
82 helper_.get(), | 82 helper_.get(), |
83 1 /* thread_id */, | 83 1 /* thread_id */, |
| 84 33 /* provider_id */, |
84 version_); | 85 version_); |
85 | 86 |
86 // Start the worker, and then... | 87 // Start the worker, and then... |
87 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; | 88 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; |
88 version_->StartWorker(CreateReceiverOnCurrentThread(&status)); | 89 version_->StartWorker(CreateReceiverOnCurrentThread(&status)); |
89 base::RunLoop().RunUntilIdle(); | 90 base::RunLoop().RunUntilIdle(); |
90 EXPECT_EQ(SERVICE_WORKER_OK, status); | 91 EXPECT_EQ(SERVICE_WORKER_OK, status); |
91 | 92 |
92 // ...dispatch install event. | 93 // ...dispatch install event. |
93 status = SERVICE_WORKER_ERROR_FAILED; | 94 status = SERVICE_WORKER_ERROR_FAILED; |
(...skipping 16 matching lines...) Expand all Loading... |
110 // 3. SendMessageToWorker (to send InstallEvent), and | 111 // 3. SendMessageToWorker (to send InstallEvent), and |
111 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, | 112 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, |
112 ipc_sink()->GetMessageAt(2)->type()); | 113 ipc_sink()->GetMessageAt(2)->type()); |
113 // 4. StateChanged (state == Installed). | 114 // 4. StateChanged (state == Installed). |
114 VerifyStateChangedMessage(handle->handle_id(), | 115 VerifyStateChangedMessage(handle->handle_id(), |
115 blink::WebServiceWorkerStateInstalled, | 116 blink::WebServiceWorkerStateInstalled, |
116 ipc_sink()->GetMessageAt(3)); | 117 ipc_sink()->GetMessageAt(3)); |
117 } | 118 } |
118 | 119 |
119 } // namespace content | 120 } // namespace content |
OLD | NEW |