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

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

Issue 2429753003: Mojofy unittests: ServiceWorkerJobTest (Closed)
Patch Set: Check if mojo is enabled when creating a mock interface Created 4 years, 2 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 <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 117
118 void EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::StopWorker( 118 void EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::StopWorker(
119 const StopWorkerCallback& callback) { 119 const StopWorkerCallback& callback) {
120 if (!helper_) 120 if (!helper_)
121 return; 121 return;
122 122
123 ASSERT_TRUE(embedded_worker_id_); 123 ASSERT_TRUE(embedded_worker_id_);
124 EmbeddedWorkerInstance* worker = 124 EmbeddedWorkerInstance* worker =
125 helper_->registry()->GetWorker(embedded_worker_id_.value()); 125 helper_->registry()->GetWorker(embedded_worker_id_.value());
126 ASSERT_TRUE(worker != NULL); 126 // |worker| is possible to be null when corresponding EmbeddedWorkerInstance
127 EXPECT_EQ(EmbeddedWorkerStatus::STOPPING, worker->status()); 127 // is removed right after sending StopWorker.
128 128 if (worker)
129 EXPECT_EQ(EmbeddedWorkerStatus::STOPPING, worker->status());
129 callback.Run(); 130 callback.Run();
130 } 131 }
131 132
132 // static 133 // static
133 void EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::Bind( 134 void EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::Bind(
134 const base::WeakPtr<EmbeddedWorkerTestHelper>& helper, 135 const base::WeakPtr<EmbeddedWorkerTestHelper>& helper,
135 mojom::EmbeddedWorkerInstanceClientRequest request) { 136 mojom::EmbeddedWorkerInstanceClientRequest request) {
136 std::vector<std::unique_ptr<MockEmbeddedWorkerInstanceClient>>* clients = 137 std::vector<std::unique_ptr<MockEmbeddedWorkerInstanceClient>>* clients =
137 helper->mock_instance_clients(); 138 helper->mock_instance_clients();
138 size_t next_client_index = helper->mock_instance_clients_next_index_; 139 size_t next_client_index = helper->mock_instance_clients_next_index_;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 registry->Bind(mojo::GetProxy(&interfaces)); 566 registry->Bind(mojo::GetProxy(&interfaces));
566 567
567 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces( 568 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces(
568 new service_manager::InterfaceProvider); 569 new service_manager::InterfaceProvider);
569 remote_interfaces->Bind(std::move(interfaces)); 570 remote_interfaces->Bind(std::move(interfaces));
570 rph->SetRemoteInterfaces(std::move(remote_interfaces)); 571 rph->SetRemoteInterfaces(std::move(remote_interfaces));
571 return registry; 572 return registry;
572 } 573 }
573 574
574 } // namespace content 575 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698