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

Side by Side Diff: content/browser/media/midi_host_unittest.cc

Issue 1315793008: Web MIDI: introduce MidiManager::Shutdown to shutdown gracefully (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename to Detach Created 5 years, 2 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
« no previous file with comments | « content/browser/media/midi_host.cc ('k') | media/midi/midi_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 void ShutdownForBadMessage() 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 ~MidiHostTest() override {
108 manager_.Shutdown();
109 RunLoopUntilIdle();
110 }
107 111
108 protected: 112 protected:
109 void AddOutputPort() { 113 void AddOutputPort() {
110 const std::string id = base::StringPrintf("i-can-%d", port_id_++); 114 const std::string id = base::StringPrintf("i-can-%d", port_id_++);
111 const std::string manufacturer("yukatan"); 115 const std::string manufacturer("yukatan");
112 const std::string name("doki-doki-pi-pine"); 116 const std::string name("doki-doki-pi-pine");
113 const std::string version("3.14159265359"); 117 const std::string version("3.14159265359");
114 media::midi::MidiPortState state = media::midi::MIDI_PORT_CONNECTED; 118 media::midi::MidiPortState state = media::midi::MIDI_PORT_CONNECTED;
115 media::midi::MidiPortInfo info(id, manufacturer, name, version, state); 119 media::midi::MidiPortInfo info(id, manufacturer, name, version, state);
116 120
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // Sending data to port 0 and 1 should be delivered now. 228 // Sending data to port 0 and 1 should be delivered now.
225 OnSendData(port0); 229 OnSendData(port0);
226 OnSendData(port1); 230 OnSendData(port1);
227 RunLoopUntilIdle(); 231 RunLoopUntilIdle();
228 EXPECT_EQ(3U, GetEventSize()); 232 EXPECT_EQ(3U, GetEventSize());
229 CheckSendEventAt(1, port0); 233 CheckSendEventAt(1, port0);
230 CheckSendEventAt(2, port1); 234 CheckSendEventAt(2, port1);
231 } 235 }
232 236
233 } // namespace conent 237 } // namespace conent
OLDNEW
« no previous file with comments | « content/browser/media/midi_host.cc ('k') | media/midi/midi_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698