| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.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/file_util.h" |
| 9 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 10 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/browsing_data_file_system_helper.h" | 12 #include "chrome/browser/browsing_data_file_system_helper.h" |
| 12 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
| 13 #include "content/test/test_browser_thread.h" | 14 #include "content/test/test_browser_thread.h" |
| 14 #include "webkit/fileapi/file_system_context.h" | 15 #include "webkit/fileapi/file_system_context.h" |
| 15 #include "webkit/fileapi/file_system_path_manager.h" | |
| 16 #include "webkit/fileapi/file_system_types.h" | 16 #include "webkit/fileapi/file_system_types.h" |
| 17 #include "webkit/fileapi/file_system_usage_cache.h" | 17 #include "webkit/fileapi/file_system_usage_cache.h" |
| 18 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 18 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
| 19 | 19 |
| 20 using content::BrowserThread; | 20 using content::BrowserThread; |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // Shorter names for fileapi::* constants. | 24 // Shorter names for fileapi::* constants. |
| 25 const fileapi::FileSystemType kTemporary = fileapi::kFileSystemTypeTemporary; | 25 const fileapi::FileSystemType kTemporary = fileapi::kFileSystemTypeTemporary; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 void FetchCannedFileSystems() { | 125 void FetchCannedFileSystems() { |
| 126 canned_helper_->StartFetching( | 126 canned_helper_->StartFetching( |
| 127 base::Bind(&BrowsingDataFileSystemHelperTest::CallbackStartFetching, | 127 base::Bind(&BrowsingDataFileSystemHelperTest::CallbackStartFetching, |
| 128 base::Unretained(this))); | 128 base::Unretained(this))); |
| 129 BlockUntilNotified(); | 129 BlockUntilNotified(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 // Sets up kOrigin1 with a temporary file system, kOrigin2 with a persistent | 132 // Sets up kOrigin1 with a temporary file system, kOrigin2 with a persistent |
| 133 // file system, and kOrigin3 with both. | 133 // file system, and kOrigin3 with both. |
| 134 virtual void PopulateTestFileSystemData() { | 134 virtual void PopulateTestFileSystemData() { |
| 135 sandbox_ = profile_.GetFileSystemContext()->path_manager()-> | 135 sandbox_ = profile_.GetFileSystemContext()->sandbox_provider(); |
| 136 sandbox_provider(); | |
| 137 | 136 |
| 138 CreateDirectoryForOriginAndType(kOrigin1, kTemporary); | 137 CreateDirectoryForOriginAndType(kOrigin1, kTemporary); |
| 139 CreateDirectoryForOriginAndType(kOrigin2, kPersistent); | 138 CreateDirectoryForOriginAndType(kOrigin2, kPersistent); |
| 140 CreateDirectoryForOriginAndType(kOrigin3, kTemporary); | 139 CreateDirectoryForOriginAndType(kOrigin3, kTemporary); |
| 141 CreateDirectoryForOriginAndType(kOrigin3, kPersistent); | 140 CreateDirectoryForOriginAndType(kOrigin3, kPersistent); |
| 142 | 141 |
| 143 EXPECT_FALSE(FileSystemContainsOriginAndType(kOrigin1, kPersistent)); | 142 EXPECT_FALSE(FileSystemContainsOriginAndType(kOrigin1, kPersistent)); |
| 144 EXPECT_TRUE(FileSystemContainsOriginAndType(kOrigin1, kTemporary)); | 143 EXPECT_TRUE(FileSystemContainsOriginAndType(kOrigin1, kTemporary)); |
| 145 EXPECT_TRUE(FileSystemContainsOriginAndType(kOrigin2, kPersistent)); | 144 EXPECT_TRUE(FileSystemContainsOriginAndType(kOrigin2, kPersistent)); |
| 146 EXPECT_FALSE(FileSystemContainsOriginAndType(kOrigin2, kTemporary)); | 145 EXPECT_FALSE(FileSystemContainsOriginAndType(kOrigin2, kTemporary)); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 279 |
| 281 info++; | 280 info++; |
| 282 EXPECT_EQ(kOrigin2, info->origin); | 281 EXPECT_EQ(kOrigin2, info->origin); |
| 283 EXPECT_FALSE(info->has_persistent); | 282 EXPECT_FALSE(info->has_persistent); |
| 284 EXPECT_TRUE(info->has_temporary); | 283 EXPECT_TRUE(info->has_temporary); |
| 285 EXPECT_EQ(0, info->usage_persistent); | 284 EXPECT_EQ(0, info->usage_persistent); |
| 286 EXPECT_EQ(100, info->usage_temporary); | 285 EXPECT_EQ(100, info->usage_temporary); |
| 287 } | 286 } |
| 288 | 287 |
| 289 } // namespace | 288 } // namespace |
| 290 | |
| OLD | NEW |