| 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/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "webkit/fileapi/file_system_context.h" | 12 #include "webkit/fileapi/file_system_context.h" |
| 13 #include "webkit/fileapi/file_system_operation_interface.h" | 13 #include "webkit/fileapi/file_system_operation_interface.h" |
| 14 #include "webkit/fileapi/file_system_task_runners.h" |
| 14 #include "webkit/fileapi/isolated_context.h" | 15 #include "webkit/fileapi/isolated_context.h" |
| 15 #include "webkit/fileapi/media/native_media_file_util.h" | 16 #include "webkit/fileapi/media/native_media_file_util.h" |
| 16 #include "webkit/fileapi/mock_file_system_options.h" | 17 #include "webkit/fileapi/mock_file_system_options.h" |
| 17 #include "webkit/fileapi/native_file_util.h" | 18 #include "webkit/fileapi/native_file_util.h" |
| 18 #include "webkit/quota/mock_special_storage_policy.h" | 19 #include "webkit/quota/mock_special_storage_policy.h" |
| 19 | 20 |
| 20 #define FPL(x) FILE_PATH_LITERAL(x) | 21 #define FPL(x) FILE_PATH_LITERAL(x) |
| 21 | 22 |
| 22 using namespace fileapi; | 23 using namespace fileapi; |
| 23 | 24 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 88 } |
| 88 | 89 |
| 89 void SetUp() { | 90 void SetUp() { |
| 90 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 91 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
| 91 | 92 |
| 92 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = | 93 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = |
| 93 new quota::MockSpecialStoragePolicy(); | 94 new quota::MockSpecialStoragePolicy(); |
| 94 | 95 |
| 95 file_system_context_ = | 96 file_system_context_ = |
| 96 new FileSystemContext( | 97 new FileSystemContext( |
| 97 base::MessageLoopProxy::current(), | 98 FileSystemTaskRunners::CreateMockTaskRunners(), |
| 98 base::MessageLoopProxy::current(), | |
| 99 storage_policy, | 99 storage_policy, |
| 100 NULL, | 100 NULL, |
| 101 data_dir_.path(), | 101 data_dir_.path(), |
| 102 CreateAllowFileAccessOptions()); | 102 CreateAllowFileAccessOptions()); |
| 103 | 103 |
| 104 file_util_ = file_system_context_->GetFileUtil(kFileSystemTypeNativeMedia); | 104 file_util_ = file_system_context_->GetFileUtil(kFileSystemTypeNativeMedia); |
| 105 | 105 |
| 106 filesystem_id_ = isolated_context()->RegisterFileSystemForPath( | 106 filesystem_id_ = isolated_context()->RegisterFileSystemForPath( |
| 107 kFileSystemTypeNativeMedia, root_path(), NULL); | 107 kFileSystemTypeNativeMedia, root_path(), NULL); |
| 108 | 108 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 EXPECT_TRUE(completed); | 192 EXPECT_TRUE(completed); |
| 193 EXPECT_EQ(5u, content.size()); | 193 EXPECT_EQ(5u, content.size()); |
| 194 | 194 |
| 195 for (size_t i = 0; i < arraysize(kFilteringTestCases); ++i) { | 195 for (size_t i = 0; i < arraysize(kFilteringTestCases); ++i) { |
| 196 FilePath::StringType name = | 196 FilePath::StringType name = |
| 197 FilePath(kFilteringTestCases[i].path).BaseName().value(); | 197 FilePath(kFilteringTestCases[i].path).BaseName().value(); |
| 198 std::set<FilePath::StringType>::const_iterator found = content.find(name); | 198 std::set<FilePath::StringType>::const_iterator found = content.find(name); |
| 199 EXPECT_EQ(kFilteringTestCases[i].visible, found != content.end()); | 199 EXPECT_EQ(kFilteringTestCases[i].visible, found != content.end()); |
| 200 } | 200 } |
| 201 } | 201 } |
| OLD | NEW |