| 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 #include "content/public/test/test_file_error_injector.h" | 5 #include "content/public/test/test_file_error_injector.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "content/browser/download/download_file_factory.h" |
| 11 #include "content/browser/download/download_file_impl.h" | 12 #include "content/browser/download/download_file_impl.h" |
| 12 #include "content/browser/download/download_file_factory.h" | |
| 13 #include "content/browser/download/download_interrupt_reasons_impl.h" | 13 #include "content/browser/download/download_interrupt_reasons_impl.h" |
| 14 #include "content/browser/download/download_manager_impl.h" | 14 #include "content/browser/download/download_manager_impl.h" |
| 15 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 15 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 16 #include "content/browser/power_save_blocker.h" | |
| 17 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/power_save_blocker.h" |
| 18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 class ByteStreamReader; | 21 class ByteStreamReader; |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // A class that performs file operations and injects errors. | 25 // A class that performs file operations and injects errors. |
| 26 class DownloadFileWithErrors: public DownloadFileImpl { | 26 class DownloadFileWithErrors: public DownloadFileImpl { |
| 27 public: | 27 public: |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 TestFileErrorInjector::FileErrorInfo err_info = { | 269 TestFileErrorInjector::FileErrorInfo err_info = { |
| 270 url.spec(), | 270 url.spec(), |
| 271 TestFileErrorInjector::FILE_OPERATION_INITIALIZE, | 271 TestFileErrorInjector::FILE_OPERATION_INITIALIZE, |
| 272 -1, | 272 -1, |
| 273 DOWNLOAD_INTERRUPT_REASON_NONE | 273 DOWNLOAD_INTERRUPT_REASON_NONE |
| 274 }; | 274 }; |
| 275 injected_errors_[url.spec()] = err_info; | 275 injected_errors_[url.spec()] = err_info; |
| 276 } | 276 } |
| 277 | 277 |
| 278 scoped_ptr<PowerSaveBlocker> psb( | 278 scoped_ptr<PowerSaveBlocker> psb( |
| 279 new PowerSaveBlocker( | 279 PowerSaveBlocker::Create( |
| 280 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | 280 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
| 281 "Download in progress")); | 281 "Download in progress")); |
| 282 | 282 |
| 283 return new DownloadFileWithErrors( | 283 return new DownloadFileWithErrors( |
| 284 save_info.Pass(), | 284 save_info.Pass(), |
| 285 default_download_directory, | 285 default_download_directory, |
| 286 url, | 286 url, |
| 287 referrer_url, | 287 referrer_url, |
| 288 calculate_hash, | 288 calculate_hash, |
| 289 stream.Pass(), | 289 stream.Pass(), |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 case FILE_OPERATION_RENAME_ANNOTATE: | 439 case FILE_OPERATION_RENAME_ANNOTATE: |
| 440 return "RENAME_ANNOTATE"; | 440 return "RENAME_ANNOTATE"; |
| 441 default: | 441 default: |
| 442 break; | 442 break; |
| 443 } | 443 } |
| 444 | 444 |
| 445 return "Unknown"; | 445 return "Unknown"; |
| 446 } | 446 } |
| 447 | 447 |
| 448 } // namespace content | 448 } // namespace content |
| OLD | NEW |