| 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 "content/browser/storage_partition_impl_map.h" | 5 #include "content/browser/storage_partition_impl_map.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 8 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 9 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
| 10 #include "content/public/test/test_browser_context.h" | 12 #include "content/public/test/test_browser_context.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 14 |
| 13 namespace content { | 15 namespace content { |
| 14 | 16 |
| 15 // Test that the Less comparison function is implemented properly to uniquely | 17 // Test that the Less comparison function is implemented properly to uniquely |
| 16 // identify storage partitions used as keys in a std::map. | 18 // identify storage partitions used as keys in a std::map. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 "active", std::string())); | 77 "active", std::string())); |
| 76 ASSERT_TRUE(base::CreateDirectory(active_path)); | 78 ASSERT_TRUE(base::CreateDirectory(active_path)); |
| 77 active_paths->insert(active_path); | 79 active_paths->insert(active_path); |
| 78 | 80 |
| 79 base::FilePath inactive_path = browser_context.GetPath().Append( | 81 base::FilePath inactive_path = browser_context.GetPath().Append( |
| 80 StoragePartitionImplMap::GetStoragePartitionPath( | 82 StoragePartitionImplMap::GetStoragePartitionPath( |
| 81 "inactive", std::string())); | 83 "inactive", std::string())); |
| 82 ASSERT_TRUE(base::CreateDirectory(inactive_path)); | 84 ASSERT_TRUE(base::CreateDirectory(inactive_path)); |
| 83 | 85 |
| 84 base::RunLoop run_loop; | 86 base::RunLoop run_loop; |
| 85 storage_partition_impl_map.GarbageCollect( | 87 storage_partition_impl_map.GarbageCollect(std::move(active_paths), |
| 86 active_paths.Pass(), run_loop.QuitClosure()); | 88 run_loop.QuitClosure()); |
| 87 run_loop.Run(); | 89 run_loop.Run(); |
| 88 BrowserThread::GetBlockingPool()->FlushForTesting(); | 90 BrowserThread::GetBlockingPool()->FlushForTesting(); |
| 89 | 91 |
| 90 EXPECT_TRUE(base::PathExists(active_path)); | 92 EXPECT_TRUE(base::PathExists(active_path)); |
| 91 EXPECT_FALSE(base::PathExists(inactive_path)); | 93 EXPECT_FALSE(base::PathExists(inactive_path)); |
| 92 } | 94 } |
| 93 | 95 |
| 94 } // namespace content | 96 } // namespace content |
| OLD | NEW |