Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: content/browser/service_worker/service_worker_registration_unittest.cc

Issue 2936623002: Implement dumb URLLoader{Factory} for ServiceWorker script loading (for try)
Patch Set: . Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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());
263 version_1->AddControllee(host_.get()); 265 version_1->AddControllee(host_.get());
264 266
265 // Give the active version an in-flight request. 267 // Give the active version an in-flight request.
266 inflight_request_id_ = CreateInflightRequest(version_1.get()); 268 inflight_request_id_ = CreateInflightRequest(version_1.get());
267 269
268 // Create a waiting version. 270 // Create a waiting version.
269 scoped_refptr<ServiceWorkerVersion> version_2 = new ServiceWorkerVersion( 271 scoped_refptr<ServiceWorkerVersion> version_2 = new ServiceWorkerVersion(
270 registration_.get(), kScript, storage()->NewVersionId(), 272 registration_.get(), kScript, storage()->NewVersionId(),
271 context()->AsWeakPtr()); 273 context()->AsWeakPtr());
272 version_2->set_fetch_handler_existence( 274 version_2->set_fetch_handler_existence(
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 EXPECT_EQ(version_1.get(), reg->active_version()); 369 EXPECT_EQ(version_1.get(), reg->active_version());
368 370
369 // Finish the request. Activation should happen. 371 // Finish the request. Activation should happen.
370 version_1->FinishRequest(inflight_request_id(), true /* was_handled */, 372 version_1->FinishRequest(inflight_request_id(), true /* was_handled */,
371 base::Time::Now()); 373 base::Time::Now());
372 base::RunLoop().RunUntilIdle(); 374 base::RunLoop().RunUntilIdle();
373 EXPECT_EQ(version_2.get(), reg->active_version()); 375 EXPECT_EQ(version_2.get(), reg->active_version());
374 } 376 }
375 377
376 } // namespace content 378 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698