Home | History | Annotate | Download | only in base
      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
      3 // found in the LICENSE file.
      4 
      5 #include "net/base/mock_file_stream.h"
      6 
      7 namespace net {
      8 
      9 namespace testing {
     10 
     11 int MockFileStream::OpenSync(const base::FilePath& path, int open_flags) {
     12   path_ = path;
     13   return ReturnError(FileStream::OpenSync(path, open_flags));
     14 }
     15 
     16 int MockFileStream::Seek(Whence whence, int64 offset,
     17                          const Int64CompletionCallback& callback) {
     18   return ReturnError(FileStream::Seek(whence, offset, callback));
     19 }
     20 
     21 int64 MockFileStream::SeekSync(Whence whence, int64 offset) {
     22   return ReturnError64(FileStream::SeekSync(whence, offset));
     23 }
     24 
     25 int64 MockFileStream::Available() {
     26   return ReturnError64(FileStream::Available());
     27 }
     28 
     29 int MockFileStream::Read(IOBuffer* buf,
     30                          int buf_len,
     31                          const CompletionCallback& callback) {
     32   return ReturnError(FileStream::Read(buf, buf_len, callback));
     33 }
     34 
     35 int MockFileStream::ReadSync(char* buf, int buf_len) {
     36   return ReturnError(FileStream::ReadSync(buf, buf_len));
     37 }
     38 
     39 int MockFileStream::ReadUntilComplete(char *buf, int buf_len) {
     40   return ReturnError(FileStream::ReadUntilComplete(buf, buf_len));
     41 }
     42 
     43 int MockFileStream::Write(IOBuffer* buf,
     44                           int buf_len,
     45                           const CompletionCallback& callback) {
     46   return ReturnError(FileStream::Write(buf, buf_len, callback));
     47 }
     48 
     49 int MockFileStream::WriteSync(const char* buf, int buf_len) {
     50   return ReturnError(FileStream::WriteSync(buf, buf_len));
     51 }
     52 
     53 int64 MockFileStream::Truncate(int64 bytes) {
     54   return ReturnError64(FileStream::Truncate(bytes));
     55 }
     56 
     57 int MockFileStream::Flush(const CompletionCallback& callback) {
     58   return ReturnError(FileStream::Flush(callback));
     59 }
     60 
     61 int MockFileStream::FlushSync() {
     62   return ReturnError(FileStream::FlushSync());
     63 }
     64 
     65 }  // namespace testing
     66 
     67 }  // namespace net
     68