Chromium Code Reviews| OLD | NEW |
|---|---|
| (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_ | |
| OLD | NEW |