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::_; |
(...skipping 16 matching lines...) Expand all Loading... |
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 { |
33 public: | 33 public: |
34 MockVideoCaptureClient() {} | 34 MockVideoCaptureClient() {} |
35 virtual ~MockVideoCaptureClient() {} | 35 virtual ~MockVideoCaptureClient() {} |
36 | 36 |
37 // Filter implementation. | 37 // EventHandler implementation. |
38 MOCK_METHOD1(OnStarted, void(media::VideoCapture* capture)); | 38 MOCK_METHOD1(OnStarted, void(media::VideoCapture* capture)); |
39 MOCK_METHOD1(OnStopped, void(media::VideoCapture* capture)); | 39 MOCK_METHOD1(OnStopped, void(media::VideoCapture* capture)); |
40 MOCK_METHOD1(OnPaused, void(media::VideoCapture* capture)); | 40 MOCK_METHOD1(OnPaused, void(media::VideoCapture* capture)); |
41 MOCK_METHOD2(OnError, void(media::VideoCapture* capture, int error_code)); | 41 MOCK_METHOD2(OnError, void(media::VideoCapture* capture, int error_code)); |
| 42 MOCK_METHOD1(OnRemoved, void(media::VideoCapture* capture)); |
42 MOCK_METHOD2(OnBufferReady, | 43 MOCK_METHOD2(OnBufferReady, |
43 void(media::VideoCapture* capture, | 44 void(media::VideoCapture* capture, |
44 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf)); | 45 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf)); |
45 MOCK_METHOD2(OnDeviceInfoReceived, | 46 MOCK_METHOD2(OnDeviceInfoReceived, |
46 void(media::VideoCapture* capture, | 47 void(media::VideoCapture* capture, |
47 const media::VideoCaptureParams& device_info)); | 48 const media::VideoCaptureParams& device_info)); |
48 | 49 |
49 private: | 50 private: |
50 DISALLOW_COPY_AND_ASSIGN(MockVideoCaptureClient); | 51 DISALLOW_COPY_AND_ASSIGN(MockVideoCaptureClient); |
51 }; | 52 }; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 109 |
109 video_capture_impl_->StartCapture(client.get(), capability); | 110 video_capture_impl_->StartCapture(client.get(), capability); |
110 message_loop_->RunAllPending(); | 111 message_loop_->RunAllPending(); |
111 | 112 |
112 EXPECT_CALL(*client, OnStopped(_)) | 113 EXPECT_CALL(*client, OnStopped(_)) |
113 .WillOnce(Return()); | 114 .WillOnce(Return()); |
114 | 115 |
115 video_capture_impl_->StopCapture(client.get()); | 116 video_capture_impl_->StopCapture(client.get()); |
116 message_loop_->RunAllPending(); | 117 message_loop_->RunAllPending(); |
117 } | 118 } |
OLD | NEW |