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

Side by Side Diff: net/base/mock_file_stream.h

Issue 1158923005: Use the exact-width integer types defined in <stdint.h> rather than (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak comments. Exclude mime_sniffer*. Rebase. Created 5 years, 6 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
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 // This file defines MockFileStream, a test class for FileStream. 5 // This file defines MockFileStream, a test class for FileStream.
6 6
7 #ifndef NET_BASE_MOCK_FILE_STREAM_H_ 7 #ifndef NET_BASE_MOCK_FILE_STREAM_H_
8 #define NET_BASE_MOCK_FILE_STREAM_H_ 8 #define NET_BASE_MOCK_FILE_STREAM_H_
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 11 matching lines...) Expand all
22 22
23 class MockFileStream : public FileStream { 23 class MockFileStream : public FileStream {
24 public: 24 public:
25 explicit MockFileStream(const scoped_refptr<base::TaskRunner>& task_runner); 25 explicit MockFileStream(const scoped_refptr<base::TaskRunner>& task_runner);
26 MockFileStream(base::File file, 26 MockFileStream(base::File file,
27 const scoped_refptr<base::TaskRunner>& task_runner); 27 const scoped_refptr<base::TaskRunner>& task_runner);
28 ~MockFileStream() override; 28 ~MockFileStream() override;
29 29
30 // FileStream methods. 30 // FileStream methods.
31 int Seek(base::File::Whence whence, 31 int Seek(base::File::Whence whence,
32 int64 offset, 32 int64_t offset,
33 const Int64CompletionCallback& callback) override; 33 const Int64CompletionCallback& callback) override;
34 int Read(IOBuffer* buf, 34 int Read(IOBuffer* buf,
35 int buf_len, 35 int buf_len,
36 const CompletionCallback& callback) override; 36 const CompletionCallback& callback) override;
37 int Write(IOBuffer* buf, 37 int Write(IOBuffer* buf,
38 int buf_len, 38 int buf_len,
39 const CompletionCallback& callback) override; 39 const CompletionCallback& callback) override;
40 int Flush(const CompletionCallback& callback) override; 40 int Flush(const CompletionCallback& callback) override;
41 41
42 void set_forced_error_async(int error) { 42 void set_forced_error_async(int error) {
(...skipping 22 matching lines...) Expand all
65 int ReturnError(int function_error) { 65 int ReturnError(int function_error) {
66 if (forced_error_ != OK) { 66 if (forced_error_ != OK) {
67 int ret = forced_error_; 67 int ret = forced_error_;
68 clear_forced_error(); 68 clear_forced_error();
69 return ret; 69 return ret;
70 } 70 }
71 71
72 return function_error; 72 return function_error;
73 } 73 }
74 74
75 int64 ReturnError64(int64 function_error) { 75 int64_t ReturnError64(int64_t function_error) {
76 if (forced_error_ != OK) { 76 if (forced_error_ != OK) {
77 int64 ret = forced_error_; 77 int64_t ret = forced_error_;
78 clear_forced_error(); 78 clear_forced_error();
79 return ret; 79 return ret;
80 } 80 }
81 81
82 return function_error; 82 return function_error;
83 } 83 }
84 84
85 // Wrappers for callbacks to make them honor ThrottleCallbacks and 85 // Wrappers for callbacks to make them honor ThrottleCallbacks and
86 // ReleaseCallbacks. 86 // ReleaseCallbacks.
87 void DoCallback(const CompletionCallback& callback, int result); 87 void DoCallback(const CompletionCallback& callback, int result);
88 void DoCallback64(const Int64CompletionCallback& callback, int64 result); 88 void DoCallback64(const Int64CompletionCallback& callback, int64_t result);
89 89
90 // Depending on |async_error_|, either synchronously returns |forced_error_| 90 // Depending on |async_error_|, either synchronously returns |forced_error_|
91 // asynchronously calls |callback| with |async_error_|. 91 // asynchronously calls |callback| with |async_error_|.
92 int ErrorCallback(const CompletionCallback& callback); 92 int ErrorCallback(const CompletionCallback& callback);
93 int64 ErrorCallback64(const Int64CompletionCallback& callback); 93 int64_t ErrorCallback64(const Int64CompletionCallback& callback);
94 94
95 int forced_error_; 95 int forced_error_;
96 bool async_error_; 96 bool async_error_;
97 bool throttled_; 97 bool throttled_;
98 base::Closure throttled_task_; 98 base::Closure throttled_task_;
99 base::FilePath path_; 99 base::FilePath path_;
100 100
101 base::WeakPtrFactory<MockFileStream> weak_factory_; 101 base::WeakPtrFactory<MockFileStream> weak_factory_;
102 }; 102 };
103 103
104 } // namespace testing 104 } // namespace testing
105 105
106 } // namespace net 106 } // namespace net
107 107
108 #endif // NET_BASE_MOCK_FILE_STREAM_H_ 108 #endif // NET_BASE_MOCK_FILE_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698