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

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

Issue 661163004: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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 <string> 5 #include <string>
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "media/audio/audio_manager.h" 9 #include "media/audio/audio_manager.h"
10 #include "media/audio/audio_manager_base.h" 10 #include "media/audio/audio_manager_base.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 MOCK_METHOD1(OnError, void(AudioOutputStream* stream)); 131 MOCK_METHOD1(OnError, void(AudioOutputStream* stream));
132 }; 132 };
133 133
134 } // namespace 134 } // namespace
135 135
136 namespace media { 136 namespace media {
137 137
138 class AudioOutputProxyTest : public testing::Test { 138 class AudioOutputProxyTest : public testing::Test {
139 protected: 139 protected:
140 virtual void SetUp() { 140 void SetUp() override {
141 EXPECT_CALL(manager_, GetTaskRunner()) 141 EXPECT_CALL(manager_, GetTaskRunner())
142 .WillRepeatedly(Return(message_loop_.message_loop_proxy())); 142 .WillRepeatedly(Return(message_loop_.message_loop_proxy()));
143 EXPECT_CALL(manager_, GetWorkerTaskRunner()) 143 EXPECT_CALL(manager_, GetWorkerTaskRunner())
144 .WillRepeatedly(Return(message_loop_.message_loop_proxy())); 144 .WillRepeatedly(Return(message_loop_.message_loop_proxy()));
145 // Use a low sample rate and large buffer size when testing otherwise the 145 // Use a low sample rate and large buffer size when testing otherwise the
146 // FakeAudioOutputStream will keep the message loop busy indefinitely; i.e., 146 // FakeAudioOutputStream will keep the message loop busy indefinitely; i.e.,
147 // RunUntilIdle() will never terminate. 147 // RunUntilIdle() will never terminate.
148 params_ = AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, 148 params_ = AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
149 CHANNEL_LAYOUT_STEREO, 8000, 16, 2048); 149 CHANNEL_LAYOUT_STEREO, 8000, 16, 2048);
150 InitDispatcher(base::TimeDelta::FromMilliseconds(kTestCloseDelayMs)); 150 InitDispatcher(base::TimeDelta::FromMilliseconds(kTestCloseDelayMs));
151 } 151 }
152 152
153 virtual void TearDown() { 153 void TearDown() override {
154 // This is necessary to free all proxy objects that have been 154 // This is necessary to free all proxy objects that have been
155 // closed by the test. 155 // closed by the test.
156 message_loop_.RunUntilIdle(); 156 message_loop_.RunUntilIdle();
157 } 157 }
158 158
159 virtual void InitDispatcher(base::TimeDelta close_delay) { 159 virtual void InitDispatcher(base::TimeDelta close_delay) {
160 dispatcher_impl_ = new AudioOutputDispatcherImpl(&manager(), 160 dispatcher_impl_ = new AudioOutputDispatcherImpl(&manager(),
161 params_, 161 params_,
162 std::string(), 162 std::string(),
163 close_delay); 163 close_delay);
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 406
407 base::MessageLoop message_loop_; 407 base::MessageLoop message_loop_;
408 scoped_refptr<AudioOutputDispatcherImpl> dispatcher_impl_; 408 scoped_refptr<AudioOutputDispatcherImpl> dispatcher_impl_;
409 MockAudioManager manager_; 409 MockAudioManager manager_;
410 MockAudioSourceCallback callback_; 410 MockAudioSourceCallback callback_;
411 AudioParameters params_; 411 AudioParameters params_;
412 }; 412 };
413 413
414 class AudioOutputResamplerTest : public AudioOutputProxyTest { 414 class AudioOutputResamplerTest : public AudioOutputProxyTest {
415 public: 415 public:
416 virtual void TearDown() { 416 void TearDown() override { AudioOutputProxyTest::TearDown(); }
417 AudioOutputProxyTest::TearDown();
418 }
419 417
420 void InitDispatcher(base::TimeDelta close_delay) override { 418 void InitDispatcher(base::TimeDelta close_delay) override {
421 // Use a low sample rate and large buffer size when testing otherwise the 419 // Use a low sample rate and large buffer size when testing otherwise the
422 // FakeAudioOutputStream will keep the message loop busy indefinitely; i.e., 420 // FakeAudioOutputStream will keep the message loop busy indefinitely; i.e.,
423 // RunUntilIdle() will never terminate. 421 // RunUntilIdle() will never terminate.
424 resampler_params_ = AudioParameters( 422 resampler_params_ = AudioParameters(
425 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, 423 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO,
426 16000, 16, 1024); 424 16000, 16, 1024);
427 resampler_ = new AudioOutputResampler( 425 resampler_ = new AudioOutputResampler(
428 &manager(), params_, resampler_params_, std::string(), close_delay); 426 &manager(), params_, resampler_params_, std::string(), close_delay);
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 proxy1->Stop(); 668 proxy1->Stop();
671 CloseAndWaitForCloseTimer(proxy1, &stream1); 669 CloseAndWaitForCloseTimer(proxy1, &stream1);
672 670
673 EXPECT_TRUE(stream1.stop_called()); 671 EXPECT_TRUE(stream1.stop_called());
674 EXPECT_TRUE(stream1.start_called()); 672 EXPECT_TRUE(stream1.start_called());
675 EXPECT_TRUE(stream2.stop_called()); 673 EXPECT_TRUE(stream2.stop_called());
676 EXPECT_TRUE(stream2.start_called()); 674 EXPECT_TRUE(stream2.start_called());
677 } 675 }
678 676
679 } // namespace media 677 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_output_controller_unittest.cc ('k') | media/audio/fake_audio_consumer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698