| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |