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

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

Issue 9426029: Test file errors in downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplified injector classes further. Created 8 years, 10 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_TEST_TEST_FILE_ERROR_INJECTOR_H_
6 #define CONTENT_TEST_TEST_FILE_ERROR_INJECTOR_H_
7 #pragma once
8
9 #include "base/memory/ref_counted.h"
cbentzel 2012/02/27 02:18:54 ref_counted no longer needed.
ahendrickson 2012/02/28 03:28:56 It is again.
10 #include "net/base/net_errors.h"
11
12 namespace content {
13
14 enum FileOperationCode {
cbentzel 2012/02/27 02:18:54 This seems pretty generic to be part of content na
ahendrickson 2012/02/28 03:28:56 Done.
15 FILE_OPERATION_INITIALIZE,
16 FILE_OPERATION_WRITE,
17 FILE_OPERATION_RENAME
18 };
19
20 // Test helper for injecting errors into |DownloadFile| operations.
21 // All errors must be injected before |DownloadFile|s are created.
cbentzel 2012/02/27 02:18:54 It might be clearer to have the API be like Test
ahendrickson 2012/02/28 03:28:56 Done.
22 // Any other operations must occur on the FILE thread.
23 // Will be owned by the |DownloadFileManager| via a |DownloadFileFactory|
cbentzel 2012/02/27 02:18:54 Yeah - this ownership is still really strange - es
ahendrickson 2012/02/28 03:28:56 Switched to using RefCountedThreadSafe for the inj
24 // instance.
25 class TestFileErrorInjector {
26 public:
27 TestFileErrorInjector() {}
28 virtual ~TestFileErrorInjector() {}
29
30 static TestFileErrorInjector* Create();
31
32 virtual bool InjectError(int file_index,
33 FileOperationCode operation,
34 int operation_instance,
35 net::Error net_error) = 0;
36
37 virtual size_t CurrentFileCount() const = 0;
38 virtual size_t FileCreationCount() const = 0;
39 virtual bool HasFile(int file_index) const = 0;
40
41 private:
42 DISALLOW_COPY_AND_ASSIGN(TestFileErrorInjector);
43 };
44
45 } // namespace content
46
47 #endif // CONTENT_TEST_TEST_FILE_ERROR_INJECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698