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

Side by Side Diff: media/base/audio_renderer_mixer_input_unittest.cc

Issue 2801823002: Use ScopedTaskEnvironment instead of MessageLoop in media unit tests. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | media/base/media_url_demuxer_unittest.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 <stddef.h> 5 #include <stddef.h>
6 #include <memory> 6 #include <memory>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/test/scoped_task_environment.h"
12 #include "media/base/audio_latency.h" 13 #include "media/base/audio_latency.h"
13 #include "media/base/audio_renderer_mixer.h" 14 #include "media/base/audio_renderer_mixer.h"
14 #include "media/base/audio_renderer_mixer_input.h" 15 #include "media/base/audio_renderer_mixer_input.h"
15 #include "media/base/audio_renderer_mixer_pool.h" 16 #include "media/base/audio_renderer_mixer_pool.h"
16 #include "media/base/fake_audio_render_callback.h" 17 #include "media/base/fake_audio_render_callback.h"
17 #include "media/base/mock_audio_renderer_sink.h" 18 #include "media/base/mock_audio_renderer_sink.h"
18 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 21
21 namespace { 22 namespace {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 void SwitchCallback(base::RunLoop* loop, OutputDeviceStatus result) { 118 void SwitchCallback(base::RunLoop* loop, OutputDeviceStatus result) {
118 SwitchCallbackCalled(result); 119 SwitchCallbackCalled(result);
119 loop->Quit(); 120 loop->Quit();
120 } 121 }
121 122
122 AudioRendererMixer* GetInputMixer() { return mixer_input_->mixer_; } 123 AudioRendererMixer* GetInputMixer() { return mixer_input_->mixer_; }
123 124
124 protected: 125 protected:
125 virtual ~AudioRendererMixerInputTest() {} 126 virtual ~AudioRendererMixerInputTest() {}
126 127
127 base::MessageLoop message_loop_; 128 base::test::ScopedTaskEnvironment scoped_task_environment_;
128 AudioParameters audio_parameters_; 129 AudioParameters audio_parameters_;
129 scoped_refptr<MockAudioRendererSink> sinks_[2]; 130 scoped_refptr<MockAudioRendererSink> sinks_[2];
130 std::unique_ptr<AudioRendererMixer> mixers_[2]; 131 std::unique_ptr<AudioRendererMixer> mixers_[2];
131 scoped_refptr<AudioRendererMixerInput> mixer_input_; 132 scoped_refptr<AudioRendererMixerInput> mixer_input_;
132 std::unique_ptr<FakeAudioRenderCallback> fake_callback_; 133 std::unique_ptr<FakeAudioRenderCallback> fake_callback_;
133 std::unique_ptr<AudioBus> audio_bus_; 134 std::unique_ptr<AudioBus> audio_bus_;
134 135
135 private: 136 private:
136 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInputTest); 137 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInputTest);
137 }; 138 };
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 base::Bind(&AudioRendererMixerInputTest::SwitchCallback, 398 base::Bind(&AudioRendererMixerInputTest::SwitchCallback,
398 base::Unretained(this), &run_loop)); 399 base::Unretained(this), &run_loop));
399 run_loop.Run(); 400 run_loop.Run();
400 401
401 mixer_input_->Initialize(audio_parameters_, fake_callback_.get()); 402 mixer_input_->Initialize(audio_parameters_, fake_callback_.get());
402 mixer_input_->Start(); 403 mixer_input_->Start();
403 mixer_input_->Stop(); 404 mixer_input_->Stop();
404 } 405 }
405 406
406 } // namespace media 407 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/base/media_url_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698