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

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

Issue 2214533002: move //media/capture to //device/capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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') | content/common/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 <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "content/browser/browser_thread_impl.h" 18 #include "content/browser/browser_thread_impl.h"
19 #include "content/browser/renderer_host/media/media_stream_provider.h" 19 #include "content/browser/renderer_host/media/media_stream_provider.h"
20 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h" 20 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h"
21 #include "content/common/media/media_stream_options.h" 21 #include "content/common/media/media_stream_options.h"
22 #include "media/capture/video/fake_video_capture_device_factory.h" 22 #include "device/capture/video/fake_video_capture_device_factory.h"
23 #include "testing/gmock/include/gmock/gmock.h" 23 #include "testing/gmock/include/gmock/gmock.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 25
26 using ::testing::_; 26 using ::testing::_;
27 using ::testing::AnyNumber; 27 using ::testing::AnyNumber;
28 using ::testing::DoAll; 28 using ::testing::DoAll;
29 using ::testing::InSequence; 29 using ::testing::InSequence;
30 using ::testing::InvokeWithoutArgs; 30 using ::testing::InvokeWithoutArgs;
31 using ::testing::Return; 31 using ::testing::Return;
32 using ::testing::SaveArg; 32 using ::testing::SaveArg;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 protected: 76 protected:
77 void SetUp() override { 77 void SetUp() override {
78 listener_.reset(new MockMediaStreamProviderListener()); 78 listener_.reset(new MockMediaStreamProviderListener());
79 message_loop_.reset(new base::MessageLoopForIO); 79 message_loop_.reset(new base::MessageLoopForIO);
80 ui_thread_.reset(new BrowserThreadImpl(BrowserThread::UI, 80 ui_thread_.reset(new BrowserThreadImpl(BrowserThread::UI,
81 message_loop_.get())); 81 message_loop_.get()));
82 io_thread_.reset(new BrowserThreadImpl(BrowserThread::IO, 82 io_thread_.reset(new BrowserThreadImpl(BrowserThread::IO,
83 message_loop_.get())); 83 message_loop_.get()));
84 vcm_ = new VideoCaptureManager( 84 vcm_ = new VideoCaptureManager(
85 std::unique_ptr<media::VideoCaptureDeviceFactory>( 85 std::unique_ptr<device::VideoCaptureDeviceFactory>(
86 new media::FakeVideoCaptureDeviceFactory())); 86 new device::FakeVideoCaptureDeviceFactory()));
87 video_capture_device_factory_ = 87 video_capture_device_factory_ =
88 static_cast<media::FakeVideoCaptureDeviceFactory*>( 88 static_cast<device::FakeVideoCaptureDeviceFactory*>(
89 vcm_->video_capture_device_factory()); 89 vcm_->video_capture_device_factory());
90 const int32_t kNumberOfFakeDevices = 2; 90 const int32_t kNumberOfFakeDevices = 2;
91 video_capture_device_factory_->set_number_of_devices(kNumberOfFakeDevices); 91 video_capture_device_factory_->set_number_of_devices(kNumberOfFakeDevices);
92 vcm_->Register(listener_.get(), message_loop_->task_runner().get()); 92 vcm_->Register(listener_.get(), message_loop_->task_runner().get());
93 frame_observer_.reset(new MockFrameObserver()); 93 frame_observer_.reset(new MockFrameObserver());
94 } 94 }
95 95
96 void TearDown() override {} 96 void TearDown() override {}
97 97
98 void OnGotControllerCallback( 98 void OnGotControllerCallback(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 #endif 166 #endif
167 167
168 int next_client_id_; 168 int next_client_id_;
169 std::map<VideoCaptureControllerID, VideoCaptureController*> controllers_; 169 std::map<VideoCaptureControllerID, VideoCaptureController*> controllers_;
170 scoped_refptr<VideoCaptureManager> vcm_; 170 scoped_refptr<VideoCaptureManager> vcm_;
171 std::unique_ptr<MockMediaStreamProviderListener> listener_; 171 std::unique_ptr<MockMediaStreamProviderListener> listener_;
172 std::unique_ptr<base::MessageLoop> message_loop_; 172 std::unique_ptr<base::MessageLoop> message_loop_;
173 std::unique_ptr<BrowserThreadImpl> ui_thread_; 173 std::unique_ptr<BrowserThreadImpl> ui_thread_;
174 std::unique_ptr<BrowserThreadImpl> io_thread_; 174 std::unique_ptr<BrowserThreadImpl> io_thread_;
175 std::unique_ptr<MockFrameObserver> frame_observer_; 175 std::unique_ptr<MockFrameObserver> frame_observer_;
176 media::FakeVideoCaptureDeviceFactory* video_capture_device_factory_; 176 device::FakeVideoCaptureDeviceFactory* video_capture_device_factory_;
177 177
178 private: 178 private:
179 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManagerTest); 179 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManagerTest);
180 }; 180 };
181 181
182 // Test cases 182 // Test cases
183 183
184 // Try to open, start, stop and close a device. 184 // Try to open, start, stop and close a device.
185 TEST_F(VideoCaptureManagerTest, CreateAndClose) { 185 TEST_F(VideoCaptureManagerTest, CreateAndClose) {
186 StreamDeviceInfoArray devices; 186 StreamDeviceInfoArray devices;
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 // Wait to check callbacks before removing the listener. 616 // Wait to check callbacks before removing the listener.
617 base::RunLoop().RunUntilIdle(); 617 base::RunLoop().RunUntilIdle();
618 vcm_->Unregister(); 618 vcm_->Unregister();
619 } 619 }
620 #endif 620 #endif
621 621
622 // TODO(mcasas): Add a test to check consolidation of the supported formats 622 // TODO(mcasas): Add a test to check consolidation of the supported formats
623 // provided by the device when http://crbug.com/323913 is closed. 623 // provided by the device when http://crbug.com/323913 is closed.
624 624
625 } // namespace content 625 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_manager.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698