| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "content/public/test/test_file_system_context.h" | 9 #include "content/public/test/test_file_system_context.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "webkit/browser/fileapi/file_system_context.h" | 11 #include "webkit/browser/fileapi/file_system_context.h" |
| 12 #include "webkit/browser/fileapi/file_system_operation_runner.h" | 12 #include "webkit/browser/fileapi/file_system_operation_runner.h" |
| 13 | 13 |
| 14 using fileapi::FileSystemContext; | 14 using storage::FileSystemContext; |
| 15 using fileapi::FileSystemOperationRunner; | 15 using storage::FileSystemOperationRunner; |
| 16 using fileapi::FileSystemType; | 16 using storage::FileSystemType; |
| 17 using fileapi::FileSystemURL; | 17 using storage::FileSystemURL; |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 void GetStatus(bool* done, | 21 void GetStatus(bool* done, |
| 22 base::File::Error *status_out, | 22 base::File::Error *status_out, |
| 23 base::File::Error status) { | 23 base::File::Error status) { |
| 24 ASSERT_FALSE(*done); | 24 ASSERT_FALSE(*done); |
| 25 *done = true; | 25 *done = true; |
| 26 *status_out = status; | 26 *status_out = status; |
| 27 } | 27 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 49 CreateFileSystemContextForTesting(NULL, base_dir); | 49 CreateFileSystemContextForTesting(NULL, base_dir); |
| 50 } | 50 } |
| 51 | 51 |
| 52 virtual void TearDown() OVERRIDE { | 52 virtual void TearDown() OVERRIDE { |
| 53 file_system_context_ = NULL; | 53 file_system_context_ = NULL; |
| 54 base::RunLoop().RunUntilIdle(); | 54 base::RunLoop().RunUntilIdle(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 FileSystemURL URL(const std::string& path) { | 57 FileSystemURL URL(const std::string& path) { |
| 58 return file_system_context_->CreateCrackedFileSystemURL( | 58 return file_system_context_->CreateCrackedFileSystemURL( |
| 59 GURL("http://example.com"), fileapi::kFileSystemTypeTemporary, | 59 GURL("http://example.com"), |
| 60 storage::kFileSystemTypeTemporary, |
| 60 base::FilePath::FromUTF8Unsafe(path)); | 61 base::FilePath::FromUTF8Unsafe(path)); |
| 61 } | 62 } |
| 62 | 63 |
| 63 FileSystemOperationRunner* operation_runner() { | 64 FileSystemOperationRunner* operation_runner() { |
| 64 return file_system_context_->operation_runner(); | 65 return file_system_context_->operation_runner(); |
| 65 } | 66 } |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 base::ScopedTempDir base_; | 69 base::ScopedTempDir base_; |
| 69 base::MessageLoop message_loop_; | 70 base::MessageLoop message_loop_; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 base::File::Error cancel_status = base::File::FILE_ERROR_FAILED; | 158 base::File::Error cancel_status = base::File::FILE_ERROR_FAILED; |
| 158 operation_runner()->Cancel(kInvalidId, base::Bind(&GetCancelStatus, | 159 operation_runner()->Cancel(kInvalidId, base::Bind(&GetCancelStatus, |
| 159 &done, &cancel_done, | 160 &done, &cancel_done, |
| 160 &cancel_status)); | 161 &cancel_status)); |
| 161 | 162 |
| 162 ASSERT_TRUE(cancel_done); | 163 ASSERT_TRUE(cancel_done); |
| 163 ASSERT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, cancel_status); | 164 ASSERT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, cancel_status); |
| 164 } | 165 } |
| 165 | 166 |
| 166 } // namespace content | 167 } // namespace content |
| OLD | NEW |