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

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

Issue 2630273002: ServiceWorker: mojofy ResumeAfterDownload and AddMessageToConsole (Closed)
Patch Set: s/is/was/ , add :: before blink and remove unnecessary include Created 3 years, 11 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 ASSERT_TRUE(embedded_worker_id_); 89 ASSERT_TRUE(embedded_worker_id_);
90 EmbeddedWorkerInstance* worker = 90 EmbeddedWorkerInstance* worker =
91 helper_->registry()->GetWorker(embedded_worker_id_.value()); 91 helper_->registry()->GetWorker(embedded_worker_id_.value());
92 // |worker| is possible to be null when corresponding EmbeddedWorkerInstance 92 // |worker| is possible to be null when corresponding EmbeddedWorkerInstance
93 // is removed right after sending StopWorker. 93 // is removed right after sending StopWorker.
94 if (worker) 94 if (worker)
95 EXPECT_EQ(EmbeddedWorkerStatus::STOPPING, worker->status()); 95 EXPECT_EQ(EmbeddedWorkerStatus::STOPPING, worker->status());
96 helper_->OnStopWorkerStub(callback); 96 helper_->OnStopWorkerStub(callback);
97 } 97 }
98 98
99 void EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::
100 ResumeAfterDownload() {
101 helper_->OnResumeAfterDownloadStub(embedded_worker_id_.value());
102 }
103
104 void EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::
105 AddMessageToConsole(blink::WebConsoleMessage::Level level,
106 const std::string& message) {
107 // TODO(shimazu): Pass these arguments to the test helper when a test is
108 // necessary to check them individually.
109 }
110
99 // static 111 // static
100 void EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::Bind( 112 void EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::Bind(
101 const base::WeakPtr<EmbeddedWorkerTestHelper>& helper, 113 const base::WeakPtr<EmbeddedWorkerTestHelper>& helper,
102 mojom::EmbeddedWorkerInstanceClientRequest request) { 114 mojom::EmbeddedWorkerInstanceClientRequest request) {
103 std::vector<std::unique_ptr<MockEmbeddedWorkerInstanceClient>>* clients = 115 std::vector<std::unique_ptr<MockEmbeddedWorkerInstanceClient>>* clients =
104 helper->mock_instance_clients(); 116 helper->mock_instance_clients();
105 size_t next_client_index = helper->mock_instance_clients_next_index_; 117 size_t next_client_index = helper->mock_instance_clients_next_index_;
106 118
107 ASSERT_GE(clients->size(), next_client_index); 119 ASSERT_GE(clients->size(), next_client_index);
108 if (clients->size() == next_client_index) { 120 if (clients->size() == next_client_index) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 234
223 bool EmbeddedWorkerTestHelper::Send(IPC::Message* message) { 235 bool EmbeddedWorkerTestHelper::Send(IPC::Message* message) {
224 OnMessageReceived(*message); 236 OnMessageReceived(*message);
225 delete message; 237 delete message;
226 return true; 238 return true;
227 } 239 }
228 240
229 bool EmbeddedWorkerTestHelper::OnMessageReceived(const IPC::Message& message) { 241 bool EmbeddedWorkerTestHelper::OnMessageReceived(const IPC::Message& message) {
230 bool handled = true; 242 bool handled = true;
231 IPC_BEGIN_MESSAGE_MAP(EmbeddedWorkerTestHelper, message) 243 IPC_BEGIN_MESSAGE_MAP(EmbeddedWorkerTestHelper, message)
232 IPC_MESSAGE_HANDLER(EmbeddedWorkerMsg_ResumeAfterDownload,
233 OnResumeAfterDownloadStub)
234 IPC_MESSAGE_HANDLER(EmbeddedWorkerContextMsg_MessageToWorker, 244 IPC_MESSAGE_HANDLER(EmbeddedWorkerContextMsg_MessageToWorker,
235 OnMessageToWorkerStub) 245 OnMessageToWorkerStub)
236 IPC_MESSAGE_UNHANDLED(handled = false) 246 IPC_MESSAGE_UNHANDLED(handled = false)
237 IPC_END_MESSAGE_MAP() 247 IPC_END_MESSAGE_MAP()
238 248
239 // IPC::TestSink only records messages that are not handled by filters, 249 // IPC::TestSink only records messages that are not handled by filters,
240 // so we just forward all messages to the separate sink. 250 // so we just forward all messages to the separate sink.
241 sink_.OnMessageReceived(message); 251 sink_.OnMessageReceived(message);
242 252
243 return handled; 253 return handled;
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 service_manager::InterfaceProviderSpec()); 565 service_manager::InterfaceProviderSpec());
556 566
557 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces( 567 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces(
558 new service_manager::InterfaceProvider); 568 new service_manager::InterfaceProvider);
559 remote_interfaces->Bind(std::move(interfaces)); 569 remote_interfaces->Bind(std::move(interfaces));
560 rph->SetRemoteInterfaces(std::move(remote_interfaces)); 570 rph->SetRemoteInterfaces(std::move(remote_interfaces));
561 return registry; 571 return registry;
562 } 572 }
563 573
564 } // namespace content 574 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/embedded_worker_test_helper.h ('k') | content/browser/service_worker/service_worker_version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698