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

Side by Side Diff: content/browser/media/capture/web_contents_audio_input_stream_unittest.cc

Issue 2689483006: Switch browser side audio capture path to use base time primitives. (Closed)
Patch Set: Bloop Created 3 years, 10 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/media/capture/web_contents_audio_input_stream.h" 5 #include "content/browser/media/capture/web_contents_audio_input_stream.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <list> 9 #include <list>
10 #include <memory> 10 #include <memory>
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 VirtualAudioInputStream real_; 161 VirtualAudioInputStream real_;
162 bool real_stream_is_closed_; 162 bool real_stream_is_closed_;
163 163
164 DISALLOW_COPY_AND_ASSIGN(MockVirtualAudioInputStream); 164 DISALLOW_COPY_AND_ASSIGN(MockVirtualAudioInputStream);
165 }; 165 };
166 166
167 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { 167 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback {
168 public: 168 public:
169 MockAudioInputCallback() {} 169 MockAudioInputCallback() {}
170 170
171 MOCK_METHOD4(OnData, 171 MOCK_METHOD5(OnData,
172 void(AudioInputStream* stream, 172 void(AudioInputStream* stream,
173 const media::AudioBus* src, 173 const media::AudioBus* src,
174 uint32_t hardware_delay_bytes, 174 base::TimeDelta delay,
175 base::TimeTicks delay_timestamp,
175 double volume)); 176 double volume));
176 MOCK_METHOD1(OnError, void(AudioInputStream* stream)); 177 MOCK_METHOD1(OnError, void(AudioInputStream* stream));
177 178
178 private: 179 private:
179 DISALLOW_COPY_AND_ASSIGN(MockAudioInputCallback); 180 DISALLOW_COPY_AND_ASSIGN(MockAudioInputCallback);
180 }; 181 };
181 182
182 } // namespace 183 } // namespace
183 184
184 class WebContentsAudioInputStreamTest : public testing::TestWithParam<bool> { 185 class WebContentsAudioInputStreamTest : public testing::TestWithParam<bool> {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 EXPECT_CALL(*mock_mirroring_manager_, StartMirroring(NotNull())) 248 EXPECT_CALL(*mock_mirroring_manager_, StartMirroring(NotNull()))
248 .WillOnce(SaveArg<0>(&destination_)) 249 .WillOnce(SaveArg<0>(&destination_))
249 .RetiresOnSaturation(); 250 .RetiresOnSaturation();
250 // At Stop() time, or when the mirroring target changes: 251 // At Stop() time, or when the mirroring target changes:
251 EXPECT_CALL(*mock_mirroring_manager_, StopMirroring(NotNull())) 252 EXPECT_CALL(*mock_mirroring_manager_, StopMirroring(NotNull()))
252 .WillOnce(Assign( 253 .WillOnce(Assign(
253 &destination_, 254 &destination_,
254 static_cast<AudioMirroringManager::MirroringDestination*>(NULL))) 255 static_cast<AudioMirroringManager::MirroringDestination*>(NULL)))
255 .RetiresOnSaturation(); 256 .RetiresOnSaturation();
256 257
257 EXPECT_CALL(mock_input_callback_, OnData(NotNull(), NotNull(), _, _)) 258 EXPECT_CALL(mock_input_callback_, OnData(NotNull(), NotNull(), _, _, _))
258 .WillRepeatedly( 259 .WillRepeatedly(
259 InvokeWithoutArgs(&on_data_event_, &base::WaitableEvent::Signal)); 260 InvokeWithoutArgs(&on_data_event_, &base::WaitableEvent::Signal));
260 261
261 wcais_->Start(&mock_input_callback_); 262 wcais_->Start(&mock_input_callback_);
262 263
263 // Test plumbing of volume controls and automatic gain controls. Calls to 264 // Test plumbing of volume controls and automatic gain controls. Calls to
264 // wcais_ methods should delegate directly to mock_vais_. 265 // wcais_ methods should delegate directly to mock_vais_.
265 EXPECT_CALL(*mock_vais_, GetVolume()); 266 EXPECT_CALL(*mock_vais_, GetVolume());
266 double volume = wcais_->GetVolume(); 267 double volume = wcais_->GetVolume();
267 EXPECT_CALL(*mock_vais_, GetMaxVolume()); 268 EXPECT_CALL(*mock_vais_, GetMaxVolume());
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 WaitForData(); 540 WaitForData();
540 RUN_ON_AUDIO_THREAD(ChangeMirroringTarget); 541 RUN_ON_AUDIO_THREAD(ChangeMirroringTarget);
541 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); 542 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder);
542 RUN_ON_AUDIO_THREAD(Stop); 543 RUN_ON_AUDIO_THREAD(Stop);
543 RUN_ON_AUDIO_THREAD(Close); 544 RUN_ON_AUDIO_THREAD(Close);
544 } 545 }
545 546
546 INSTANTIATE_TEST_CASE_P(, WebContentsAudioInputStreamTest, ::testing::Bool()); 547 INSTANTIATE_TEST_CASE_P(, WebContentsAudioInputStreamTest, ::testing::Bool());
547 548
548 } // namespace content 549 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698