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

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

Issue 2802553002: Revert of [Mojo Video Capture] Introduce abstraction VideoCaptureSystem (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 | « content/browser/renderer_host/media/video_capture_manager.cc ('k') | media/capture/BUILD.gn » ('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 // Unit test for VideoCaptureManager. 5 // Unit test for VideoCaptureManager.
6 6
7 #include "content/browser/renderer_host/media/video_capture_manager.h" 7 #include "content/browser/renderer_host/media/video_capture_manager.h"
8 8
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <algorithm> 11 #include <algorithm>
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/ptr_util.h" 18 #include "base/memory/ptr_util.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/run_loop.h" 20 #include "base/run_loop.h"
21 #include "base/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
22 #include "content/browser/renderer_host/media/media_stream_provider.h" 22 #include "content/browser/renderer_host/media/media_stream_provider.h"
23 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h" 23 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h"
24 #include "content/common/media/media_stream_options.h" 24 #include "content/common/media/media_stream_options.h"
25 #include "content/public/test/test_browser_thread_bundle.h" 25 #include "content/public/test/test_browser_thread_bundle.h"
26 #include "media/capture/video/fake_video_capture_device_factory.h" 26 #include "media/capture/video/fake_video_capture_device_factory.h"
27 #include "media/capture/video/video_capture_system.h"
28 #include "testing/gmock/include/gmock/gmock.h" 27 #include "testing/gmock/include/gmock/gmock.h"
29 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
30 29
31 using ::testing::_; 30 using ::testing::_;
32 using ::testing::AnyNumber; 31 using ::testing::AnyNumber;
33 using ::testing::DoAll; 32 using ::testing::DoAll;
34 using ::testing::InSequence; 33 using ::testing::InSequence;
35 using ::testing::InvokeWithoutArgs; 34 using ::testing::InvokeWithoutArgs;
36 using ::testing::Return; 35 using ::testing::Return;
37 using ::testing::SaveArg; 36 using ::testing::SaveArg;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 devices.emplace_back(MEDIA_DEVICE_VIDEO_CAPTURE, 189 devices.emplace_back(MEDIA_DEVICE_VIDEO_CAPTURE,
191 descriptor.GetNameAndModel(), descriptor.device_id); 190 descriptor.GetNameAndModel(), descriptor.device_id);
192 } 191 }
193 devices_ = std::move(devices); 192 devices_ = std::move(devices);
194 quit_closure.Run(); 193 quit_closure.Run();
195 } 194 }
196 195
197 protected: 196 protected:
198 void SetUp() override { 197 void SetUp() override {
199 listener_.reset(new MockMediaStreamProviderListener()); 198 listener_.reset(new MockMediaStreamProviderListener());
200 auto video_capture_device_factory = 199 vcm_ = new VideoCaptureManager(
201 base::MakeUnique<WrappedDeviceFactory>(); 200 std::unique_ptr<media::VideoCaptureDeviceFactory>(
202 video_capture_device_factory_ = video_capture_device_factory.get(); 201 new WrappedDeviceFactory()),
203 auto video_capture_system = base::MakeUnique<media::VideoCaptureSystem>( 202 base::ThreadTaskRunnerHandle::Get());
204 std::move(video_capture_device_factory)); 203 video_capture_device_factory_ = static_cast<WrappedDeviceFactory*>(
205 vcm_ = new VideoCaptureManager(std::move(video_capture_system), 204 vcm_->video_capture_device_factory());
206 base::ThreadTaskRunnerHandle::Get());
207 const int32_t kNumberOfFakeDevices = 2; 205 const int32_t kNumberOfFakeDevices = 2;
208 video_capture_device_factory_->SetToDefaultDevicesConfig( 206 video_capture_device_factory_->SetToDefaultDevicesConfig(
209 kNumberOfFakeDevices); 207 kNumberOfFakeDevices);
210 vcm_->RegisterListener(listener_.get()); 208 vcm_->RegisterListener(listener_.get());
211 frame_observer_.reset(new MockFrameObserver()); 209 frame_observer_.reset(new MockFrameObserver());
212 210
213 base::RunLoop run_loop; 211 base::RunLoop run_loop;
214 vcm_->EnumerateDevices( 212 vcm_->EnumerateDevices(
215 base::Bind(&VideoCaptureManagerTest::HandleEnumerationResult, 213 base::Bind(&VideoCaptureManagerTest::HandleEnumerationResult,
216 base::Unretained(this), run_loop.QuitClosure())); 214 base::Unretained(this), run_loop.QuitClosure()));
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 // Wait to check callbacks before removing the listener. 785 // Wait to check callbacks before removing the listener.
788 base::RunLoop().RunUntilIdle(); 786 base::RunLoop().RunUntilIdle();
789 vcm_->UnregisterListener(listener_.get()); 787 vcm_->UnregisterListener(listener_.get());
790 } 788 }
791 #endif 789 #endif
792 790
793 // TODO(mcasas): Add a test to check consolidation of the supported formats 791 // TODO(mcasas): Add a test to check consolidation of the supported formats
794 // provided by the device when http://crbug.com/323913 is closed. 792 // provided by the device when http://crbug.com/323913 is closed.
795 793
796 } // namespace content 794 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_manager.cc ('k') | media/capture/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698