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

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

Issue 2471733004: Revert of Make more media APIs aware of |delay| and |delay_timestamp| (Closed)
Patch Set: Created 4 years, 1 month 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_METHOD3(RequestMoreData, 65 MOCK_METHOD2(UpdatePendingBytes,
66 void(base::TimeDelta delay, 66 void(uint32_t bytes, uint32_t frames_skipped));
67 base::TimeTicks delay_timestamp,
68 int prior_frames_skipped));
69 MOCK_METHOD1(Read, void(AudioBus* dest)); 67 MOCK_METHOD1(Read, void(AudioBus* dest));
70 MOCK_METHOD0(Close, void()); 68 MOCK_METHOD0(Close, void());
71 69
72 private: 70 private:
73 DISALLOW_COPY_AND_ASSIGN(MockAudioOutputControllerSyncReader); 71 DISALLOW_COPY_AND_ASSIGN(MockAudioOutputControllerSyncReader);
74 }; 72 };
75 73
76 class MockAudioOutputStream : public AudioOutputStream { 74 class MockAudioOutputStream : public AudioOutputStream {
77 public: 75 public:
78 MOCK_METHOD0(Open, bool()); 76 MOCK_METHOD0(Open, bool());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 EXPECT_EQ(params_.IsValid(), controller_.get() != NULL); 135 EXPECT_EQ(params_.IsValid(), controller_.get() != NULL);
138 base::RunLoop().RunUntilIdle(); 136 base::RunLoop().RunUntilIdle();
139 } 137 }
140 138
141 void Play() { 139 void Play() {
142 // Expect the event handler to receive one OnPlaying() call. 140 // Expect the event handler to receive one OnPlaying() call.
143 EXPECT_CALL(mock_event_handler_, OnPlaying()); 141 EXPECT_CALL(mock_event_handler_, OnPlaying());
144 142
145 // During playback, the mock pretends to provide audio data rendered and 143 // During playback, the mock pretends to provide audio data rendered and
146 // sent from the render process. 144 // sent from the render process.
147 EXPECT_CALL(mock_sync_reader_, RequestMoreData(_, _, _)).Times(AtLeast(1)); 145 EXPECT_CALL(mock_sync_reader_, UpdatePendingBytes(_, _)).Times(AtLeast(1));
148 EXPECT_CALL(mock_sync_reader_, Read(_)).WillRepeatedly(PopulateBuffer()); 146 EXPECT_CALL(mock_sync_reader_, Read(_)).WillRepeatedly(PopulateBuffer());
149 controller_->Play(); 147 controller_->Play();
150 base::RunLoop().RunUntilIdle(); 148 base::RunLoop().RunUntilIdle();
151 } 149 }
152 150
153 void Pause() { 151 void Pause() {
154 // Expect the event handler to receive one OnPaused() call. 152 // Expect the event handler to receive one OnPaused() call.
155 EXPECT_CALL(mock_event_handler_, OnPaused()); 153 EXPECT_CALL(mock_event_handler_, OnPaused());
156 154
157 controller_->Pause(); 155 controller_->Pause();
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 // Switching device would trigger a read, and in turn it would trigger a push 429 // Switching device would trigger a read, and in turn it would trigger a push
432 // to sink. 430 // to sink.
433 EXPECT_CALL(mock_sink, OnDataCheck(kBufferNonZeroData)); 431 EXPECT_CALL(mock_sink, OnDataCheck(kBufferNonZeroData));
434 SwitchDevice(false); 432 SwitchDevice(false);
435 433
436 StopDuplicating(&mock_sink); 434 StopDuplicating(&mock_sink);
437 Close(); 435 Close();
438 } 436 }
439 437
440 } // namespace media 438 } // 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