| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/files/file_enumerator.h" |
| 12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 14 #include "base/test/thread_test_helper.h" | 15 #include "base/test/thread_test_helper.h" |
| 15 #include "base/threading/sequenced_worker_pool.h" | 16 #include "base/threading/sequenced_worker_pool.h" |
| 16 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 17 #include "chrome/browser/browsing_data/browsing_data_helper_browsertest.h" | 18 #include "chrome/browser/browsing_data/browsing_data_helper_browsertest.h" |
| 18 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" | 19 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/test/base/in_process_browser_test.h" | 22 #include "chrome/test/base/in_process_browser_test.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 123 } |
| 123 | 124 |
| 124 IN_PROC_BROWSER_TEST_F(BrowsingDataLocalStorageHelperTest, DeleteSingleFile) { | 125 IN_PROC_BROWSER_TEST_F(BrowsingDataLocalStorageHelperTest, DeleteSingleFile) { |
| 125 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper( | 126 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper( |
| 126 new BrowsingDataLocalStorageHelper(browser()->profile())); | 127 new BrowsingDataLocalStorageHelper(browser()->profile())); |
| 127 CreateLocalStorageFilesForTest(); | 128 CreateLocalStorageFilesForTest(); |
| 128 local_storage_helper->DeleteOrigin(GURL(kOriginOfTestFile0)); | 129 local_storage_helper->DeleteOrigin(GURL(kOriginOfTestFile0)); |
| 129 BrowserThread::GetBlockingPool()->FlushForTesting(); | 130 BrowserThread::GetBlockingPool()->FlushForTesting(); |
| 130 | 131 |
| 131 // Ensure the file has been deleted. | 132 // Ensure the file has been deleted. |
| 132 file_util::FileEnumerator file_enumerator( | 133 base::FileEnumerator file_enumerator( |
| 133 GetLocalStoragePathForTestingProfile(), | 134 GetLocalStoragePathForTestingProfile(), |
| 134 false, | 135 false, |
| 135 file_util::FileEnumerator::FILES); | 136 base::FileEnumerator::FILES); |
| 136 int num_files = 0; | 137 int num_files = 0; |
| 137 for (base::FilePath file_path = file_enumerator.Next(); | 138 for (base::FilePath file_path = file_enumerator.Next(); |
| 138 !file_path.empty(); | 139 !file_path.empty(); |
| 139 file_path = file_enumerator.Next()) { | 140 file_path = file_enumerator.Next()) { |
| 140 ASSERT_FALSE(base::FilePath(kTestFile0) == file_path.BaseName()); | 141 ASSERT_FALSE(base::FilePath(kTestFile0) == file_path.BaseName()); |
| 141 ++num_files; | 142 ++num_files; |
| 142 } | 143 } |
| 143 ASSERT_EQ(3, num_files); | 144 ASSERT_EQ(3, num_files); |
| 144 } | 145 } |
| 145 | 146 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 base::Bind(&TestCompletionCallback::callback, | 183 base::Bind(&TestCompletionCallback::callback, |
| 183 base::Unretained(&callback))); | 184 base::Unretained(&callback))); |
| 184 | 185 |
| 185 std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> result = | 186 std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> result = |
| 186 callback.result(); | 187 callback.result(); |
| 187 | 188 |
| 188 ASSERT_EQ(1u, result.size()); | 189 ASSERT_EQ(1u, result.size()); |
| 189 EXPECT_EQ(origin, result.begin()->origin_url); | 190 EXPECT_EQ(origin, result.begin()->origin_url); |
| 190 } | 191 } |
| 191 } // namespace | 192 } // namespace |
| OLD | NEW |