summaryrefslogtreecommitdiffstats
path: root/net/base/mock_file_stream.cc
blob: cb59cf9bfb10b1a22001145d67cce28b3bdeed52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/base/mock_file_stream.h"

namespace net {

namespace testing {

int MockFileStream::Open(const FilePath& path, int open_flags) {
  path_ = path;
  return ReturnError(FileStream::Open(path, open_flags));
}

int64 MockFileStream::Seek(Whence whence, int64 offset) {
  return ReturnError64(FileStream::Seek(whence, offset));
}

int64 MockFileStream::Available() {
  return ReturnError64(FileStream::Available());
}

int MockFileStream::Read(char* buf,
                         int buf_len,
                         const CompletionCallback& callback) {
  return ReturnError(FileStream::Read(buf, buf_len, callback));
}

int MockFileStream::ReadUntilComplete(char *buf, int buf_len) {
  return ReturnError(FileStream::ReadUntilComplete(buf, buf_len));
}

int MockFileStream::Write(const char* buf,
                          int buf_len,
                          const CompletionCallback& callback) {
  return ReturnError(FileStream::Write(buf, buf_len, callback));
}

int64 MockFileStream::Truncate(int64 bytes) {
  return ReturnError64(FileStream::Truncate(bytes));
}

int MockFileStream::Flush() {
  return ReturnError(FileStream::Flush());
}

}  // namespace testing

}  // namespace net