| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "webkit/fileapi/external_mount_points.h" | 15 #include "webkit/fileapi/external_mount_points.h" |
| 16 #include "webkit/fileapi/file_system_context.h" | 16 #include "webkit/fileapi/file_system_context.h" |
| 17 #include "webkit/fileapi/file_system_mount_point_provider.h" |
| 17 #include "webkit/fileapi/file_system_operation.h" | 18 #include "webkit/fileapi/file_system_operation.h" |
| 18 #include "webkit/fileapi/file_system_task_runners.h" | 19 #include "webkit/fileapi/file_system_task_runners.h" |
| 19 #include "webkit/fileapi/file_system_url.h" | 20 #include "webkit/fileapi/file_system_url.h" |
| 20 #include "webkit/fileapi/isolated_context.h" | 21 #include "webkit/fileapi/isolated_context.h" |
| 21 #include "webkit/fileapi/media/native_media_file_util.h" | 22 #include "webkit/fileapi/media/native_media_file_util.h" |
| 22 #include "webkit/fileapi/mock_file_system_options.h" | 23 #include "webkit/fileapi/mock_file_system_options.h" |
| 23 #include "webkit/fileapi/native_file_util.h" | 24 #include "webkit/fileapi/native_file_util.h" |
| 24 #include "webkit/quota/mock_special_storage_policy.h" | |
| 25 | 25 |
| 26 #define FPL(x) FILE_PATH_LITERAL(x) | 26 #define FPL(x) FILE_PATH_LITERAL(x) |
| 27 | 27 |
| 28 namespace fileapi { | 28 namespace fileapi { |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 typedef FileSystemOperation::FileEntryList FileEntryList; | 32 typedef FileSystemOperation::FileEntryList FileEntryList; |
| 33 | 33 |
| 34 struct FilteringTestCase { | 34 struct FilteringTestCase { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 class NativeMediaFileUtilTest : public testing::Test { | 101 class NativeMediaFileUtilTest : public testing::Test { |
| 102 public: | 102 public: |
| 103 NativeMediaFileUtilTest() | 103 NativeMediaFileUtilTest() |
| 104 : file_util_(NULL) { | 104 : file_util_(NULL) { |
| 105 } | 105 } |
| 106 | 106 |
| 107 virtual void SetUp() { | 107 virtual void SetUp() { |
| 108 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 108 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
| 109 ASSERT_TRUE(file_util::CreateDirectory(root_path())); | 109 ASSERT_TRUE(file_util::CreateDirectory(root_path())); |
| 110 | 110 |
| 111 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = | |
| 112 new quota::MockSpecialStoragePolicy(); | |
| 113 | |
| 114 file_system_context_ = | 111 file_system_context_ = |
| 115 new FileSystemContext( | 112 new FileSystemContext( |
| 116 FileSystemTaskRunners::CreateMockTaskRunners(), | 113 FileSystemTaskRunners::CreateMockTaskRunners(), |
| 117 ExternalMountPoints::CreateRefCounted().get(), | |
| 118 storage_policy, | |
| 119 NULL, | 114 NULL, |
| 115 ScopedVector<FileSystemMountPointProvider>(), |
| 116 std::vector<MountPoints*>(), |
| 120 data_dir_.path(), | 117 data_dir_.path(), |
| 121 CreateAllowFileAccessOptions()); | 118 CreateAllowFileAccessOptions()); |
| 122 | 119 |
| 123 file_util_ = file_system_context_->GetFileUtil(kFileSystemTypeNativeMedia); | 120 file_util_ = file_system_context_->GetFileUtil(kFileSystemTypeNativeMedia); |
| 124 | 121 |
| 125 filesystem_id_ = isolated_context()->RegisterFileSystemForPath( | 122 filesystem_id_ = isolated_context()->RegisterFileSystemForPath( |
| 126 kFileSystemTypeNativeMedia, root_path(), NULL); | 123 kFileSystemTypeNativeMedia, root_path(), NULL); |
| 127 | 124 |
| 128 isolated_context()->AddReference(filesystem_id_); | 125 isolated_context()->AddReference(filesystem_id_); |
| 129 } | 126 } |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 expectation = base::PLATFORM_FILE_ERROR_FAILED; | 589 expectation = base::PLATFORM_FILE_ERROR_FAILED; |
| 593 } | 590 } |
| 594 operation->TouchFile( | 591 operation->TouchFile( |
| 595 url, time, time, base::Bind(&ExpectEqHelper, test_name, expectation)); | 592 url, time, time, base::Bind(&ExpectEqHelper, test_name, expectation)); |
| 596 MessageLoop::current()->RunUntilIdle(); | 593 MessageLoop::current()->RunUntilIdle(); |
| 597 } | 594 } |
| 598 } | 595 } |
| 599 } | 596 } |
| 600 | 597 |
| 601 } // namespace fileapi | 598 } // namespace fileapi |
| OLD | NEW |