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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 MOCK_METHOD1(OnGetPhotoCapabilitiesFailure, | 144 MOCK_METHOD1(OnGetPhotoCapabilitiesFailure, |
145 void(const base::Callback<void(mojom::PhotoCapabilitiesPtr)>&)); | 145 void(const base::Callback<void(mojom::PhotoCapabilitiesPtr)>&)); |
146 | 146 |
147 const mojom::PhotoCapabilities* capabilities() { return capabilities_.get(); } | 147 const mojom::PhotoCapabilities* capabilities() { return capabilities_.get(); } |
148 | 148 |
149 MOCK_METHOD1(OnCorrectSetPhotoOptions, void(bool)); | 149 MOCK_METHOD1(OnCorrectSetPhotoOptions, void(bool)); |
150 MOCK_METHOD1(OnSetPhotoOptionsFailure, | 150 MOCK_METHOD1(OnSetPhotoOptionsFailure, |
151 void(const base::Callback<void(bool)>&)); | 151 void(const base::Callback<void(bool)>&)); |
152 | 152 |
153 // GMock doesn't support move-only arguments, so we use this forward method. | 153 // GMock doesn't support move-only arguments, so we use this forward method. |
154 void DoOnPhotoTaken(const std::string& mime_type, | 154 void DoOnPhotoTaken(mojom::BlobPtr blob) { |
155 const std::vector<uint8_t>& data) { | |
156 // Only PNG images are supported right now. | 155 // Only PNG images are supported right now. |
157 EXPECT_STREQ("image/png", mime_type.c_str()); | 156 EXPECT_STREQ("image/png", blob->mime_type.c_str()); |
158 // Not worth decoding the incoming data. Just check that the header is PNG. | 157 // Not worth decoding the incoming data. Just check that the header is PNG. |
159 // http://www.libpng.org/pub/png/spec/1.2/PNG-Rationale.html#R.PNG-file-sign
ature | 158 // http://www.libpng.org/pub/png/spec/1.2/PNG-Rationale.html#R.PNG-file-sign
ature |
160 ASSERT_GT(data.size(), 4u); | 159 ASSERT_GT(blob->data.size(), 4u); |
161 EXPECT_EQ('P', data[1]); | 160 EXPECT_EQ('P', blob->data[1]); |
162 EXPECT_EQ('N', data[2]); | 161 EXPECT_EQ('N', blob->data[2]); |
163 EXPECT_EQ('G', data[3]); | 162 EXPECT_EQ('G', blob->data[3]); |
164 OnCorrectPhotoTaken(); | 163 OnCorrectPhotoTaken(); |
165 } | 164 } |
166 MOCK_METHOD0(OnCorrectPhotoTaken, void(void)); | 165 MOCK_METHOD0(OnCorrectPhotoTaken, void(void)); |
167 MOCK_METHOD1(OnTakePhotoFailure, | 166 MOCK_METHOD1(OnTakePhotoFailure, |
168 void(const base::Callback<void(const std::string&, | 167 void(const base::Callback<void(mojom::BlobPtr)>&)); |
169 const std::vector<uint8_t>&)>&)); | |
170 | 168 |
171 private: | 169 private: |
172 friend class base::RefCounted<ImageCaptureClient>; | 170 friend class base::RefCounted<ImageCaptureClient>; |
173 virtual ~ImageCaptureClient() {} | 171 virtual ~ImageCaptureClient() {} |
174 | 172 |
175 mojom::PhotoCapabilitiesPtr capabilities_; | 173 mojom::PhotoCapabilitiesPtr capabilities_; |
176 }; | 174 }; |
177 | 175 |
178 } // namespace | 176 } // namespace |
179 | 177 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 } | 418 } |
421 } | 419 } |
422 | 420 |
423 INSTANTIATE_TEST_CASE_P(, | 421 INSTANTIATE_TEST_CASE_P(, |
424 FakeVideoCaptureDeviceCommandLineTest, | 422 FakeVideoCaptureDeviceCommandLineTest, |
425 Values(CommandLineTestData{"fps=-1", 5}, | 423 Values(CommandLineTestData{"fps=-1", 5}, |
426 CommandLineTestData{"fps=29.97", 29.97f}, | 424 CommandLineTestData{"fps=29.97", 29.97f}, |
427 CommandLineTestData{"fps=60", 60}, | 425 CommandLineTestData{"fps=60", 60}, |
428 CommandLineTestData{"fps=1000", 60})); | 426 CommandLineTestData{"fps=1000", 60})); |
429 }; // namespace media | 427 }; // namespace media |
OLD | NEW |