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

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: Merged with parent 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"
10 #include "net/base/net_errors.h"
11
12 enum FileOperationCode {
cbentzel 2012/02/24 01:54:37 Should this be in the content namespace?
ahendrickson 2012/02/24 22:48:39 Done.
13 FILE_OPERATION_INITIALIZE,
14 FILE_OPERATION_WRITE,
15 FILE_OPERATION_RENAME
16 };
17
18 // Test helper for injecting errors into DownloadFile operations.
19 // Must only be used on the FILE thread.
cbentzel 2012/02/24 02:25:12 Comment not entirely true - constructor can be cal
ahendrickson 2012/02/24 22:48:39 Changed the comment.
20 class TestFileErrorInjector
21 : public base::RefCountedThreadSafe<TestFileErrorInjector> {
cbentzel 2012/02/24 02:25:12 Why does this need to be refcounted?
ahendrickson 2012/02/24 22:48:39 Because the DownloadFileWithError instances can ou
22 public:
23 TestFileErrorInjector() {}
24
25 static TestFileErrorInjector* Create();
26
27 virtual bool InjectError(int file_index,
cbentzel 2012/02/24 02:25:12 Could this be simplified at all - especially since
ahendrickson 2012/02/24 22:48:39 I would like to be able to use this later, for aut
28 FileOperationCode operation,
29 int operation_instance,
30 net::Error net_error) = 0;
31
32 virtual size_t CurrentFileCount() const = 0;
33 virtual size_t FileCreationCount() const = 0;
34
35 protected:
36 // Here so we can derive from this class.
37 virtual ~TestFileErrorInjector() {}
38
39 private:
40 friend class base::RefCountedThreadSafe<TestFileErrorInjector>;
41
42 DISALLOW_COPY_AND_ASSIGN(TestFileErrorInjector);
43 };
44
45 #endif // CONTENT_TEST_TEST_FILE_ERROR_INJECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698