OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/service_worker/service_worker_registration.h" | 5 #include "content/browser/service_worker/service_worker_registration.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 registration_.get(), version_1.get(), | 253 registration_.get(), version_1.get(), |
254 CreateReceiverOnCurrentThread(&status)); | 254 CreateReceiverOnCurrentThread(&status)); |
255 base::RunLoop().RunUntilIdle(); | 255 base::RunLoop().RunUntilIdle(); |
256 ASSERT_EQ(SERVICE_WORKER_OK, status); | 256 ASSERT_EQ(SERVICE_WORKER_OK, status); |
257 | 257 |
258 // Give the active version a controllee. | 258 // Give the active version a controllee. |
259 host_ = CreateProviderHostForWindow( | 259 host_ = CreateProviderHostForWindow( |
260 helper_->mock_render_process_id(), 1 /* dummy provider_id */, | 260 helper_->mock_render_process_id(), 1 /* dummy provider_id */, |
261 true /* is_parent_frame_secure */, context()->AsWeakPtr(), | 261 true /* is_parent_frame_secure */, context()->AsWeakPtr(), |
262 &remote_endpoint_); | 262 &remote_endpoint_); |
263 DCHECK(remote_endpoint_.client_request()->is_pending()); | |
264 DCHECK(remote_endpoint_.host_ptr()->is_bound()); | |
265 version_1->AddControllee(host_.get()); | 263 version_1->AddControllee(host_.get()); |
266 | 264 |
267 // Give the active version an in-flight request. | 265 // Give the active version an in-flight request. |
268 inflight_request_id_ = CreateInflightRequest(version_1.get()); | 266 inflight_request_id_ = CreateInflightRequest(version_1.get()); |
269 | 267 |
270 // Create a waiting version. | 268 // Create a waiting version. |
271 scoped_refptr<ServiceWorkerVersion> version_2 = new ServiceWorkerVersion( | 269 scoped_refptr<ServiceWorkerVersion> version_2 = new ServiceWorkerVersion( |
272 registration_.get(), kScript, storage()->NewVersionId(), | 270 registration_.get(), kScript, storage()->NewVersionId(), |
273 context()->AsWeakPtr()); | 271 context()->AsWeakPtr()); |
274 version_2->set_fetch_handler_existence( | 272 version_2->set_fetch_handler_existence( |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 EXPECT_EQ(version_1.get(), reg->active_version()); | 367 EXPECT_EQ(version_1.get(), reg->active_version()); |
370 | 368 |
371 // Finish the request. Activation should happen. | 369 // Finish the request. Activation should happen. |
372 version_1->FinishRequest(inflight_request_id(), true /* was_handled */, | 370 version_1->FinishRequest(inflight_request_id(), true /* was_handled */, |
373 base::Time::Now()); | 371 base::Time::Now()); |
374 base::RunLoop().RunUntilIdle(); | 372 base::RunLoop().RunUntilIdle(); |
375 EXPECT_EQ(version_2.get(), reg->active_version()); | 373 EXPECT_EQ(version_2.get(), reg->active_version()); |
376 } | 374 } |
377 | 375 |
378 } // namespace content | 376 } // namespace content |
OLD | NEW |