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

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

Issue 623263003: replace OVERRIDE and FINAL with override and 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_mac.h ('k') | media/midi/midi_manager_usb.h » ('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/midi_manager.h" 5 #include "media/midi/midi_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.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 class FakeMidiManager : public MidiManager { 19 class FakeMidiManager : public MidiManager {
20 public: 20 public:
21 FakeMidiManager() : start_initialization_is_called_(false) {} 21 FakeMidiManager() : start_initialization_is_called_(false) {}
22 virtual ~FakeMidiManager() {} 22 virtual ~FakeMidiManager() {}
23 23
24 // MidiManager implementation. 24 // MidiManager implementation.
25 virtual void StartInitialization() OVERRIDE { 25 virtual void StartInitialization() override {
26 start_initialization_is_called_ = true; 26 start_initialization_is_called_ = true;
27 } 27 }
28 28
29 virtual void DispatchSendMidiData(MidiManagerClient* client, 29 virtual void DispatchSendMidiData(MidiManagerClient* client,
30 uint32 port_index, 30 uint32 port_index,
31 const std::vector<uint8>& data, 31 const std::vector<uint8>& data,
32 double timestamp) OVERRIDE {} 32 double timestamp) override {}
33 33
34 // Utility functions for testing. 34 // Utility functions for testing.
35 void CallCompleteInitialization(MidiResult result) { 35 void CallCompleteInitialization(MidiResult result) {
36 CompleteInitialization(result); 36 CompleteInitialization(result);
37 } 37 }
38 38
39 size_t GetClientCount() const { 39 size_t GetClientCount() const {
40 return clients_size_for_testing(); 40 return clients_size_for_testing();
41 } 41 }
42 42
43 size_t GetPendingClientCount() const { 43 size_t GetPendingClientCount() const {
44 return pending_clients_size_for_testing(); 44 return pending_clients_size_for_testing();
45 } 45 }
46 46
47 bool start_initialization_is_called_; 47 bool start_initialization_is_called_;
48 48
49 private: 49 private:
50 DISALLOW_COPY_AND_ASSIGN(FakeMidiManager); 50 DISALLOW_COPY_AND_ASSIGN(FakeMidiManager);
51 }; 51 };
52 52
53 class FakeMidiManagerClient : public MidiManagerClient { 53 class FakeMidiManagerClient : public MidiManagerClient {
54 public: 54 public:
55 explicit FakeMidiManagerClient(int client_id) 55 explicit FakeMidiManagerClient(int client_id)
56 : client_id_(client_id), 56 : client_id_(client_id),
57 result_(MIDI_NOT_SUPPORTED), 57 result_(MIDI_NOT_SUPPORTED),
58 wait_for_result_(true) {} 58 wait_for_result_(true) {}
59 virtual ~FakeMidiManagerClient() {} 59 virtual ~FakeMidiManagerClient() {}
60 60
61 // MidiManagerClient implementation. 61 // MidiManagerClient implementation.
62 virtual void CompleteStartSession(int client_id, MidiResult result) OVERRIDE { 62 virtual void CompleteStartSession(int client_id, MidiResult result) override {
63 EXPECT_TRUE(wait_for_result_); 63 EXPECT_TRUE(wait_for_result_);
64 CHECK_EQ(client_id_, client_id); 64 CHECK_EQ(client_id_, client_id);
65 result_ = result; 65 result_ = result;
66 wait_for_result_ = false; 66 wait_for_result_ = false;
67 } 67 }
68 68
69 virtual void ReceiveMidiData(uint32 port_index, const uint8* data, 69 virtual void ReceiveMidiData(uint32 port_index, const uint8* data,
70 size_t size, double timestamp) OVERRIDE {} 70 size_t size, double timestamp) override {}
71 virtual void AccumulateMidiBytesSent(size_t size) OVERRIDE {} 71 virtual void AccumulateMidiBytesSent(size_t size) override {}
72 72
73 int client_id() const { return client_id_; } 73 int client_id() const { return client_id_; }
74 MidiResult result() const { return result_; } 74 MidiResult result() const { return result_; }
75 75
76 MidiResult WaitForResult() { 76 MidiResult WaitForResult() {
77 base::RunLoop run_loop; 77 base::RunLoop run_loop;
78 // CompleteStartSession() is called inside the message loop on the same 78 // CompleteStartSession() is called inside the message loop on the same
79 // thread. Protection for |wait_for_result_| is not needed. 79 // thread. Protection for |wait_for_result_| is not needed.
80 while (wait_for_result_) 80 while (wait_for_result_)
81 run_loop.RunUntilIdle(); 81 run_loop.RunUntilIdle();
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // Temporary until http://crbug.com/371230 is resolved. 258 // Temporary until http://crbug.com/371230 is resolved.
259 EXPECT_TRUE((result == MIDI_OK) || (result == MIDI_INITIALIZATION_ERROR)); 259 EXPECT_TRUE((result == MIDI_OK) || (result == MIDI_INITIALIZATION_ERROR));
260 #else 260 #else
261 EXPECT_EQ(MIDI_OK, result); 261 EXPECT_EQ(MIDI_OK, result);
262 #endif 262 #endif
263 } 263 }
264 264
265 } // namespace 265 } // namespace
266 266
267 } // namespace media 267 } // namespace media
OLDNEW
« no previous file with comments | « media/midi/midi_manager_mac.h ('k') | media/midi/midi_manager_usb.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698