OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "media/video/capture/screen/screen_capture_device.h" | 5 #include "media/video/capture/screen/screen_capture_device.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/sequenced_task_runner.h" | 8 #include "base/sequenced_task_runner.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 frames_[1] = new ScreenCaptureData( | 60 frames_[1] = new ScreenCaptureData( |
61 buffer_.get(), kTestFrameWidth2 * ScreenCaptureData::kBytesPerPixel, | 61 buffer_.get(), kTestFrameWidth2 * ScreenCaptureData::kBytesPerPixel, |
62 SkISize::Make(kTestFrameWidth2, kTestFrameHeight2)); | 62 SkISize::Make(kTestFrameWidth2, kTestFrameHeight2)); |
63 } | 63 } |
64 virtual ~FakeScreenCapturer() {} | 64 virtual ~FakeScreenCapturer() {} |
65 | 65 |
66 // VideoFrameCapturer interface. | 66 // VideoFrameCapturer interface. |
67 virtual void Start(Delegate* delegate) OVERRIDE { | 67 virtual void Start(Delegate* delegate) OVERRIDE { |
68 delegate_ = delegate; | 68 delegate_ = delegate; |
69 } | 69 } |
70 virtual void Stop() OVERRIDE { | |
71 delegate_ = NULL; | |
72 } | |
73 virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE { | |
74 NOTIMPLEMENTED(); | |
75 } | |
76 virtual void CaptureFrame() OVERRIDE { | 70 virtual void CaptureFrame() OVERRIDE { |
77 scoped_refptr<ScreenCaptureData> frame = | 71 scoped_refptr<ScreenCaptureData> frame = |
78 frames_[frame_index_ % arraysize(frames_)]; | 72 frames_[frame_index_ % arraysize(frames_)]; |
79 frame_index_++; | 73 frame_index_++; |
80 delegate_->OnCaptureCompleted(frame); | 74 delegate_->OnCaptureCompleted(frame); |
81 } | 75 } |
82 | 76 |
83 private: | 77 private: |
84 Delegate* delegate_; | 78 Delegate* delegate_; |
85 scoped_ptr<uint8[]> buffer_; | 79 scoped_ptr<uint8[]> buffer_; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 EXPECT_EQ(kTestFrameWidth1, caps.width); | 161 EXPECT_EQ(kTestFrameWidth1, caps.width); |
168 EXPECT_EQ(kTestFrameHeight1, caps.height); | 162 EXPECT_EQ(kTestFrameHeight1, caps.height); |
169 EXPECT_EQ(kFrameRate, caps.frame_rate); | 163 EXPECT_EQ(kFrameRate, caps.frame_rate); |
170 EXPECT_EQ(VideoCaptureCapability::kARGB, caps.color); | 164 EXPECT_EQ(VideoCaptureCapability::kARGB, caps.color); |
171 EXPECT_FALSE(caps.interlaced); | 165 EXPECT_FALSE(caps.interlaced); |
172 | 166 |
173 EXPECT_EQ(caps.width * caps.height * 4, frame_size); | 167 EXPECT_EQ(caps.width * caps.height * 4, frame_size); |
174 } | 168 } |
175 | 169 |
176 } // namespace media | 170 } // namespace media |
OLD | NEW |