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

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

Issue 2787703004: [Mojo Video Capture] Fix VideoCaptureManager exposing implementation details to clients (Closed)
Patch Set: Rebase to April 5 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.h ('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" 27 #include "media/capture/video/video_capture_system_impl.h"
28 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
29 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
30 30
31 using ::testing::_; 31 using ::testing::_;
32 using ::testing::AnyNumber; 32 using ::testing::AnyNumber;
33 using ::testing::DoAll; 33 using ::testing::DoAll;
34 using ::testing::InSequence; 34 using ::testing::InSequence;
35 using ::testing::InvokeWithoutArgs; 35 using ::testing::InvokeWithoutArgs;
36 using ::testing::Return; 36 using ::testing::Return;
37 using ::testing::SaveArg; 37 using ::testing::SaveArg;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 devices_ = std::move(devices); 193 devices_ = std::move(devices);
194 quit_closure.Run(); 194 quit_closure.Run();
195 } 195 }
196 196
197 protected: 197 protected:
198 void SetUp() override { 198 void SetUp() override {
199 listener_.reset(new MockMediaStreamProviderListener()); 199 listener_.reset(new MockMediaStreamProviderListener());
200 auto video_capture_device_factory = 200 auto video_capture_device_factory =
201 base::MakeUnique<WrappedDeviceFactory>(); 201 base::MakeUnique<WrappedDeviceFactory>();
202 video_capture_device_factory_ = video_capture_device_factory.get(); 202 video_capture_device_factory_ = video_capture_device_factory.get();
203 auto video_capture_system = base::MakeUnique<media::VideoCaptureSystem>( 203 auto video_capture_system = base::MakeUnique<media::VideoCaptureSystemImpl>(
204 std::move(video_capture_device_factory)); 204 std::move(video_capture_device_factory));
205 vcm_ = new VideoCaptureManager(std::move(video_capture_system), 205 vcm_ = new VideoCaptureManager(std::move(video_capture_system),
206 base::ThreadTaskRunnerHandle::Get()); 206 base::ThreadTaskRunnerHandle::Get());
207 const int32_t kNumberOfFakeDevices = 2; 207 const int32_t kNumberOfFakeDevices = 2;
208 video_capture_device_factory_->SetToDefaultDevicesConfig( 208 video_capture_device_factory_->SetToDefaultDevicesConfig(
209 kNumberOfFakeDevices); 209 kNumberOfFakeDevices);
210 vcm_->RegisterListener(listener_.get()); 210 vcm_->RegisterListener(listener_.get());
211 frame_observer_.reset(new MockFrameObserver()); 211 frame_observer_.reset(new MockFrameObserver());
212 212
213 base::RunLoop run_loop; 213 base::RunLoop run_loop;
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 // Wait to check callbacks before removing the listener. 787 // Wait to check callbacks before removing the listener.
788 base::RunLoop().RunUntilIdle(); 788 base::RunLoop().RunUntilIdle();
789 vcm_->UnregisterListener(listener_.get()); 789 vcm_->UnregisterListener(listener_.get());
790 } 790 }
791 #endif 791 #endif
792 792
793 // TODO(mcasas): Add a test to check consolidation of the supported formats 793 // TODO(mcasas): Add a test to check consolidation of the supported formats
794 // provided by the device when http://crbug.com/323913 is closed. 794 // provided by the device when http://crbug.com/323913 is closed.
795 795
796 } // namespace content 796 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_manager.h ('k') | media/capture/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698