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

Side by Side Diff: media/midi/usb_midi_input_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
« no previous file with comments | « media/midi/midi_manager_usb_unittest.cc ('k') | media/midi/usb_midi_output_stream_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 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_input_stream.h" 5 #include "media/midi/usb_midi_input_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 "base/time/time.h" 12 #include "base/time/time.h"
13 #include "media/midi/usb_midi_device.h" 13 #include "media/midi/usb_midi_device.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 using base::TimeTicks; 16 using base::TimeTicks;
17 17
18 namespace media { 18 namespace media {
19 19
20 namespace { 20 namespace {
21 21
22 class TestUsbMidiDevice : public UsbMidiDevice { 22 class TestUsbMidiDevice : public UsbMidiDevice {
23 public: 23 public:
24 TestUsbMidiDevice() {} 24 TestUsbMidiDevice() {}
25 virtual ~TestUsbMidiDevice() {} 25 ~TestUsbMidiDevice() override {}
26 virtual std::vector<uint8> GetDescriptor() override { 26 std::vector<uint8> GetDescriptor() override { return std::vector<uint8>(); }
27 return std::vector<uint8>(); 27 void Send(int endpoint_number, const std::vector<uint8>& data) override {}
28 }
29 virtual void Send(int endpoint_number,
30 const std::vector<uint8>& data) override {}
31 28
32 private: 29 private:
33 DISALLOW_COPY_AND_ASSIGN(TestUsbMidiDevice); 30 DISALLOW_COPY_AND_ASSIGN(TestUsbMidiDevice);
34 }; 31 };
35 32
36 class MockDelegate : public UsbMidiInputStream::Delegate { 33 class MockDelegate : public UsbMidiInputStream::Delegate {
37 public: 34 public:
38 MockDelegate() {} 35 MockDelegate() {}
39 virtual ~MockDelegate() {} 36 ~MockDelegate() override {}
40 virtual void OnReceivedData(size_t jack_index, 37 void OnReceivedData(size_t jack_index,
41 const uint8* data, 38 const uint8* data,
42 size_t size, 39 size_t size,
43 base::TimeTicks time) override { 40 base::TimeTicks time) override {
44 for (size_t i = 0; i < size; ++i) 41 for (size_t i = 0; i < size; ++i)
45 received_data_ += base::StringPrintf("0x%02x ", data[i]); 42 received_data_ += base::StringPrintf("0x%02x ", data[i]);
46 received_data_ += "\n"; 43 received_data_ += "\n";
47 } 44 }
48 45
49 const std::string& received_data() const { return received_data_; } 46 const std::string& received_data() const { return received_data_; }
50 47
51 private: 48 private:
52 std::string received_data_; 49 std::string received_data_;
53 DISALLOW_COPY_AND_ASSIGN(MockDelegate); 50 DISALLOW_COPY_AND_ASSIGN(MockDelegate);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 TEST_F(UsbMidiInputStreamTest, DispatchForDevice2) { 166 TEST_F(UsbMidiInputStreamTest, DispatchForDevice2) {
170 uint8 data[] = { 0x4f, 0xf8, 0x00, 0x00 }; 167 uint8 data[] = { 0x4f, 0xf8, 0x00, 0x00 };
171 168
172 stream_->OnReceivedData(&device2_, 7, data, arraysize(data), TimeTicks()); 169 stream_->OnReceivedData(&device2_, 7, data, arraysize(data), TimeTicks());
173 EXPECT_EQ("0xf8 \n", delegate_.received_data()); 170 EXPECT_EQ("0xf8 \n", delegate_.received_data());
174 } 171 }
175 172
176 } // namespace 173 } // namespace
177 174
178 } // namespace media 175 } // namespace media
OLDNEW
« no previous file with comments | « media/midi/midi_manager_usb_unittest.cc ('k') | media/midi/usb_midi_output_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698