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 #import <Foundation/Foundation.h> | 5 #import <Foundation/Foundation.h> |
6 #import <ImageCaptureCore/ImageCaptureCore.h> | 6 #import <ImageCaptureCore/ImageCaptureCore.h> |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 namespace storage_monitor { | 198 namespace storage_monitor { |
199 | 199 |
200 class TestCameraListener | 200 class TestCameraListener |
201 : public ImageCaptureDeviceListener, | 201 : public ImageCaptureDeviceListener, |
202 public base::SupportsWeakPtr<TestCameraListener> { | 202 public base::SupportsWeakPtr<TestCameraListener> { |
203 public: | 203 public: |
204 TestCameraListener() | 204 TestCameraListener() |
205 : completed_(false), | 205 : completed_(false), |
206 removed_(false), | 206 removed_(false), |
207 last_error_(base::File::FILE_ERROR_INVALID_URL) {} | 207 last_error_(base::File::FILE_ERROR_INVALID_URL) {} |
208 virtual ~TestCameraListener() {} | 208 ~TestCameraListener() override {} |
209 | 209 |
210 virtual void ItemAdded(const std::string& name, | 210 void ItemAdded(const std::string& name, |
211 const base::File::Info& info) override { | 211 const base::File::Info& info) override { |
212 items_.push_back(name); | 212 items_.push_back(name); |
213 } | 213 } |
214 | 214 |
215 virtual void NoMoreItems() override { | 215 void NoMoreItems() override { completed_ = true; } |
216 completed_ = true; | |
217 } | |
218 | 216 |
219 virtual void DownloadedFile(const std::string& name, | 217 void DownloadedFile(const std::string& name, |
220 base::File::Error error) override { | 218 base::File::Error error) override { |
221 EXPECT_TRUE(content::BrowserThread::CurrentlyOn( | 219 EXPECT_TRUE(content::BrowserThread::CurrentlyOn( |
222 content::BrowserThread::UI)); | 220 content::BrowserThread::UI)); |
223 downloads_.push_back(name); | 221 downloads_.push_back(name); |
224 last_error_ = error; | 222 last_error_ = error; |
225 } | 223 } |
226 | 224 |
227 virtual void DeviceRemoved() override { | 225 void DeviceRemoved() override { removed_ = true; } |
228 removed_ = true; | |
229 } | |
230 | 226 |
231 std::vector<std::string> items() const { return items_; } | 227 std::vector<std::string> items() const { return items_; } |
232 std::vector<std::string> downloads() const { return downloads_; } | 228 std::vector<std::string> downloads() const { return downloads_; } |
233 bool completed() const { return completed_; } | 229 bool completed() const { return completed_; } |
234 bool removed() const { return removed_; } | 230 bool removed() const { return removed_; } |
235 base::File::Error last_error() const { return last_error_; } | 231 base::File::Error last_error() const { return last_error_; } |
236 | 232 |
237 private: | 233 private: |
238 std::vector<std::string> items_; | 234 std::vector<std::string> items_; |
239 std::vector<std::string> downloads_; | 235 std::vector<std::string> downloads_; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 char file_contents[5]; | 413 char file_contents[5]; |
418 ASSERT_EQ(4, base::ReadFile(temp_file, file_contents, | 414 ASSERT_EQ(4, base::ReadFile(temp_file, file_contents, |
419 strlen(kTestFileContents))); | 415 strlen(kTestFileContents))); |
420 EXPECT_EQ(kTestFileContents, | 416 EXPECT_EQ(kTestFileContents, |
421 std::string(file_contents, strlen(kTestFileContents))); | 417 std::string(file_contents, strlen(kTestFileContents))); |
422 | 418 |
423 [camera didRemoveDevice:device]; | 419 [camera didRemoveDevice:device]; |
424 } | 420 } |
425 | 421 |
426 } // namespace storage_monitor | 422 } // namespace storage_monitor |
OLD | NEW |