OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/capture/video/fake_video_capture_device.h" | 5 #include "media/capture/video/fake_video_capture_device.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 private: | 132 private: |
133 friend class base::RefCounted<DeviceEnumerationListener>; | 133 friend class base::RefCounted<DeviceEnumerationListener>; |
134 virtual ~DeviceEnumerationListener() {} | 134 virtual ~DeviceEnumerationListener() {} |
135 }; | 135 }; |
136 | 136 |
137 class PhotoTakenListener : public base::RefCounted<PhotoTakenListener> { | 137 class PhotoTakenListener : public base::RefCounted<PhotoTakenListener> { |
138 public: | 138 public: |
139 MOCK_METHOD0(OnCorrectPhotoTaken, void(void)); | 139 MOCK_METHOD0(OnCorrectPhotoTaken, void(void)); |
140 // GMock doesn't support move-only arguments, so we use this forward method. | 140 // GMock doesn't support move-only arguments, so we use this forward method. |
141 void DoOnPhotoTaken(const mojo::String& mime_type, | 141 void DoOnPhotoTaken(mojo::String mime_type, mojo::Array<uint8_t> data) { |
142 mojo::Array<uint8_t> data) { | |
143 // Only PNG images are supported right now. | 142 // Only PNG images are supported right now. |
144 EXPECT_STREQ("image/png", mime_type.storage().c_str()); | 143 EXPECT_STREQ("image/png", mime_type.storage().c_str()); |
145 // Not worth decoding the incoming data. Just check that the header is PNG. | 144 // Not worth decoding the incoming data. Just check that the header is PNG. |
146 // http://www.libpng.org/pub/png/spec/1.2/PNG-Rationale.html#R.PNG-file-sign
ature | 145 // http://www.libpng.org/pub/png/spec/1.2/PNG-Rationale.html#R.PNG-file-sign
ature |
147 ASSERT_GT(data.size(), 4u); | 146 ASSERT_GT(data.size(), 4u); |
148 EXPECT_EQ('P', data[1]); | 147 EXPECT_EQ('P', data[1]); |
149 EXPECT_EQ('N', data[2]); | 148 EXPECT_EQ('N', data[2]); |
150 EXPECT_EQ('G', data[3]); | 149 EXPECT_EQ('G', data[3]); |
151 OnCorrectPhotoTaken(); | 150 OnCorrectPhotoTaken(); |
152 } | 151 } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 } | 325 } |
327 } | 326 } |
328 | 327 |
329 INSTANTIATE_TEST_CASE_P(, | 328 INSTANTIATE_TEST_CASE_P(, |
330 FakeVideoCaptureDeviceCommandLineTest, | 329 FakeVideoCaptureDeviceCommandLineTest, |
331 Values(CommandLineTestData{"fps=-1", 5}, | 330 Values(CommandLineTestData{"fps=-1", 5}, |
332 CommandLineTestData{"fps=29.97", 29.97f}, | 331 CommandLineTestData{"fps=29.97", 29.97f}, |
333 CommandLineTestData{"fps=60", 60}, | 332 CommandLineTestData{"fps=60", 60}, |
334 CommandLineTestData{"fps=1000", 60})); | 333 CommandLineTestData{"fps=1000", 60})); |
335 }; // namespace media | 334 }; // namespace media |
OLD | NEW |