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

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

Issue 1145013004: Introduce bad_message.h for chrome and NaCl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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_dispatcher_host.h" 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "content/browser/browser_thread_impl.h" 10 #include "content/browser/browser_thread_impl.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 : ServiceWorkerDispatcherHost(process_id, NULL, resource_context), 47 : ServiceWorkerDispatcherHost(process_id, NULL, resource_context),
48 bad_messages_received_count_(0), 48 bad_messages_received_count_(0),
49 helper_(helper) { 49 helper_(helper) {
50 Init(context_wrapper); 50 Init(context_wrapper);
51 } 51 }
52 52
53 bool Send(IPC::Message* message) override { return helper_->Send(message); } 53 bool Send(IPC::Message* message) override { return helper_->Send(message); }
54 54
55 IPC::TestSink* ipc_sink() { return helper_->ipc_sink(); } 55 IPC::TestSink* ipc_sink() { return helper_->ipc_sink(); }
56 56
57 void BadMessageReceived() override { ++bad_messages_received_count_; } 57 void ShutdownForBadMessage() override { ++bad_messages_received_count_; }
58 58
59 int bad_messages_received_count_; 59 int bad_messages_received_count_;
60 60
61 protected: 61 protected:
62 EmbeddedWorkerTestHelper* helper_; 62 EmbeddedWorkerTestHelper* helper_;
63 ~TestingServiceWorkerDispatcherHost() override {} 63 ~TestingServiceWorkerDispatcherHost() override {}
64 }; 64 };
65 65
66 class ServiceWorkerDispatcherHostTest : public testing::Test { 66 class ServiceWorkerDispatcherHostTest : public testing::Test {
67 protected: 67 protected:
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 559
560 // To show the new dispatcher can operate, simulate provider creation. Since 560 // To show the new dispatcher can operate, simulate provider creation. Since
561 // the old dispatcher cleaned up the old provider host, the new one won't 561 // the old dispatcher cleaned up the old provider host, the new one won't
562 // complain. 562 // complain.
563 new_dispatcher_host->OnMessageReceived(ServiceWorkerHostMsg_ProviderCreated( 563 new_dispatcher_host->OnMessageReceived(ServiceWorkerHostMsg_ProviderCreated(
564 kProviderId, MSG_ROUTING_NONE, SERVICE_WORKER_PROVIDER_FOR_WINDOW)); 564 kProviderId, MSG_ROUTING_NONE, SERVICE_WORKER_PROVIDER_FOR_WINDOW));
565 EXPECT_EQ(0, new_dispatcher_host->bad_messages_received_count_); 565 EXPECT_EQ(0, new_dispatcher_host->bad_messages_received_count_);
566 } 566 }
567 567
568 } // namespace content 568 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698