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

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

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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.h" 5 #include "media/midi/midi_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 16 matching lines...) Expand all
27 ~FakeMidiManager() override {} 27 ~FakeMidiManager() override {}
28 28
29 // MidiManager implementation. 29 // MidiManager implementation.
30 void StartInitialization() override { 30 void StartInitialization() override {
31 start_initialization_is_called_ = true; 31 start_initialization_is_called_ = true;
32 } 32 }
33 33
34 void Finalize() override { finalize_is_called_ = true; } 34 void Finalize() override { finalize_is_called_ = true; }
35 35
36 void DispatchSendMidiData(MidiManagerClient* client, 36 void DispatchSendMidiData(MidiManagerClient* client,
37 uint32 port_index, 37 uint32_t port_index,
38 const std::vector<uint8>& data, 38 const std::vector<uint8_t>& data,
39 double timestamp) override {} 39 double timestamp) override {}
40 40
41 // Utility functions for testing. 41 // Utility functions for testing.
42 void CallCompleteInitialization(Result result) { 42 void CallCompleteInitialization(Result result) {
43 CompleteInitialization(result); 43 CompleteInitialization(result);
44 } 44 }
45 45
46 size_t GetClientCount() const { 46 size_t GetClientCount() const {
47 return clients_size_for_testing(); 47 return clients_size_for_testing();
48 } 48 }
(...skipping 11 matching lines...) Expand all
60 60
61 class FakeMidiManagerClient : public MidiManagerClient { 61 class FakeMidiManagerClient : public MidiManagerClient {
62 public: 62 public:
63 FakeMidiManagerClient() 63 FakeMidiManagerClient()
64 : result_(Result::NOT_SUPPORTED), wait_for_result_(true) {} 64 : result_(Result::NOT_SUPPORTED), wait_for_result_(true) {}
65 ~FakeMidiManagerClient() override {} 65 ~FakeMidiManagerClient() override {}
66 66
67 // MidiManagerClient implementation. 67 // MidiManagerClient implementation.
68 void AddInputPort(const MidiPortInfo& info) override {} 68 void AddInputPort(const MidiPortInfo& info) override {}
69 void AddOutputPort(const MidiPortInfo& info) override {} 69 void AddOutputPort(const MidiPortInfo& info) override {}
70 void SetInputPortState(uint32 port_index, MidiPortState state) override {} 70 void SetInputPortState(uint32_t port_index, MidiPortState state) override {}
71 void SetOutputPortState(uint32 port_index, MidiPortState state) override {} 71 void SetOutputPortState(uint32_t port_index, MidiPortState state) override {}
72 72
73 void CompleteStartSession(Result result) override { 73 void CompleteStartSession(Result result) override {
74 EXPECT_TRUE(wait_for_result_); 74 EXPECT_TRUE(wait_for_result_);
75 result_ = result; 75 result_ = result;
76 wait_for_result_ = false; 76 wait_for_result_ = false;
77 } 77 }
78 78
79 void ReceiveMidiData(uint32 port_index, 79 void ReceiveMidiData(uint32_t port_index,
80 const uint8* data, 80 const uint8_t* data,
81 size_t size, 81 size_t size,
82 double timestamp) override {} 82 double timestamp) override {}
83 void AccumulateMidiBytesSent(size_t size) override {} 83 void AccumulateMidiBytesSent(size_t size) override {}
84 void Detach() override {} 84 void Detach() override {}
85 85
86 Result result() const { return result_; } 86 Result result() const { return result_; }
87 87
88 Result WaitForResult() { 88 Result WaitForResult() {
89 while (wait_for_result_) { 89 while (wait_for_result_) {
90 base::RunLoop run_loop; 90 base::RunLoop run_loop;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 run_loop.RunUntilIdle(); 286 run_loop.RunUntilIdle();
287 } 287 }
288 288
289 // TODO(toyoshim): Add multi-threaded unit tests to check races around 289 // TODO(toyoshim): Add multi-threaded unit tests to check races around
290 // StartInitialization(), CompleteInitialization(), and Finalize(). 290 // StartInitialization(), CompleteInitialization(), and Finalize().
291 291
292 } // namespace 292 } // namespace
293 293
294 } // namespace midi 294 } // namespace midi
295 } // namespace media 295 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698