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

Side by Side Diff: content/browser/media/midi_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/media/midi_host.h" 5 #include "content/browser/media/midi_host.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "content/common/media/midi_messages.h" 10 #include "content/common/media/midi_messages.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 class MidiHostForTesting : public MidiHost { 84 class MidiHostForTesting : public MidiHost {
85 public: 85 public:
86 MidiHostForTesting(int renderer_process_id, 86 MidiHostForTesting(int renderer_process_id,
87 media::midi::MidiManager* midi_manager) 87 media::midi::MidiManager* midi_manager)
88 : MidiHost(renderer_process_id, midi_manager) {} 88 : MidiHost(renderer_process_id, midi_manager) {}
89 89
90 private: 90 private:
91 ~MidiHostForTesting() override {} 91 ~MidiHostForTesting() override {}
92 92
93 // BrowserMessageFilter implementation. 93 // BrowserMessageFilter implementation.
94 // Override BadMessageReceived() so to do nothing since the original 94 // Override ShutdownForBadMessage() to do nothing since the original
95 // implementation to kill a malicious renderer process causes a check failure 95 // implementation to kill a malicious renderer process causes a check failure
96 // in unit tests. 96 // in unit tests.
97 void BadMessageReceived() override {} 97 void ShutdownForBadMessage() override {}
98 }; 98 };
99 99
100 class MidiHostTest : public testing::Test { 100 class MidiHostTest : public testing::Test {
101 public: 101 public:
102 MidiHostTest() 102 MidiHostTest()
103 : io_browser_thread_(BrowserThread::IO, &message_loop_), 103 : io_browser_thread_(BrowserThread::IO, &message_loop_),
104 host_(new MidiHostForTesting(kRenderProcessId, &manager_)), 104 host_(new MidiHostForTesting(kRenderProcessId, &manager_)),
105 data_(kNoteOn, kNoteOn + arraysize(kNoteOn)), 105 data_(kNoteOn, kNoteOn + arraysize(kNoteOn)),
106 port_id_(0) {} 106 port_id_(0) {}
107 107
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // Sending data to port 0 and 1 should be delivered now. 224 // Sending data to port 0 and 1 should be delivered now.
225 OnSendData(port0); 225 OnSendData(port0);
226 OnSendData(port1); 226 OnSendData(port1);
227 RunLoopUntilIdle(); 227 RunLoopUntilIdle();
228 EXPECT_EQ(3U, GetEventSize()); 228 EXPECT_EQ(3U, GetEventSize());
229 CheckSendEventAt(1, port0); 229 CheckSendEventAt(1, port0);
230 CheckSendEventAt(2, port1); 230 CheckSendEventAt(2, port1);
231 } 231 }
232 232
233 } // namespace conent 233 } // namespace conent
OLDNEW
« no previous file with comments | « content/browser/media/midi_host.cc ('k') | content/browser/notifications/notification_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698