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

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

Issue 643093003: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_usb.h" 5 #include "media/midi/midi_manager_usb.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 Callback callback_; 123 Callback callback_;
124 124
125 private: 125 private:
126 DISALLOW_COPY_AND_ASSIGN(TestUsbMidiDeviceFactory); 126 DISALLOW_COPY_AND_ASSIGN(TestUsbMidiDeviceFactory);
127 }; 127 };
128 128
129 class MidiManagerUsbForTesting : public MidiManagerUsb { 129 class MidiManagerUsbForTesting : public MidiManagerUsb {
130 public: 130 public:
131 explicit MidiManagerUsbForTesting( 131 explicit MidiManagerUsbForTesting(
132 scoped_ptr<UsbMidiDevice::Factory> device_factory) 132 scoped_ptr<UsbMidiDevice::Factory> device_factory)
133 : MidiManagerUsb(device_factory.PassAs<UsbMidiDevice::Factory>()) {} 133 : MidiManagerUsb(device_factory.Pass()) {}
134 virtual ~MidiManagerUsbForTesting() {} 134 virtual ~MidiManagerUsbForTesting() {}
135 135
136 void CallCompleteInitialization(MidiResult result) { 136 void CallCompleteInitialization(MidiResult result) {
137 CompleteInitialization(result); 137 CompleteInitialization(result);
138 base::RunLoop run_loop; 138 base::RunLoop run_loop;
139 run_loop.RunUntilIdle(); 139 run_loop.RunUntilIdle();
140 } 140 }
141 141
142 private: 142 private:
143 DISALLOW_COPY_AND_ASSIGN(MidiManagerUsbForTesting); 143 DISALLOW_COPY_AND_ASSIGN(MidiManagerUsbForTesting);
144 }; 144 };
145 145
146 class MidiManagerUsbTest : public ::testing::Test { 146 class MidiManagerUsbTest : public ::testing::Test {
147 public: 147 public:
148 MidiManagerUsbTest() : message_loop_(new base::MessageLoop) { 148 MidiManagerUsbTest() : message_loop_(new base::MessageLoop) {
149 scoped_ptr<TestUsbMidiDeviceFactory> factory(new TestUsbMidiDeviceFactory); 149 scoped_ptr<TestUsbMidiDeviceFactory> factory(new TestUsbMidiDeviceFactory);
150 factory_ = factory.get(); 150 factory_ = factory.get();
151 manager_.reset( 151 manager_.reset(new MidiManagerUsbForTesting(factory.Pass()));
152 new MidiManagerUsbForTesting(factory.PassAs<UsbMidiDevice::Factory>()));
153 } 152 }
154 virtual ~MidiManagerUsbTest() { 153 virtual ~MidiManagerUsbTest() {
155 std::string leftover_logs = logger_.TakeLog(); 154 std::string leftover_logs = logger_.TakeLog();
156 if (!leftover_logs.empty()) { 155 if (!leftover_logs.empty()) {
157 ADD_FAILURE() << "Log should be empty: " << leftover_logs; 156 ADD_FAILURE() << "Log should be empty: " << leftover_logs;
158 } 157 }
159 } 158 }
160 159
161 protected: 160 protected:
162 void Initialize() { 161 void Initialize() {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 "data = 0x90 0x45 0x7f\n" 347 "data = 0x90 0x45 0x7f\n"
349 "MidiManagerClient::ReceiveMidiData port_index = 0 " 348 "MidiManagerClient::ReceiveMidiData port_index = 0 "
350 "data = 0xf0 0x00 0x01\n" 349 "data = 0xf0 0x00 0x01\n"
351 "MidiManagerClient::ReceiveMidiData port_index = 0 data = 0xf7\n", 350 "MidiManagerClient::ReceiveMidiData port_index = 0 data = 0xf7\n",
352 logger_.TakeLog()); 351 logger_.TakeLog());
353 } 352 }
354 353
355 } // namespace 354 } // namespace
356 355
357 } // namespace media 356 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/pipeline_integration_test_base.cc ('k') | media/video/capture/fake_video_capture_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698