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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); | 103 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); |
104 base::RunLoop().RunUntilIdle(); | 104 base::RunLoop().RunUntilIdle(); |
105 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; | 105 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; |
106 helper_->context()->storage()->StoreRegistration( | 106 helper_->context()->storage()->StoreRegistration( |
107 registration_.get(), | 107 registration_.get(), |
108 version_.get(), | 108 version_.get(), |
109 CreateReceiverOnCurrentThread(&status)); | 109 CreateReceiverOnCurrentThread(&status)); |
110 base::RunLoop().RunUntilIdle(); | 110 base::RunLoop().RunUntilIdle(); |
111 ASSERT_EQ(SERVICE_WORKER_OK, status); | 111 ASSERT_EQ(SERVICE_WORKER_OK, status); |
112 | 112 |
113 provider_host_.reset(new ServiceWorkerProviderHost( | 113 provider_host_ = ServiceWorkerProviderHost::CreateForTesting( |
114 helper_->mock_render_process_id(), kRenderFrameId, 1, | 114 helper_->mock_render_process_id(), 1 /* provider_id */, |
115 SERVICE_WORKER_PROVIDER_FOR_WINDOW, | 115 SERVICE_WORKER_PROVIDER_FOR_WINDOW, helper_->context()->AsWeakPtr(), |
116 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE, | 116 kRenderFrameId, dispatcher_host_.get()); |
117 helper_->context()->AsWeakPtr(), dispatcher_host_.get())); | 117 provider_host_->set_parent_frame_secure(true); |
118 | |
119 helper_->SimulateAddProcessToPattern(pattern, | 118 helper_->SimulateAddProcessToPattern(pattern, |
120 helper_->mock_render_process_id()); | 119 helper_->mock_render_process_id()); |
121 } | 120 } |
122 | 121 |
123 void TearDown() override { | 122 void TearDown() override { |
124 dispatcher_host_ = NULL; | 123 dispatcher_host_ = NULL; |
125 registration_ = NULL; | 124 registration_ = NULL; |
126 version_ = NULL; | 125 version_ = NULL; |
127 provider_host_.reset(); | 126 provider_host_.reset(); |
128 helper_.reset(); | 127 helper_.reset(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // StartWorker shouldn't be recorded here. | 163 // StartWorker shouldn't be recorded here. |
165 ASSERT_EQ(1UL, ipc_sink()->message_count()); | 164 ASSERT_EQ(1UL, ipc_sink()->message_count()); |
166 message = ipc_sink()->GetMessageAt(0); | 165 message = ipc_sink()->GetMessageAt(0); |
167 | 166 |
168 // StateChanged (state == Installed). | 167 // StateChanged (state == Installed). |
169 VerifyStateChangedMessage(handle->handle_id(), | 168 VerifyStateChangedMessage(handle->handle_id(), |
170 blink::WebServiceWorkerStateInstalled, message); | 169 blink::WebServiceWorkerStateInstalled, message); |
171 } | 170 } |
172 | 171 |
173 } // namespace content | 172 } // namespace content |
OLD | NEW |