OLD | NEW |
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> |
| 12 |
11 #include "base/logging.h" | 13 #include "base/logging.h" |
12 #include "base/macros.h" | 14 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
15 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
16 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 namespace media { | 20 namespace media { |
20 namespace midi { | 21 namespace midi { |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 120 |
120 protected: | 121 protected: |
121 void StartSession(MidiManagerClient* client) { | 122 void StartSession(MidiManagerClient* client) { |
122 manager_->StartSession(client); | 123 manager_->StartSession(client); |
123 } | 124 } |
124 void EndSession(MidiManagerClient* client) { | 125 void EndSession(MidiManagerClient* client) { |
125 manager_->EndSession(client); | 126 manager_->EndSession(client); |
126 } | 127 } |
127 | 128 |
128 private: | 129 private: |
129 scoped_ptr<MidiManager> manager_; | 130 std::unique_ptr<MidiManager> manager_; |
130 scoped_ptr<base::MessageLoop> message_loop_; | 131 std::unique_ptr<base::MessageLoop> message_loop_; |
131 | 132 |
132 DISALLOW_COPY_AND_ASSIGN(MidiManagerMacTest); | 133 DISALLOW_COPY_AND_ASSIGN(MidiManagerMacTest); |
133 }; | 134 }; |
134 | 135 |
135 | 136 |
136 TEST_F(MidiManagerMacTest, MidiNotification) { | 137 TEST_F(MidiManagerMacTest, MidiNotification) { |
137 scoped_ptr<FakeMidiManagerClient> client(new FakeMidiManagerClient); | 138 std::unique_ptr<FakeMidiManagerClient> client(new FakeMidiManagerClient); |
138 StartSession(client.get()); | 139 StartSession(client.get()); |
139 | 140 |
140 Result result = client->WaitForResult(); | 141 Result result = client->WaitForResult(); |
141 EXPECT_EQ(Result::OK, result); | 142 EXPECT_EQ(Result::OK, result); |
142 | 143 |
143 // Create MIDIClient, and MIDIEndpoint as a MIDIDestination. This should | 144 // Create MIDIClient, and MIDIEndpoint as a MIDIDestination. This should |
144 // notify MIDIManagerMac as a MIDIObjectAddRemoveNotification. | 145 // notify MIDIManagerMac as a MIDIObjectAddRemoveNotification. |
145 MIDIClientRef midi_client = 0; | 146 MIDIClientRef midi_client = 0; |
146 OSStatus status = MIDIClientCreate( | 147 OSStatus status = MIDIClientCreate( |
147 CFSTR("MidiManagerMacTest"), nullptr, nullptr, &midi_client); | 148 CFSTR("MidiManagerMacTest"), nullptr, nullptr, &midi_client); |
(...skipping 16 matching lines...) Expand all Loading... |
164 if (ep) | 165 if (ep) |
165 MIDIEndpointDispose(ep); | 166 MIDIEndpointDispose(ep); |
166 if (midi_client) | 167 if (midi_client) |
167 MIDIClientDispose(midi_client); | 168 MIDIClientDispose(midi_client); |
168 } | 169 } |
169 | 170 |
170 } // namespace | 171 } // namespace |
171 | 172 |
172 } // namespace midi | 173 } // namespace midi |
173 } // namespace media | 174 } // namespace media |
OLD | NEW |