blob: 419f65fcca2b37b41892030509f1d2657b50f5ab [file] [log] [blame]
[email protected]fe57eb22012-02-09 05:59:401// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]47a881b2011-08-29 22:59:212// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "net/base/mock_file_stream.h"
6
7namespace net {
8
9namespace testing {
10
[email protected]fe57eb22012-02-09 05:59:4011int MockFileStream::OpenSync(const FilePath& path, int open_flags) {
[email protected]47a881b2011-08-29 22:59:2112 path_ = path;
[email protected]fe57eb22012-02-09 05:59:4013 return ReturnError(FileStream::OpenSync(path, open_flags));
[email protected]47a881b2011-08-29 22:59:2114}
15
[email protected]5eb431e22011-10-12 08:51:3816int64 MockFileStream::Seek(Whence whence, int64 offset) {
17 return ReturnError64(FileStream::Seek(whence, offset));
[email protected]47a881b2011-08-29 22:59:2118}
19
20int64 MockFileStream::Available() {
[email protected]5eb431e22011-10-12 08:51:3821 return ReturnError64(FileStream::Available());
[email protected]47a881b2011-08-29 22:59:2122}
23
[email protected]9f49afb2012-02-16 09:59:2024int MockFileStream::Read(IOBuffer* buf,
[email protected]5eb431e22011-10-12 08:51:3825 int buf_len,
26 const CompletionCallback& callback) {
27 return ReturnError(FileStream::Read(buf, buf_len, callback));
[email protected]47a881b2011-08-29 22:59:2128}
29
[email protected]6b230f42012-02-15 04:08:4130int MockFileStream::ReadSync(char* buf, int buf_len) {
31 return ReturnError(FileStream::ReadSync(buf, buf_len));
32}
33
[email protected]47a881b2011-08-29 22:59:2134int MockFileStream::ReadUntilComplete(char *buf, int buf_len) {
[email protected]5eb431e22011-10-12 08:51:3835 return ReturnError(FileStream::ReadUntilComplete(buf, buf_len));
[email protected]47a881b2011-08-29 22:59:2136}
37
[email protected]9f49afb2012-02-16 09:59:2038int MockFileStream::Write(IOBuffer* buf,
[email protected]5eb431e22011-10-12 08:51:3839 int buf_len,
40 const CompletionCallback& callback) {
41 return ReturnError(FileStream::Write(buf, buf_len, callback));
[email protected]47a881b2011-08-29 22:59:2142}
43
[email protected]6b230f42012-02-15 04:08:4144int MockFileStream::WriteSync(const char* buf, int buf_len) {
45 return ReturnError(FileStream::WriteSync(buf, buf_len));
46}
47
[email protected]47a881b2011-08-29 22:59:2148int64 MockFileStream::Truncate(int64 bytes) {
[email protected]5eb431e22011-10-12 08:51:3849 return ReturnError64(FileStream::Truncate(bytes));
[email protected]47a881b2011-08-29 22:59:2150}
51
52int MockFileStream::Flush() {
[email protected]5eb431e22011-10-12 08:51:3853 return ReturnError(FileStream::Flush());
[email protected]47a881b2011-08-29 22:59:2154}
55
56} // namespace testing
57
58} // namespace net