| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/chromeos/drive/fileapi/fileapi_worker.h" | 5 #include "chrome/browser/chromeos/drive/fileapi/fileapi_worker.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // close callback is called. | 33 // close callback is called. |
| 34 class TestFileSystemForOpenFile : public DummyFileSystem { | 34 class TestFileSystemForOpenFile : public DummyFileSystem { |
| 35 public: | 35 public: |
| 36 TestFileSystemForOpenFile(const base::FilePath& local_file_path, | 36 TestFileSystemForOpenFile(const base::FilePath& local_file_path, |
| 37 OpenMode expected_open_mode) | 37 OpenMode expected_open_mode) |
| 38 : local_file_path_(local_file_path), | 38 : local_file_path_(local_file_path), |
| 39 expected_open_mode_(expected_open_mode), | 39 expected_open_mode_(expected_open_mode), |
| 40 closed_(false) { | 40 closed_(false) { |
| 41 } | 41 } |
| 42 | 42 |
| 43 virtual void OpenFile(const base::FilePath& file_path, | 43 void OpenFile(const base::FilePath& file_path, |
| 44 OpenMode open_mode, | 44 OpenMode open_mode, |
| 45 const std::string& mime_type, | 45 const std::string& mime_type, |
| 46 const drive::OpenFileCallback& callback) override { | 46 const drive::OpenFileCallback& callback) override { |
| 47 EXPECT_EQ(expected_open_mode_, open_mode); | 47 EXPECT_EQ(expected_open_mode_, open_mode); |
| 48 | 48 |
| 49 callback.Run( | 49 callback.Run( |
| 50 FILE_ERROR_OK, | 50 FILE_ERROR_OK, |
| 51 local_file_path_, | 51 local_file_path_, |
| 52 base::Bind(&TestFileSystemForOpenFile::Close, base::Unretained(this))); | 52 base::Bind(&TestFileSystemForOpenFile::Close, base::Unretained(this))); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void Close() { | 55 void Close() { |
| 56 closed_ = true; | 56 closed_ = true; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 OpenFile(kDummyPath, | 257 OpenFile(kDummyPath, |
| 258 base::File::FLAG_OPEN | base::File::FLAG_READ, | 258 base::File::FLAG_OPEN | base::File::FLAG_READ, |
| 259 base::Bind(&VerifyRead, kInitialData), | 259 base::Bind(&VerifyRead, kInitialData), |
| 260 &file_system); | 260 &file_system); |
| 261 content::RunAllBlockingPoolTasksUntilIdle(); | 261 content::RunAllBlockingPoolTasksUntilIdle(); |
| 262 EXPECT_TRUE(file_system.closed()); | 262 EXPECT_TRUE(file_system.closed()); |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace fileapi_internal | 265 } // namespace fileapi_internal |
| 266 } // namespace drive | 266 } // namespace drive |
| OLD | NEW |