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

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

Issue 2653493009: Add two interfaces for ServiceWorkerProviderContext/ProviderHost (Closed)
Patch Set: Addressed comments from falken Created 3 years, 7 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 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 "content/browser/service_worker/embedded_worker_test_helper.h" 5 #include "content/browser/service_worker/embedded_worker_test_helper.h"
6 6
7 #include <map> 7 #include <map>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 ->OnScriptLoaded(); 568 ->OnScriptLoaded();
569 base::RunLoop().RunUntilIdle(); 569 base::RunLoop().RunUntilIdle();
570 } 570 }
571 571
572 void EmbeddedWorkerTestHelper::SimulateWorkerThreadStarted( 572 void EmbeddedWorkerTestHelper::SimulateWorkerThreadStarted(
573 int thread_id, 573 int thread_id,
574 int embedded_worker_id, 574 int embedded_worker_id,
575 int provider_id) { 575 int provider_id) {
576 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); 576 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id);
577 ASSERT_TRUE(worker); 577 ASSERT_TRUE(worker);
578 ASSERT_TRUE(embedded_worker_id_instance_host_ptr_map_[embedded_worker_id]);
579
578 // Prepare a provider host to be used by following OnThreadStarted(). 580 // Prepare a provider host to be used by following OnThreadStarted().
579 std::unique_ptr<ServiceWorkerProviderHost> host = 581 std::unique_ptr<ServiceWorkerProviderHost> host =
580 CreateProviderHostForServiceWorkerContext( 582 CreateProviderHostForServiceWorkerContext(
581 worker->process_id(), provider_id, true /* is_parent_frame_secure */, 583 worker->process_id(), provider_id, true /* is_parent_frame_secure */,
582 context()->AsWeakPtr()); 584 context()->AsWeakPtr(),
585 &embedded_worker_id_remote_provider_map_[embedded_worker_id]);
583 context()->AddProviderHost(std::move(host)); 586 context()->AddProviderHost(std::move(host));
584 587
585 ASSERT_TRUE(embedded_worker_id_instance_host_ptr_map_[embedded_worker_id]);
586 embedded_worker_id_instance_host_ptr_map_[embedded_worker_id] 588 embedded_worker_id_instance_host_ptr_map_[embedded_worker_id]
587 ->OnThreadStarted(thread_id, provider_id); 589 ->OnThreadStarted(thread_id, provider_id);
588 base::RunLoop().RunUntilIdle(); 590 base::RunLoop().RunUntilIdle();
589 } 591 }
590 592
591 void EmbeddedWorkerTestHelper::SimulateWorkerScriptEvaluated( 593 void EmbeddedWorkerTestHelper::SimulateWorkerScriptEvaluated(
592 int embedded_worker_id, 594 int embedded_worker_id,
593 bool success) { 595 bool success) {
594 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); 596 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id);
595 ASSERT_TRUE(worker); 597 ASSERT_TRUE(worker);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 base::Passed(&app_request), base::Passed(&response_callback), 793 base::Passed(&app_request), base::Passed(&response_callback),
792 base::Passed(&callback))); 794 base::Passed(&callback)));
793 } 795 }
794 796
795 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { 797 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() {
796 DCHECK(context()); 798 DCHECK(context());
797 return context()->embedded_worker_registry(); 799 return context()->embedded_worker_registry();
798 } 800 }
799 801
800 } // namespace content 802 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698