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

Unified Diff: content/browser/media/capture/desktop_capture_device_unittest.cc

Issue 404613007: Fix DesktopCaptureDeviceTest to shutdown worker pool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/capture/desktop_capture_device_unittest.cc
diff --git a/content/browser/media/capture/desktop_capture_device_unittest.cc b/content/browser/media/capture/desktop_capture_device_unittest.cc
index 0c1a360e2923a54142d95e17a3823a83db1789b1..9bcc74e06d6ba4b437162db146b6afc6de2263c5 100644
--- a/content/browser/media/capture/desktop_capture_device_unittest.cc
+++ b/content/browser/media/capture/desktop_capture_device_unittest.cc
@@ -11,6 +11,8 @@
#include "base/threading/sequenced_worker_pool.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
@@ -137,21 +139,18 @@ class FakeScreenCapturer : public webrtc::ScreenCapturer {
class DesktopCaptureDeviceTest : public testing::Test {
public:
- virtual void SetUp() OVERRIDE {
- worker_pool_ = new base::SequencedWorkerPool(3, "TestCaptureThread");
- }
-
void CreateScreenCaptureDevice(scoped_ptr<webrtc::DesktopCapturer> capturer) {
+ scoped_refptr<base::SequencedWorkerPool> worker_pool =
+ BrowserThread::GetBlockingPool();
capture_device_.reset(new DesktopCaptureDevice(
- worker_pool_->GetSequencedTaskRunner(worker_pool_->GetSequenceToken()),
- thread_.Pass(),
+ worker_pool->GetSequencedTaskRunner(worker_pool->GetSequenceToken()),
+ scoped_ptr<base::Thread>(),
capturer.Pass(),
DesktopMediaID::TYPE_SCREEN));
}
protected:
- scoped_refptr<base::SequencedWorkerPool> worker_pool_;
- scoped_ptr<base::Thread> thread_;
+ TestBrowserThreadBundle thread_bundle_;
scoped_ptr<DesktopCaptureDevice> capture_device_;
};
@@ -195,7 +194,7 @@ TEST_F(DesktopCaptureDeviceTest, MAYBE_Capture) {
EXPECT_EQ(media::PIXEL_FORMAT_ARGB, format.pixel_format);
EXPECT_EQ(format.frame_size.GetArea() * 4, frame_size);
- worker_pool_->FlushForTesting();
+ BrowserThread::GetBlockingPool()->FlushForTesting();
}
// Test that screen capturer behaves correctly if the source frame size changes
@@ -240,7 +239,7 @@ TEST_F(DesktopCaptureDeviceTest, ScreenResolutionChangeConstantResolution) {
EXPECT_EQ(media::PIXEL_FORMAT_ARGB, format.pixel_format);
EXPECT_EQ(format.frame_size.GetArea() * 4, frame_size);
- worker_pool_->FlushForTesting();
+ BrowserThread::GetBlockingPool()->FlushForTesting();
}
// Test that screen capturer behaves correctly if the source frame size changes
@@ -283,7 +282,7 @@ TEST_F(DesktopCaptureDeviceTest, ScreenResolutionChangeVariableResolution) {
EXPECT_EQ(kTestFrameHeight1, format.frame_size.height());
EXPECT_EQ(kFrameRate, format.frame_rate);
EXPECT_EQ(media::PIXEL_FORMAT_ARGB, format.pixel_format);
- worker_pool_->FlushForTesting();
+ BrowserThread::GetBlockingPool()->FlushForTesting();
}
} // namespace content
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698