| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_TEST_TEST_FILE_ERROR_INJECTOR_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEST_FILE_ERROR_INJECTOR_H_ |
| 6 #define CONTENT_PUBLIC_TEST_TEST_FILE_ERROR_INJECTOR_H_ | 6 #define CONTENT_PUBLIC_TEST_TEST_FILE_ERROR_INJECTOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // | 48 // |
| 49 // download_manager->DownloadUrl(url1, ...); | 49 // download_manager->DownloadUrl(url1, ...); |
| 50 // download_manager->DownloadUrl(url2, ...); | 50 // download_manager->DownloadUrl(url2, ...); |
| 51 // ... wait for downloads to finish or get an injected error ... | 51 // ... wait for downloads to finish or get an injected error ... |
| 52 class TestFileErrorInjector | 52 class TestFileErrorInjector |
| 53 : public base::RefCountedThreadSafe<TestFileErrorInjector> { | 53 : public base::RefCountedThreadSafe<TestFileErrorInjector> { |
| 54 public: | 54 public: |
| 55 enum FileOperationCode { | 55 enum FileOperationCode { |
| 56 FILE_OPERATION_INITIALIZE, | 56 FILE_OPERATION_INITIALIZE, |
| 57 FILE_OPERATION_WRITE, | 57 FILE_OPERATION_WRITE, |
| 58 FILE_OPERATION_RENAME | 58 FILE_OPERATION_RENAME_UNIQUIFY, |
| 59 FILE_OPERATION_RENAME_ANNOTATE, |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 // Structure that encapsulates the information needed to inject a file error. | 62 // Structure that encapsulates the information needed to inject a file error. |
| 62 struct FileErrorInfo { | 63 struct FileErrorInfo { |
| 63 std::string url; // Full URL of the download. Identifies the download. | 64 std::string url; // Full URL of the download. Identifies the download. |
| 64 FileOperationCode code; // Operation to affect. | 65 FileOperationCode code; // Operation to affect. |
| 65 int operation_instance; // 0-based count of operation calls, for each code. | 66 int operation_instance; // 0-based count of operation calls, for each code. |
| 66 DownloadInterruptReason error; // Error to inject. | 67 DownloadInterruptReason error; // Error to inject. |
| 67 }; | 68 }; |
| 68 | 69 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 141 |
| 141 // The download manager we set the factory on. | 142 // The download manager we set the factory on. |
| 142 scoped_refptr<DownloadManagerImpl> download_manager_; | 143 scoped_refptr<DownloadManagerImpl> download_manager_; |
| 143 | 144 |
| 144 DISALLOW_COPY_AND_ASSIGN(TestFileErrorInjector); | 145 DISALLOW_COPY_AND_ASSIGN(TestFileErrorInjector); |
| 145 }; | 146 }; |
| 146 | 147 |
| 147 } // namespace content | 148 } // namespace content |
| 148 | 149 |
| 149 #endif // CONTENT_PUBLIC_TEST_TEST_FILE_ERROR_INJECTOR_H_ | 150 #endif // CONTENT_PUBLIC_TEST_TEST_FILE_ERROR_INJECTOR_H_ |
| OLD | NEW |