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

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

Issue 9288084: Added Net logging to FileStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed how SetBoundNetLogSource() handles invalid bound net logs. 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 #pragma once 9 #pragma once
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "net/base/file_stream.h" 14 #include "net/base/file_stream.h"
15 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 16
17 namespace net { 17 namespace net {
18 18
19 namespace testing { 19 namespace testing {
20 20
21 class MockFileStream : public net::FileStream { 21 class MockFileStream : public net::FileStream {
22 public: 22 public:
23 MockFileStream() : forced_error_(net::OK) {} 23 MockFileStream(net::NetLog* net_log)
24 : net::FileStream(net_log), forced_error_(net::OK) {}
24 25
25 MockFileStream(base::PlatformFile file, int flags) 26 MockFileStream(base::PlatformFile file, int flags, net::NetLog* net_log)
26 : net::FileStream(file, flags), forced_error_(net::OK) {} 27 : net::FileStream(file, flags, net_log), forced_error_(net::OK) {}
27 28
28 // FileStream methods. 29 // FileStream methods.
29 virtual int Open(const FilePath& path, int open_flags) OVERRIDE; 30 virtual int Open(const FilePath& path, int open_flags) OVERRIDE;
30 virtual int64 Seek(net::Whence whence, int64 offset) OVERRIDE; 31 virtual int64 Seek(net::Whence whence, int64 offset) OVERRIDE;
31 virtual int64 Available() OVERRIDE; 32 virtual int64 Available() OVERRIDE;
32 virtual int Read(char* buf, 33 virtual int Read(char* buf,
33 int buf_len, 34 int buf_len,
34 const CompletionCallback& callback) OVERRIDE; 35 const CompletionCallback& callback) OVERRIDE;
35 virtual int ReadUntilComplete(char *buf, int buf_len) OVERRIDE; 36 virtual int ReadUntilComplete(char *buf, int buf_len) OVERRIDE;
36 virtual int Write(const char* buf, 37 virtual int Write(const char* buf,
(...skipping 30 matching lines...) Expand all
67 68
68 int forced_error_; 69 int forced_error_;
69 FilePath path_; 70 FilePath path_;
70 }; 71 };
71 72
72 } // namespace testing 73 } // namespace testing
73 74
74 } // namespace net 75 } // namespace net
75 76
76 #endif // NET_BASE_MOCK_FILE_STREAM_H_ 77 #endif // NET_BASE_MOCK_FILE_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698