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

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

Issue 2800493002: [Mojo Video Capture] Create abstraction VideoCaptureProvider (Closed)
Patch Set: Incorporated suggestions from PatchSet 2 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
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/media_devices_manager.h" 5 #include "content/browser/renderer_host/media/media_devices_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/threading/thread_task_runner_handle.h" 15 #include "base/threading/thread_task_runner_handle.h"
16 #include "content/browser/renderer_host/media/in_process_video_capture_provider. h"
16 #include "content/browser/renderer_host/media/video_capture_manager.h" 17 #include "content/browser/renderer_host/media/video_capture_manager.h"
17 #include "content/public/test/test_browser_thread_bundle.h" 18 #include "content/public/test/test_browser_thread_bundle.h"
18 #include "media/audio/audio_device_name.h" 19 #include "media/audio/audio_device_name.h"
19 #include "media/audio/audio_system_impl.h" 20 #include "media/audio/audio_system_impl.h"
20 #include "media/audio/fake_audio_log_factory.h" 21 #include "media/audio/fake_audio_log_factory.h"
21 #include "media/audio/fake_audio_manager.h" 22 #include "media/audio/fake_audio_manager.h"
22 #include "media/capture/video/fake_video_capture_device_factory.h" 23 #include "media/capture/video/fake_video_capture_device_factory.h"
23 #include "media/capture/video/video_capture_system_impl.h" 24 #include "media/capture/video/video_capture_system_impl.h"
24 #include "testing/gmock/include/gmock/gmock.h" 25 #include "testing/gmock/include/gmock/gmock.h"
25 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 142
142 protected: 143 protected:
143 void SetUp() override { 144 void SetUp() override {
144 audio_manager_.reset(new MockAudioManager()); 145 audio_manager_.reset(new MockAudioManager());
145 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); 146 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get());
146 auto video_capture_device_factory = 147 auto video_capture_device_factory =
147 base::MakeUnique<MockVideoCaptureDeviceFactory>(); 148 base::MakeUnique<MockVideoCaptureDeviceFactory>();
148 video_capture_device_factory_ = video_capture_device_factory.get(); 149 video_capture_device_factory_ = video_capture_device_factory.get();
149 auto video_capture_system = base::MakeUnique<media::VideoCaptureSystemImpl>( 150 auto video_capture_system = base::MakeUnique<media::VideoCaptureSystemImpl>(
150 std::move(video_capture_device_factory)); 151 std::move(video_capture_device_factory));
151 video_capture_manager_ = new VideoCaptureManager( 152 auto video_capture_provider =
152 std::move(video_capture_system), base::ThreadTaskRunnerHandle::Get()); 153 base::MakeUnique<InProcessVideoCaptureProvider>(
154 std::move(video_capture_system),
155 base::ThreadTaskRunnerHandle::Get());
156 video_capture_manager_ =
157 new VideoCaptureManager(std::move(video_capture_provider));
153 media_devices_manager_.reset(new MediaDevicesManager( 158 media_devices_manager_.reset(new MediaDevicesManager(
154 audio_system_.get(), video_capture_manager_, nullptr)); 159 audio_system_.get(), video_capture_manager_, nullptr));
155 } 160 }
156 161
157 void EnableCache(MediaDeviceType type) { 162 void EnableCache(MediaDeviceType type) {
158 media_devices_manager_->SetCachePolicy( 163 media_devices_manager_->SetCachePolicy(
159 type, MediaDevicesManager::CachePolicy::SYSTEM_MONITOR); 164 type, MediaDevicesManager::CachePolicy::SYSTEM_MONITOR);
160 } 165 }
161 166
162 // Must outlive MediaDevicesManager as ~MediaDevicesManager() verifies it's 167 // Must outlive MediaDevicesManager as ~MediaDevicesManager() verifies it's
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 media_devices_manager_->OnDevicesChanged(base::SystemMonitor::DEVTYPE_AUDIO); 576 media_devices_manager_->OnDevicesChanged(base::SystemMonitor::DEVTYPE_AUDIO);
572 media_devices_manager_->OnDevicesChanged( 577 media_devices_manager_->OnDevicesChanged(
573 base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE); 578 base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE);
574 base::RunLoop().RunUntilIdle(); 579 base::RunLoop().RunUntilIdle();
575 EXPECT_EQ(num_audio_input_devices, notification_all_audio_input.size()); 580 EXPECT_EQ(num_audio_input_devices, notification_all_audio_input.size());
576 EXPECT_EQ(num_video_input_devices, notification_all_video_input.size()); 581 EXPECT_EQ(num_video_input_devices, notification_all_video_input.size());
577 EXPECT_EQ(num_audio_output_devices, notification_all_audio_output.size()); 582 EXPECT_EQ(num_audio_output_devices, notification_all_audio_output.size());
578 } 583 }
579 584
580 } // namespace content 585 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698