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

Side by Side Diff: media/midi/midi_manager_mac_unittest.cc

Issue 2422163002: Web MIDI: use midi_service.mojom for media::midi::PortState (Closed)
Patch Set: gn --check fix Created 4 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 | « media/midi/midi_manager_mac.cc ('k') | media/midi/midi_manager_unittest.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "media/midi/midi_manager_mac.h" 5 #include "media/midi/midi_manager_mac.h"
6 6
7 #include <CoreMIDI/MIDIServices.h> 7 #include <CoreMIDI/MIDIServices.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/run_loop.h" 16 #include "base/run_loop.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 namespace midi { 20 namespace midi {
21 21
22 namespace { 22 namespace {
23 23
24 using mojom::PortState;
24 using mojom::Result; 25 using mojom::Result;
25 26
26 void Noop(const MIDIPacketList*, void*, void*) {} 27 void Noop(const MIDIPacketList*, void*, void*) {}
27 28
28 class FakeMidiManagerClient : public MidiManagerClient { 29 class FakeMidiManagerClient : public MidiManagerClient {
29 public: 30 public:
30 FakeMidiManagerClient() 31 FakeMidiManagerClient()
31 : result_(Result::NOT_SUPPORTED), 32 : result_(Result::NOT_SUPPORTED),
32 wait_for_result_(true), 33 wait_for_result_(true),
33 wait_for_port_(true), 34 wait_for_port_(true),
(...skipping 10 matching lines...) Expand all
44 return; 45 return;
45 46
46 // Check if this is the first call after CompleteStartSession(), and 47 // Check if this is the first call after CompleteStartSession(), and
47 // the case should not happen twice. 48 // the case should not happen twice.
48 if (!wait_for_port_) 49 if (!wait_for_port_)
49 unexpected_callback_ = true; 50 unexpected_callback_ = true;
50 51
51 info_ = info; 52 info_ = info;
52 wait_for_port_ = false; 53 wait_for_port_ = false;
53 } 54 }
54 void SetInputPortState(uint32_t port_index, MidiPortState state) override {} 55 void SetInputPortState(uint32_t port_index, PortState state) override {}
55 void SetOutputPortState(uint32_t port_index, MidiPortState state) override {} 56 void SetOutputPortState(uint32_t port_index, PortState state) override {}
56 57
57 void CompleteStartSession(Result result) override { 58 void CompleteStartSession(Result result) override {
58 base::AutoLock lock(lock_); 59 base::AutoLock lock(lock_);
59 if (!wait_for_result_) 60 if (!wait_for_result_)
60 unexpected_callback_ = true; 61 unexpected_callback_ = true;
61 62
62 result_ = result; 63 result_ = result;
63 wait_for_result_ = false; 64 wait_for_result_ = false;
64 } 65 }
65 66
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 EndSession(client.get()); 166 EndSession(client.get());
166 if (ep) 167 if (ep)
167 MIDIEndpointDispose(ep); 168 MIDIEndpointDispose(ep);
168 if (midi_client) 169 if (midi_client)
169 MIDIClientDispose(midi_client); 170 MIDIClientDispose(midi_client);
170 } 171 }
171 172
172 } // namespace 173 } // namespace
173 174
174 } // namespace midi 175 } // namespace midi
OLDNEW
« no previous file with comments | « media/midi/midi_manager_mac.cc ('k') | media/midi/midi_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698