Index: media/video/capture/video_capture_device_unittest.cc |
diff --git a/media/video/capture/video_capture_device_unittest.cc b/media/video/capture/video_capture_device_unittest.cc |
index 7cb40bc27139fc7482867cb60c6ec10e685b0c7a..68a1d2cc3c763e4e5efdf7fc8200e3268e5ef9ca 100644 |
--- a/media/video/capture/video_capture_device_unittest.cc |
+++ b/media/video/capture/video_capture_device_unittest.cc |
@@ -8,9 +8,25 @@ |
#include "base/threading/thread.h" |
#include "media/video/capture/fake_video_capture_device.h" |
#include "media/video/capture/video_capture_device.h" |
+#include "media/video/capture/video_capture_device_unittest_helper.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
+#if defined(OS_MACOSX) |
+// The camera is 'locked' by the application once started on MAC OS X, not when |
dmac
2011/10/14 23:31:35
s/MAC/Mac/
mflodman_chromium_OOO
2011/10/16 21:58:38
Done.
|
+// allocated as for Windows and Linux, and this test case will fail. |
+#define MAYBE_AllocateSameCameraTwice DISABLED_AllocateSameCameraTwice |
+#else |
+#define MAYBE_AllocateSameCameraTwice AllocateSameCameraTwice |
+#endif |
+ |
+#if defined(OS_MACOSX) |
+// Mac/QTKit will always give you the size you ask for and this case will fail. |
+#define MAYBE_AllocateBadSize DISABLED_AllocateBadSize |
+#else |
+#define MAYBE_AllocateBadSize AllocateBadSize |
+#endif |
+ |
using ::testing::_; |
using ::testing::AnyNumber; |
using ::testing::Return; |
@@ -89,7 +105,8 @@ TEST_F(VideoCaptureDeviceTest, CaptureVGA) { |
device->Allocate(640, 480, 30, frame_observer_.get()); |
device->Start(); |
- // Wait for 3s or for captured frame. |
+ // Get captured video frames. |
+ ExecuteRunLoop(); |
dmac
2011/10/14 23:31:35
Have you considered using a MessageLoop (new Messa
mflodman_chromium_OOO
2011/10/16 21:58:38
I wasn't aware of the MessageLoopForUI, thanks for
|
EXPECT_TRUE(wait_event_.TimedWait(base::TimeDelta::FromMilliseconds( |
TestTimeouts::action_max_timeout_ms()))); |
device->Stop(); |
@@ -119,13 +136,14 @@ TEST_F(VideoCaptureDeviceTest, Capture720p) { |
device->Allocate(1280, 720, 30, frame_observer_.get()); |
device->Start(); |
// Get captured video frames. |
+ ExecuteRunLoop(); |
EXPECT_TRUE(wait_event_.TimedWait(base::TimeDelta::FromMilliseconds( |
TestTimeouts::action_max_timeout_ms()))); |
device->Stop(); |
device->DeAllocate(); |
} |
-TEST_F(VideoCaptureDeviceTest, AllocateSameCameraTwice) { |
+TEST_F(VideoCaptureDeviceTest, MAYBE_AllocateSameCameraTwice) { |
VideoCaptureDevice::GetDeviceNames(&names_); |
if (!names_.size()) { |
LOG(WARNING) << "No camera available. Exiting test."; |
@@ -152,7 +170,7 @@ TEST_F(VideoCaptureDeviceTest, AllocateSameCameraTwice) { |
device2->DeAllocate(); |
} |
-TEST_F(VideoCaptureDeviceTest, AllocateBadSize) { |
+TEST_F(VideoCaptureDeviceTest, MAYBE_AllocateBadSize) { |
VideoCaptureDevice::GetDeviceNames(&names_); |
if (!names_.size()) { |
LOG(WARNING) << "No camera available. Exiting test."; |
@@ -199,6 +217,7 @@ TEST_F(VideoCaptureDeviceTest, ReAllocateCamera) { |
device->Start(); |
// Get captured video frames. |
+ ExecuteRunLoop(); |
EXPECT_TRUE(wait_event_.TimedWait(base::TimeDelta::FromMilliseconds( |
TestTimeouts::action_max_timeout_ms()))); |
device->Stop(); |
@@ -224,6 +243,7 @@ TEST_F(VideoCaptureDeviceTest, DeAllocateCameraWhileRunning) { |
device->Start(); |
// Get captured video frames. |
+ ExecuteRunLoop(); |
EXPECT_TRUE(wait_event_.TimedWait(base::TimeDelta::FromMilliseconds( |
TestTimeouts::action_max_timeout_ms()))); |
device->DeAllocate(); |