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

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

Issue 655713003: Standardize usage of virtual/override/final in media/ (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/usb_midi_output_stream.h" 5 #include "media/midi/usb_midi_output_stream.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "media/midi/usb_midi_device.h" 12 #include "media/midi/usb_midi_device.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 namespace { 17 namespace {
18 18
19 template<typename T, size_t N> 19 template<typename T, size_t N>
20 std::vector<T> ToVector(const T((&array)[N])) { 20 std::vector<T> ToVector(const T((&array)[N])) {
21 return std::vector<T>(array, array + N); 21 return std::vector<T>(array, array + N);
22 } 22 }
23 23
24 class MockUsbMidiDevice : public UsbMidiDevice { 24 class MockUsbMidiDevice : public UsbMidiDevice {
25 public: 25 public:
26 MockUsbMidiDevice() {} 26 MockUsbMidiDevice() {}
27 virtual ~MockUsbMidiDevice() {} 27 ~MockUsbMidiDevice() override {}
28 28
29 virtual std::vector<uint8> GetDescriptor() override { 29 std::vector<uint8> GetDescriptor() override { return std::vector<uint8>(); }
30 return std::vector<uint8>();
31 }
32 30
33 virtual void Send(int endpoint_number, const std::vector<uint8>& data) 31 void Send(int endpoint_number, const std::vector<uint8>& data) override {
34 override {
35 for (size_t i = 0; i < data.size(); ++i) { 32 for (size_t i = 0; i < data.size(); ++i) {
36 log_ += base::StringPrintf("0x%02x ", data[i]); 33 log_ += base::StringPrintf("0x%02x ", data[i]);
37 } 34 }
38 log_ += base::StringPrintf("(endpoint = %d)\n", endpoint_number); 35 log_ += base::StringPrintf("(endpoint = %d)\n", endpoint_number);
39 } 36 }
40 37
41 const std::string& log() const { return log_; } 38 const std::string& log() const { return log_; }
42 39
43 void ClearLog() { log_ = ""; } 40 void ClearLog() { log_ = ""; }
44 41
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 stream_->Send(ToVector(data)); 264 stream_->Send(ToVector(data));
268 EXPECT_EQ("0x24 0xf0 0x00 0x01 " 265 EXPECT_EQ("0x24 0xf0 0x00 0x01 "
269 "0x25 0xf8 0x00 0x00 " 266 "0x25 0xf8 0x00 0x00 "
270 "0x25 0xfa 0x00 0x00 " 267 "0x25 0xfa 0x00 0x00 "
271 "0x27 0x02 0x03 0xf7 (endpoint = 4)\n", device_.log()); 268 "0x27 0x02 0x03 0xf7 (endpoint = 4)\n", device_.log());
272 } 269 }
273 270
274 } // namespace 271 } // namespace
275 272
276 } // namespace media 273 } // namespace media
OLDNEW
« no previous file with comments | « media/midi/usb_midi_input_stream_unittest.cc ('k') | media/mojo/services/mojo_demuxer_stream_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698