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

Side by Side Diff: content/browser/renderer_host/media/audio_input_renderer_host_unittest.cc

Issue 2634263002: Pass camera facing info to audio client (Closed)
Patch Set: Pass VideoCaptureObserver as ctor parameter Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/renderer_host/media/audio_input_renderer_host.h" 5 #include "content/browser/renderer_host/media/audio_input_renderer_host.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/threading/thread_task_runner_handle.h" 14 #include "base/threading/thread_task_runner_handle.h"
15 #include "component/arc/video_facing.h"
15 #include "content/browser/bad_message.h" 16 #include "content/browser/bad_message.h"
16 #include "content/browser/media/capture/audio_mirroring_manager.h" 17 #include "content/browser/media/capture/audio_mirroring_manager.h"
17 #include "content/browser/renderer_host/media/audio_input_device_manager.h" 18 #include "content/browser/renderer_host/media/audio_input_device_manager.h"
18 #include "content/browser/renderer_host/media/media_stream_manager.h" 19 #include "content/browser/renderer_host/media/media_stream_manager.h"
19 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" 20 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h"
20 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
21 #include "content/public/common/content_switches.h" 22 #include "content/public/common/content_switches.h"
22 #include "content/public/test/mock_render_process_host.h" 23 #include "content/public/test/mock_render_process_host.h"
23 #include "content/public/test/test_browser_context.h" 24 #include "content/public/test/test_browser_context.h"
24 #include "content/public/test/test_browser_thread.h" 25 #include "content/public/test/test_browser_thread.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 EXPECT_GT(controller_list_.size(), i); 241 EXPECT_GT(controller_list_.size(), i);
241 return controller_list_[i].get(); 242 return controller_list_[i].get();
242 } 243 }
243 244
244 MOCK_METHOD0(ControllerCreated, void()); 245 MOCK_METHOD0(ControllerCreated, void());
245 246
246 private: 247 private:
247 std::vector<scoped_refptr<MockController>> controller_list_; 248 std::vector<scoped_refptr<MockController>> controller_list_;
248 }; 249 };
249 250
251 class MockVideoCaptureObserver : public component::VideoCaptureObserver {
252 public:
253 MOCK_METHOD1(OnVideoCaptureStarted, void(component::VideoFacingMode));
254 MOCK_METHOD1(OnVideoCaptureStopped, void(component::VideoFacingMode));
255 };
chfremer 2017/01/20 18:23:52 I count a total of 9 places where we have unit tes
shenghao 2017/01/24 12:52:01 Done.
256
250 } // namespace 257 } // namespace
251 258
252 class AudioInputRendererHostTest : public testing::Test { 259 class AudioInputRendererHostTest : public testing::Test {
253 public: 260 public:
254 AudioInputRendererHostTest() { 261 AudioInputRendererHostTest() {
255 base::CommandLine* flags = base::CommandLine::ForCurrentProcess(); 262 base::CommandLine* flags = base::CommandLine::ForCurrentProcess();
256 flags->AppendSwitch(switches::kUseFakeDeviceForMediaStream); 263 flags->AppendSwitch(switches::kUseFakeDeviceForMediaStream);
257 flags->AppendSwitch(switches::kUseFakeUIForMediaStream); 264 flags->AppendSwitch(switches::kUseFakeUIForMediaStream);
258 265
259 audio_manager_.reset(new media::FakeAudioManager( 266 audio_manager_.reset(new media::FakeAudioManager(
260 base::ThreadTaskRunnerHandle::Get(), 267 base::ThreadTaskRunnerHandle::Get(),
261 base::ThreadTaskRunnerHandle::Get(), &log_factory_)); 268 base::ThreadTaskRunnerHandle::Get(), &log_factory_));
262 media_stream_manager_ = 269 media_stream_manager_ =
263 base::MakeUnique<MediaStreamManager>(audio_manager_.get()); 270 base::MakeUnique<MediaStreamManager>(audio_manager_.get(),
271 new MockVideoCaptureObserver());
chfremer 2017/01/20 18:23:53 Since neither MediaStreamManager nor VideoCaptureM
shenghao 2017/01/24 12:52:00 Removed all the changes in tests.
264 airh_ = new AudioInputRendererHostWithInterception( 272 airh_ = new AudioInputRendererHostWithInterception(
265 kRenderProcessId, kRendererPid, media::AudioManager::Get(), 273 kRenderProcessId, kRendererPid, media::AudioManager::Get(),
266 media_stream_manager_.get(), AudioMirroringManager::GetInstance(), 274 media_stream_manager_.get(), AudioMirroringManager::GetInstance(),
267 nullptr, &renderer_); 275 nullptr, &renderer_);
268 } 276 }
269 277
270 ~AudioInputRendererHostTest() override { 278 ~AudioInputRendererHostTest() override {
271 airh_->OnChannelClosing(); 279 airh_->OnChannelClosing();
272 base::RunLoop().RunUntilIdle(); 280 base::RunLoop().RunUntilIdle();
273 } 281 }
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 EXPECT_CALL(controller_factory_, ControllerCreated()); 556 EXPECT_CALL(controller_factory_, ControllerCreated());
549 557
550 airh_->OnMessageReceived(AudioInputHostMsg_CreateStream( 558 airh_->OnMessageReceived(AudioInputHostMsg_CreateStream(
551 kStreamId, kRenderFrameId, session_id, DefaultConfig())); 559 kStreamId, kRenderFrameId, session_id, DefaultConfig()));
552 base::RunLoop().RunUntilIdle(); 560 base::RunLoop().RunUntilIdle();
553 561
554 EXPECT_CALL(*controller_factory_.controller(0), Close(_)); 562 EXPECT_CALL(*controller_factory_.controller(0), Close(_));
555 } 563 }
556 564
557 } // namespace content 565 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698