| 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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/browsing_data_file_system_helper.h" | 10 #include "chrome/browser/browsing_data_file_system_helper.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 file_system_info_list) { | 104 file_system_info_list) { |
| 105 file_system_info_list_.reset( | 105 file_system_info_list_.reset( |
| 106 new std::list<BrowsingDataFileSystemHelper::FileSystemInfo>( | 106 new std::list<BrowsingDataFileSystemHelper::FileSystemInfo>( |
| 107 file_system_info_list)); | 107 file_system_info_list)); |
| 108 Notify(); | 108 Notify(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Calls StartFetching() on the test's BrowsingDataFileSystemHelper | 111 // Calls StartFetching() on the test's BrowsingDataFileSystemHelper |
| 112 // object, then blocks until the callback is executed. | 112 // object, then blocks until the callback is executed. |
| 113 void FetchFileSystems() { | 113 void FetchFileSystems() { |
| 114 helper_->StartFetching(NewCallback(this, | 114 helper_->StartFetching( |
| 115 &BrowsingDataFileSystemHelperTest::CallbackStartFetching)); | 115 base::Bind(&BrowsingDataFileSystemHelperTest::CallbackStartFetching, |
| 116 base::Unretained(this))); |
| 116 BlockUntilNotified(); | 117 BlockUntilNotified(); |
| 117 } | 118 } |
| 118 | 119 |
| 119 // Calls StartFetching() on the test's CannedBrowsingDataFileSystemHelper | 120 // Calls StartFetching() on the test's CannedBrowsingDataFileSystemHelper |
| 120 // object, then blocks until the callback is executed. | 121 // object, then blocks until the callback is executed. |
| 121 void FetchCannedFileSystems() { | 122 void FetchCannedFileSystems() { |
| 122 canned_helper_->StartFetching(NewCallback(this, | 123 canned_helper_->StartFetching( |
| 123 &BrowsingDataFileSystemHelperTest::CallbackStartFetching)); | 124 base::Bind(&BrowsingDataFileSystemHelperTest::CallbackStartFetching, |
| 125 base::Unretained(this))); |
| 124 BlockUntilNotified(); | 126 BlockUntilNotified(); |
| 125 } | 127 } |
| 126 | 128 |
| 127 // Sets up kOrigin1 with a temporary file system, kOrigin2 with a persistent | 129 // Sets up kOrigin1 with a temporary file system, kOrigin2 with a persistent |
| 128 // file system, and kOrigin3 with both. | 130 // file system, and kOrigin3 with both. |
| 129 virtual void PopulateTestFileSystemData() { | 131 virtual void PopulateTestFileSystemData() { |
| 130 sandbox_ = profile_.GetFileSystemContext()->path_manager()-> | 132 sandbox_ = profile_.GetFileSystemContext()->path_manager()-> |
| 131 sandbox_provider(); | 133 sandbox_provider(); |
| 132 | 134 |
| 133 CreateDirectoryForOriginAndType(kOrigin1, kTemporary); | 135 CreateDirectoryForOriginAndType(kOrigin1, kTemporary); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 info++; | 278 info++; |
| 277 EXPECT_EQ(kOrigin2, info->origin); | 279 EXPECT_EQ(kOrigin2, info->origin); |
| 278 EXPECT_FALSE(info->has_persistent); | 280 EXPECT_FALSE(info->has_persistent); |
| 279 EXPECT_TRUE(info->has_temporary); | 281 EXPECT_TRUE(info->has_temporary); |
| 280 EXPECT_EQ(0, info->usage_persistent); | 282 EXPECT_EQ(0, info->usage_persistent); |
| 281 EXPECT_EQ(100, info->usage_temporary); | 283 EXPECT_EQ(100, info->usage_temporary); |
| 282 } | 284 } |
| 283 | 285 |
| 284 } // namespace | 286 } // namespace |
| 285 | 287 |
| OLD | NEW |