OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/media/capture/desktop_capture_device.h" | 5 #include "content/browser/media/capture/desktop_capture_device.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/sequenced_task_runner.h" | 8 #include "base/sequenced_task_runner.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 }; | 134 }; |
135 | 135 |
136 } // namespace | 136 } // namespace |
137 | 137 |
138 class DesktopCaptureDeviceTest : public testing::Test { | 138 class DesktopCaptureDeviceTest : public testing::Test { |
139 public: | 139 public: |
140 virtual void SetUp() OVERRIDE { | 140 virtual void SetUp() OVERRIDE { |
141 worker_pool_ = new base::SequencedWorkerPool(3, "TestCaptureThread"); | 141 worker_pool_ = new base::SequencedWorkerPool(3, "TestCaptureThread"); |
142 } | 142 } |
143 | 143 |
144 virtual void TearDown() OVERRIDE { | |
145 worker_pool_->Shutdown(); | |
146 message_loop_.RunUntilIdle(); | |
147 } | |
148 | |
144 void CreateScreenCaptureDevice(scoped_ptr<webrtc::DesktopCapturer> capturer) { | 149 void CreateScreenCaptureDevice(scoped_ptr<webrtc::DesktopCapturer> capturer) { |
145 capture_device_.reset(new DesktopCaptureDevice( | 150 capture_device_.reset(new DesktopCaptureDevice( |
146 worker_pool_->GetSequencedTaskRunner(worker_pool_->GetSequenceToken()), | 151 worker_pool_->GetSequencedTaskRunner(worker_pool_->GetSequenceToken()), |
147 thread_.Pass(), | 152 thread_.Pass(), |
148 capturer.Pass(), | 153 capturer.Pass(), |
149 DesktopMediaID::TYPE_SCREEN)); | 154 DesktopMediaID::TYPE_SCREEN)); |
150 } | 155 } |
151 | 156 |
152 protected: | 157 protected: |
158 base::MessageLoop message_loop_; | |
Ryan Sleevi
2014/07/21 18:43:32
Out of curiousity, does this use any //content Bro
Sergey Ulanov
2014/07/22 00:08:22
DesktopCaptureDevice::Create() does use BrowserThr
| |
159 | |
153 scoped_refptr<base::SequencedWorkerPool> worker_pool_; | 160 scoped_refptr<base::SequencedWorkerPool> worker_pool_; |
154 scoped_ptr<base::Thread> thread_; | 161 scoped_ptr<base::Thread> thread_; |
155 scoped_ptr<DesktopCaptureDevice> capture_device_; | 162 scoped_ptr<DesktopCaptureDevice> capture_device_; |
156 }; | 163 }; |
157 | 164 |
158 // There is currently no screen capturer implementation for ozone. So disable | 165 // There is currently no screen capturer implementation for ozone. So disable |
159 // the test that uses a real screen-capturer instead of FakeScreenCapturer. | 166 // the test that uses a real screen-capturer instead of FakeScreenCapturer. |
160 // http://crbug.com/260318 | 167 // http://crbug.com/260318 |
161 #if defined(USE_OZONE) | 168 #if defined(USE_OZONE) |
162 #define MAYBE_Capture DISABLED_Capture | 169 #define MAYBE_Capture DISABLED_Capture |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
280 capture_device_->StopAndDeAllocate(); | 287 capture_device_->StopAndDeAllocate(); |
281 | 288 |
282 EXPECT_EQ(kTestFrameWidth1, format.frame_size.width()); | 289 EXPECT_EQ(kTestFrameWidth1, format.frame_size.width()); |
283 EXPECT_EQ(kTestFrameHeight1, format.frame_size.height()); | 290 EXPECT_EQ(kTestFrameHeight1, format.frame_size.height()); |
284 EXPECT_EQ(kFrameRate, format.frame_rate); | 291 EXPECT_EQ(kFrameRate, format.frame_rate); |
285 EXPECT_EQ(media::PIXEL_FORMAT_ARGB, format.pixel_format); | 292 EXPECT_EQ(media::PIXEL_FORMAT_ARGB, format.pixel_format); |
286 worker_pool_->FlushForTesting(); | 293 worker_pool_->FlushForTesting(); |
287 } | 294 } |
288 | 295 |
289 } // namespace content | 296 } // namespace content |
OLD | NEW |