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

Side by Side Diff: content/browser/service_worker/service_worker_handle_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 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "content/browser/service_worker/embedded_worker_registry.h" 7 #include "content/browser/service_worker/embedded_worker_registry.h"
8 #include "content/browser/service_worker/embedded_worker_test_helper.h" 8 #include "content/browser/service_worker/embedded_worker_test_helper.h"
9 #include "content/browser/service_worker/service_worker_context_core.h" 9 #include "content/browser/service_worker/service_worker_context_core.h"
10 #include "content/browser/service_worker/service_worker_dispatcher_host.h" 10 #include "content/browser/service_worker/service_worker_dispatcher_host.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 ResourceContext* resource_context, 49 ResourceContext* resource_context,
50 EmbeddedWorkerTestHelper* helper) 50 EmbeddedWorkerTestHelper* helper)
51 : ServiceWorkerDispatcherHost(process_id, nullptr, resource_context), 51 : ServiceWorkerDispatcherHost(process_id, nullptr, resource_context),
52 bad_message_received_count_(0), 52 bad_message_received_count_(0),
53 helper_(helper) { 53 helper_(helper) {
54 Init(context_wrapper); 54 Init(context_wrapper);
55 } 55 }
56 56
57 bool Send(IPC::Message* message) override { return helper_->Send(message); } 57 bool Send(IPC::Message* message) override { return helper_->Send(message); }
58 58
59 void BadMessageReceived() override { ++bad_message_received_count_; } 59 void ShutdownForBadMessage() override { ++bad_message_received_count_; }
60 60
61 int bad_message_received_count_; 61 int bad_message_received_count_;
62 62
63 protected: 63 protected:
64 EmbeddedWorkerTestHelper* helper_; 64 EmbeddedWorkerTestHelper* helper_;
65 ~TestingServiceWorkerDispatcherHost() override {} 65 ~TestingServiceWorkerDispatcherHost() override {}
66 }; 66 };
67 67
68 class ServiceWorkerHandleTest : public testing::Test { 68 class ServiceWorkerHandleTest : public testing::Test {
69 public: 69 public:
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // 3. SendMessageToWorker (to send InstallEvent), and 168 // 3. SendMessageToWorker (to send InstallEvent), and
169 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, 169 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID,
170 ipc_sink()->GetMessageAt(2)->type()); 170 ipc_sink()->GetMessageAt(2)->type());
171 // 4. StateChanged (state == Installed). 171 // 4. StateChanged (state == Installed).
172 VerifyStateChangedMessage(handle->handle_id(), 172 VerifyStateChangedMessage(handle->handle_id(),
173 blink::WebServiceWorkerStateInstalled, 173 blink::WebServiceWorkerStateInstalled,
174 ipc_sink()->GetMessageAt(3)); 174 ipc_sink()->GetMessageAt(3));
175 } 175 }
176 176
177 } // namespace content 177 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698