OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_TEST_UTILS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_TEST_UTILS_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_TEST_UTILS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_TEST_UTILS_H_ |
7 | 7 |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
58 // A fake for the DiskMountManager that will successfully call the unmount | 58 // A fake for the DiskMountManager that will successfully call the unmount |
59 // callback. | 59 // callback. |
60 class FakeDiskMountManager : public chromeos::disks::MockDiskMountManager { | 60 class FakeDiskMountManager : public chromeos::disks::MockDiskMountManager { |
61 public: | 61 public: |
62 FakeDiskMountManager(); | 62 FakeDiskMountManager(); |
63 virtual ~FakeDiskMountManager(); | 63 virtual ~FakeDiskMountManager(); |
64 | 64 |
65 virtual void UnmountDeviceRecursively( | 65 virtual void UnmountDeviceRecursively( |
66 const std::string& device_path, | 66 const std::string& device_path, |
67 const UnmountDeviceRecursivelyCallbackType& callback) OVERRIDE; | 67 const UnmountDeviceRecursivelyCallbackType& callback) override; |
68 | 68 |
69 private: | 69 private: |
70 DiskMap disks_; | 70 DiskMap disks_; |
71 }; | 71 }; |
72 #endif | 72 #endif |
73 | 73 |
74 class FakeImageWriterClient : public ImageWriterUtilityClient { | 74 class FakeImageWriterClient : public ImageWriterUtilityClient { |
75 public: | 75 public: |
76 FakeImageWriterClient(); | 76 FakeImageWriterClient(); |
77 | 77 |
78 virtual void Write(const ProgressCallback& progress_callback, | 78 virtual void Write(const ProgressCallback& progress_callback, |
79 const SuccessCallback& success_callback, | 79 const SuccessCallback& success_callback, |
80 const ErrorCallback& error_callback, | 80 const ErrorCallback& error_callback, |
81 const base::FilePath& source, | 81 const base::FilePath& source, |
82 const base::FilePath& target) OVERRIDE; | 82 const base::FilePath& target) override; |
83 | 83 |
84 virtual void Verify(const ProgressCallback& progress_callback, | 84 virtual void Verify(const ProgressCallback& progress_callback, |
85 const SuccessCallback& success_callback, | 85 const SuccessCallback& success_callback, |
86 const ErrorCallback& error_callback, | 86 const ErrorCallback& error_callback, |
87 const base::FilePath& source, | 87 const base::FilePath& source, |
88 const base::FilePath& target) OVERRIDE; | 88 const base::FilePath& target) override; |
89 | 89 |
90 virtual void Cancel(const CancelCallback& cancel_callback) OVERRIDE; | 90 virtual void Cancel(const CancelCallback& cancel_callback) override; |
91 | 91 |
92 virtual void Shutdown() OVERRIDE; | 92 virtual void Shutdown() override; |
93 | 93 |
94 // Sets a callback for when a Write call is made. | 94 // Sets a callback for when a Write call is made. |
95 void SetWriteCallback(const base::Closure& write_callback); | 95 void SetWriteCallback(const base::Closure& write_callback); |
96 // Sets a callback for when a Verify call is made. | 96 // Sets a callback for when a Verify call is made. |
97 void SetVerifyCallback(const base::Closure& verify_callback); | 97 void SetVerifyCallback(const base::Closure& verify_callback); |
98 | 98 |
99 // Triggers the progress callback. | 99 // Triggers the progress callback. |
100 void Progress(int64 progress); | 100 void Progress(int64 progress); |
101 // Triggers the success callback. | 101 // Triggers the success callback. |
102 void Success(); | 102 void Success(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 scoped_refptr<FakeImageWriterClient> client_; | 162 scoped_refptr<FakeImageWriterClient> client_; |
163 #endif | 163 #endif |
164 }; | 164 }; |
165 | 165 |
166 // Base class for unit tests that manages creating image and device files. | 166 // Base class for unit tests that manages creating image and device files. |
167 class ImageWriterUnitTestBase : public testing::Test { | 167 class ImageWriterUnitTestBase : public testing::Test { |
168 protected: | 168 protected: |
169 ImageWriterUnitTestBase(); | 169 ImageWriterUnitTestBase(); |
170 virtual ~ImageWriterUnitTestBase(); | 170 virtual ~ImageWriterUnitTestBase(); |
171 | 171 |
172 virtual void SetUp() OVERRIDE; | 172 virtual void SetUp() override; |
173 virtual void TearDown() OVERRIDE; | 173 virtual void TearDown() override; |
174 | 174 |
175 ImageWriterTestUtils test_utils_; | 175 ImageWriterTestUtils test_utils_; |
176 | 176 |
177 private: | 177 private: |
178 content::TestBrowserThreadBundle thread_bundle_; | 178 content::TestBrowserThreadBundle thread_bundle_; |
179 }; | 179 }; |
180 | 180 |
181 } // namespace image_writer | 181 } // namespace image_writer |
182 } // namespace extensions | 182 } // namespace extensions |
183 | 183 |
184 #endif // CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_TEST_UTILS_H_ | 184 #endif // CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_TEST_UTILS_H_ |
OLD | NEW |