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

Side by Side Diff: media/audio/audio_output_controller_unittest.cc

Issue 2517503003: Reland: Make more media APIs aware of |delay| and |delay_timestamp| (Closed)
Patch Set: Comments from chcunningham@ and Dale Created 4 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
« no previous file with comments | « media/audio/audio_output_controller.cc ('k') | media/audio/audio_output_device.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/audio/audio_output_controller.h" 5 #include "media/audio/audio_output_controller.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 private: 56 private:
57 DISALLOW_COPY_AND_ASSIGN(MockAudioOutputControllerEventHandler); 57 DISALLOW_COPY_AND_ASSIGN(MockAudioOutputControllerEventHandler);
58 }; 58 };
59 59
60 class MockAudioOutputControllerSyncReader 60 class MockAudioOutputControllerSyncReader
61 : public AudioOutputController::SyncReader { 61 : public AudioOutputController::SyncReader {
62 public: 62 public:
63 MockAudioOutputControllerSyncReader() {} 63 MockAudioOutputControllerSyncReader() {}
64 64
65 MOCK_METHOD2(UpdatePendingBytes, 65 MOCK_METHOD3(RequestMoreData,
66 void(uint32_t bytes, uint32_t frames_skipped)); 66 void(base::TimeDelta delay,
67 base::TimeTicks delay_timestamp,
68 int prior_frames_skipped));
67 MOCK_METHOD1(Read, void(AudioBus* dest)); 69 MOCK_METHOD1(Read, void(AudioBus* dest));
68 MOCK_METHOD0(Close, void()); 70 MOCK_METHOD0(Close, void());
69 71
70 private: 72 private:
71 DISALLOW_COPY_AND_ASSIGN(MockAudioOutputControllerSyncReader); 73 DISALLOW_COPY_AND_ASSIGN(MockAudioOutputControllerSyncReader);
72 }; 74 };
73 75
74 class MockAudioOutputStream : public AudioOutputStream { 76 class MockAudioOutputStream : public AudioOutputStream {
75 public: 77 public:
76 MOCK_METHOD0(Open, bool()); 78 MOCK_METHOD0(Open, bool());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 EXPECT_EQ(params_.IsValid(), controller_.get() != NULL); 137 EXPECT_EQ(params_.IsValid(), controller_.get() != NULL);
136 base::RunLoop().RunUntilIdle(); 138 base::RunLoop().RunUntilIdle();
137 } 139 }
138 140
139 void Play() { 141 void Play() {
140 // Expect the event handler to receive one OnPlaying() call. 142 // Expect the event handler to receive one OnPlaying() call.
141 EXPECT_CALL(mock_event_handler_, OnPlaying()); 143 EXPECT_CALL(mock_event_handler_, OnPlaying());
142 144
143 // During playback, the mock pretends to provide audio data rendered and 145 // During playback, the mock pretends to provide audio data rendered and
144 // sent from the render process. 146 // sent from the render process.
145 EXPECT_CALL(mock_sync_reader_, UpdatePendingBytes(_, _)).Times(AtLeast(1)); 147 EXPECT_CALL(mock_sync_reader_, RequestMoreData(_, _, _)).Times(AtLeast(1));
146 EXPECT_CALL(mock_sync_reader_, Read(_)).WillRepeatedly(PopulateBuffer()); 148 EXPECT_CALL(mock_sync_reader_, Read(_)).WillRepeatedly(PopulateBuffer());
147 controller_->Play(); 149 controller_->Play();
148 base::RunLoop().RunUntilIdle(); 150 base::RunLoop().RunUntilIdle();
149 } 151 }
150 152
151 void Pause() { 153 void Pause() {
152 // Expect the event handler to receive one OnPaused() call. 154 // Expect the event handler to receive one OnPaused() call.
153 EXPECT_CALL(mock_event_handler_, OnPaused()); 155 EXPECT_CALL(mock_event_handler_, OnPaused());
154 156
155 controller_->Pause(); 157 controller_->Pause();
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 // Switching device would trigger a read, and in turn it would trigger a push 431 // Switching device would trigger a read, and in turn it would trigger a push
430 // to sink. 432 // to sink.
431 EXPECT_CALL(mock_sink, OnDataCheck(kBufferNonZeroData)); 433 EXPECT_CALL(mock_sink, OnDataCheck(kBufferNonZeroData));
432 SwitchDevice(false); 434 SwitchDevice(false);
433 435
434 StopDuplicating(&mock_sink); 436 StopDuplicating(&mock_sink);
435 Close(); 437 Close();
436 } 438 }
437 439
438 } // namespace media 440 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_output_controller.cc ('k') | media/audio/audio_output_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698