OLD | NEW |
---|---|
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. |
Ami GONE FROM CHROMIUM
2013/01/28 23:55:47
Is there a layouttest or some other JS-driven test
wjia(left Chromium)
2013/01/30 18:25:47
There is a layout test for media stream(platform/c
| |
4 | 4 |
5 #include "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "media/video/capture/fake_video_capture_device.h" | 10 #include "media/video/capture/fake_video_capture_device.h" |
11 #include "media/video/capture/video_capture_device.h" | 11 #include "media/video/capture/video_capture_device.h" |
12 #include "media/video/capture/video_capture_types.h" | 12 #include "media/video/capture/video_capture_types.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 #if defined(OS_WIN) | 16 #if defined(OS_WIN) |
17 #include "base/win/scoped_com_initializer.h" | 17 #include "base/win/scoped_com_initializer.h" |
18 #endif | 18 #endif |
19 | 19 |
20 #if defined(OS_ANDROID) | |
21 #include "base/android/jni_android.h" | |
22 #include "media/video/capture/android/video_capture_device_android.h" | |
23 #endif | |
24 | |
20 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
21 // Mac/QTKit will always give you the size you ask for and this case will fail. | 26 // Mac/QTKit will always give you the size you ask for and this case will fail. |
22 #define MAYBE_AllocateBadSize DISABLED_AllocateBadSize | 27 #define MAYBE_AllocateBadSize DISABLED_AllocateBadSize |
23 // We will always get ARGB from the Mac/QTKit implementation. | 28 // We will always get ARGB from the Mac/QTKit implementation. |
24 #define MAYBE_CaptureMjpeg DISABLED_CaptureMjpeg | 29 #define MAYBE_CaptureMjpeg DISABLED_CaptureMjpeg |
25 #elif defined(OS_WIN) | 30 #elif defined(OS_WIN) |
26 #define MAYBE_AllocateBadSize AllocateBadSize | 31 #define MAYBE_AllocateBadSize AllocateBadSize |
27 // Windows currently uses DirectShow to convert from MJPEG and a raw format is | 32 // Windows currently uses DirectShow to convert from MJPEG and a raw format is |
28 // always delivered. | 33 // always delivered. |
29 #define MAYBE_CaptureMjpeg DISABLED_CaptureMjpeg | 34 #define MAYBE_CaptureMjpeg DISABLED_CaptureMjpeg |
35 #elif defined(OS_ANDROID) | |
36 // TODO(wjia): enable those tests on Android. | |
Ami GONE FROM CHROMIUM
2013/01/28 23:55:47
Do you want to enumerate here the reasons why each
wjia(left Chromium)
2013/01/30 18:25:47
Added comments on the reason why these tests can't
| |
37 #define CaptureVGA DISABLED_CaptureVGA | |
38 #define Capture720p DISABLED_Capture720p | |
39 #define MAYBE_AllocateBadSize DISABLED_AllocateBadSize | |
40 #define ReAllocateCamera DISABLED_ReAllocateCamera | |
41 #define DeAllocateCameraWhileRunning DISABLED_DeAllocateCameraWhileRunning | |
42 #define DeAllocateCameraWhileRunning DISABLED_DeAllocateCameraWhileRunning | |
43 #define MAYBE_CaptureMjpeg DISABLED_CaptureMjpeg | |
30 #else | 44 #else |
31 #define MAYBE_AllocateBadSize AllocateBadSize | 45 #define MAYBE_AllocateBadSize AllocateBadSize |
32 #define MAYBE_CaptureMjpeg CaptureMjpeg | 46 #define MAYBE_CaptureMjpeg CaptureMjpeg |
33 #endif | 47 #endif |
34 | 48 |
35 using ::testing::_; | 49 using ::testing::_; |
36 using ::testing::AnyNumber; | 50 using ::testing::AnyNumber; |
37 using ::testing::Return; | 51 using ::testing::Return; |
38 using ::testing::AtLeast; | 52 using ::testing::AtLeast; |
39 | 53 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 | 86 |
73 void PostQuitTask() { | 87 void PostQuitTask() { |
74 loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 88 loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
75 loop_->Run(); | 89 loop_->Run(); |
76 } | 90 } |
77 | 91 |
78 protected: | 92 protected: |
79 virtual void SetUp() { | 93 virtual void SetUp() { |
80 frame_observer_.reset(new MockFrameObserver(&wait_event_)); | 94 frame_observer_.reset(new MockFrameObserver(&wait_event_)); |
81 loop_.reset(new MessageLoopForUI()); | 95 loop_.reset(new MessageLoopForUI()); |
96 #if defined(OS_ANDROID) | |
97 media::VideoCaptureDeviceAndroid::RegisterVideoCaptureDevice( | |
98 base::android::AttachCurrentThread()); | |
99 #endif | |
82 } | 100 } |
83 | 101 |
84 virtual void TearDown() { | 102 virtual void TearDown() { |
85 } | 103 } |
86 | 104 |
87 #if defined(OS_WIN) | 105 #if defined(OS_WIN) |
88 base::win::ScopedCOMInitializer initialize_com_; | 106 base::win::ScopedCOMInitializer initialize_com_; |
89 #endif | 107 #endif |
90 base::WaitableEvent wait_event_; | 108 base::WaitableEvent wait_event_; |
91 scoped_ptr<MockFrameObserver> frame_observer_; | 109 scoped_ptr<MockFrameObserver> frame_observer_; |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 device->Allocate(1280, 720, 30, frame_observer_.get()); | 299 device->Allocate(1280, 720, 30, frame_observer_.get()); |
282 | 300 |
283 device->Start(); | 301 device->Start(); |
284 // Get captured video frames. | 302 // Get captured video frames. |
285 PostQuitTask(); | 303 PostQuitTask(); |
286 EXPECT_TRUE(wait_event_.TimedWait(TestTimeouts::action_max_timeout())); | 304 EXPECT_TRUE(wait_event_.TimedWait(TestTimeouts::action_max_timeout())); |
287 device->DeAllocate(); | 305 device->DeAllocate(); |
288 } | 306 } |
289 | 307 |
290 }; // namespace media | 308 }; // namespace media |
OLD | NEW |