| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "content/renderer/media/video_capture_impl.h" | 6 #include "content/renderer/media/video_capture_impl.h" |
| 7 #include "testing/gmock/include/gmock/gmock.h" | 7 #include "testing/gmock/include/gmock/gmock.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 using ::testing::_; | 10 using ::testing::_; |
| 11 using ::testing::Return; | 11 using ::testing::Return; |
| 12 | 12 |
| 13 #define DEFAULT_CAPABILITY {176, 144, 30, 0, media::VideoFrame::I420, \ | 13 #define DEFAULT_CAPABILITY {176, 144, 30, 0, media::VideoFrame::I420, \ |
| 14 false, false } | 14 false, false } |
| 15 | 15 |
| 16 ACTION(DeleteMessage) { | 16 ACTION(DeleteMessage) { |
| 17 delete arg0; | 17 delete arg0; |
| 18 } | 18 } |
| 19 | 19 |
| 20 class MockVideoCaptureMessageFilter : public VideoCaptureMessageFilter { | 20 class MockVideoCaptureMessageFilter : public VideoCaptureMessageFilter { |
| 21 public: | 21 public: |
| 22 MockVideoCaptureMessageFilter() : VideoCaptureMessageFilter(1) {} | 22 MockVideoCaptureMessageFilter() : VideoCaptureMessageFilter() {} |
| 23 virtual ~MockVideoCaptureMessageFilter() {} | 23 virtual ~MockVideoCaptureMessageFilter() {} |
| 24 | 24 |
| 25 // Filter implementation. | 25 // Filter implementation. |
| 26 MOCK_METHOD1(Send, bool(IPC::Message* message)); | 26 MOCK_METHOD1(Send, bool(IPC::Message* message)); |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 DISALLOW_COPY_AND_ASSIGN(MockVideoCaptureMessageFilter); | 29 DISALLOW_COPY_AND_ASSIGN(MockVideoCaptureMessageFilter); |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 class MockVideoCaptureClient : public media::VideoCapture::EventHandler { | 32 class MockVideoCaptureClient : public media::VideoCapture::EventHandler { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 video_capture_impl_->StartCapture(client.get(), capability); | 109 video_capture_impl_->StartCapture(client.get(), capability); |
| 110 message_loop_->RunAllPending(); | 110 message_loop_->RunAllPending(); |
| 111 | 111 |
| 112 EXPECT_CALL(*client, OnStopped(_)) | 112 EXPECT_CALL(*client, OnStopped(_)) |
| 113 .WillOnce(Return()); | 113 .WillOnce(Return()); |
| 114 | 114 |
| 115 video_capture_impl_->StopCapture(client.get()); | 115 video_capture_impl_->StopCapture(client.get()); |
| 116 message_loop_->RunAllPending(); | 116 message_loop_->RunAllPending(); |
| 117 } | 117 } |
| OLD | NEW |