Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: content/public/test/test_file_error_injector.h

Issue 10696043: Shifted DownloadFile to exporting DownloadInterruptReasons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync'd to TOT. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "net/base/net_errors.h" 14 #include "content/public/browser/download_interrupt_reasons.h"
15 15
16 class GURL; 16 class GURL;
17 17
18 namespace content { 18 namespace content {
19 19
20 class DownloadId; 20 class DownloadId;
21 class DownloadFileWithErrorsFactory; 21 class DownloadFileWithErrorsFactory;
22 22
23 // Test helper for injecting errors into download file operations. 23 // Test helper for injecting errors into download file operations.
24 // All errors for a download must be injected before it starts. 24 // All errors for a download must be injected before it starts.
(...skipping 28 matching lines...) Expand all
53 FILE_OPERATION_INITIALIZE, 53 FILE_OPERATION_INITIALIZE,
54 FILE_OPERATION_WRITE, 54 FILE_OPERATION_WRITE,
55 FILE_OPERATION_RENAME 55 FILE_OPERATION_RENAME
56 }; 56 };
57 57
58 // Structure that encapsulates the information needed to inject a file error. 58 // Structure that encapsulates the information needed to inject a file error.
59 struct FileErrorInfo { 59 struct FileErrorInfo {
60 std::string url; // Full URL of the download. Identifies the download. 60 std::string url; // Full URL of the download. Identifies the download.
61 FileOperationCode code; // Operation to affect. 61 FileOperationCode code; // Operation to affect.
62 int operation_instance; // 0-based count of operation calls, for each code. 62 int operation_instance; // 0-based count of operation calls, for each code.
63 net::Error net_error; // Error to inject. 63 content::DownloadInterruptReason error; // Error to inject.
64 }; 64 };
65 65
66 typedef std::map<std::string, FileErrorInfo> ErrorMap; 66 typedef std::map<std::string, FileErrorInfo> ErrorMap;
67 67
68 // Creates an instance. May only be called once. 68 // Creates an instance. May only be called once.
69 // Lives until all callbacks (in the implementation) are complete and the 69 // Lives until all callbacks (in the implementation) are complete and the
70 // creator goes out of scope. 70 // creator goes out of scope.
71 static scoped_refptr<TestFileErrorInjector> Create(); 71 static scoped_refptr<TestFileErrorInjector> Create();
72 72
73 // Adds an error. 73 // Adds an error.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 // The factory we created. May outlive this class. 140 // The factory we created. May outlive this class.
141 DownloadFileWithErrorsFactory* created_factory_; 141 DownloadFileWithErrorsFactory* created_factory_;
142 142
143 DISALLOW_COPY_AND_ASSIGN(TestFileErrorInjector); 143 DISALLOW_COPY_AND_ASSIGN(TestFileErrorInjector);
144 }; 144 };
145 145
146 } // namespace content 146 } // namespace content
147 147
148 #endif // CONTENT_PUBLIC_TEST_TEST_FILE_ERROR_INJECTOR_H_ 148 #endif // CONTENT_PUBLIC_TEST_TEST_FILE_ERROR_INJECTOR_H_
OLDNEW
« no previous file with comments | « content/browser/download/mock_download_file.cc ('k') | content/test/test_file_error_injector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698