Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1284)

Unified Diff: content/browser/storage_partition_impl_map_unittest.cc

Issue 314293003: [Storage] Normalize storage partition path before garbage collection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: export StoragePartitionImplMap Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/storage_partition_impl_map.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/storage_partition_impl_map_unittest.cc
diff --git a/content/browser/storage_partition_impl_map_unittest.cc b/content/browser/storage_partition_impl_map_unittest.cc
index 04127cce7cb5e6f3f439ad99c60e7590aaa1340b..ae7fa6d43d2409726ece32e8a31b1275ce1eefb0 100644
--- a/content/browser/storage_partition_impl_map_unittest.cc
+++ b/content/browser/storage_partition_impl_map_unittest.cc
@@ -3,16 +3,17 @@
// found in the LICENSE file.
#include "content/browser/storage_partition_impl_map.h"
+
+#include "base/file_util.h"
+#include "base/run_loop.h"
+#include "content/public/test/test_browser_context.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace content {
-class StoragePartitionConfigTest : public testing::Test {
-};
-
// Test that the Less comparison function is implemented properly to uniquely
// identify storage partitions used as keys in a std::map.
-TEST_F(StoragePartitionConfigTest, OperatorLess) {
+TEST(StoragePartitionConfigTest, OperatorLess) {
StoragePartitionImplMap::StoragePartitionConfig c1(
std::string(), std::string(), false);
StoragePartitionImplMap::StoragePartitionConfig c2(
@@ -60,4 +61,32 @@ TEST_F(StoragePartitionConfigTest, OperatorLess) {
EXPECT_TRUE(!less(c1, c2) && !less(c2, c1));
}
+TEST(StoragePartitionImplMapTest, GarbageCollect) {
+ base::MessageLoop message_loop;
+ TestBrowserContext browser_context;
+ StoragePartitionImplMap storage_partition_impl_map(&browser_context);
+
+ scoped_ptr<base::hash_set<base::FilePath> > active_paths(
+ new base::hash_set<base::FilePath>);
+
+ base::FilePath active_path = browser_context.GetPath().Append(
+ StoragePartitionImplMap::GetStoragePartitionPath(
+ "active", std::string()));
+ ASSERT_TRUE(base::CreateDirectory(active_path));
+ active_paths->insert(active_path);
+
+ base::FilePath inactive_path = browser_context.GetPath().Append(
+ StoragePartitionImplMap::GetStoragePartitionPath(
+ "inactive", std::string()));
+ ASSERT_TRUE(base::CreateDirectory(inactive_path));
+
+ base::RunLoop run_loop;
+ storage_partition_impl_map.GarbageCollect(
+ active_paths.Pass(), run_loop.QuitClosure());
+ run_loop.Run();
+
+ EXPECT_TRUE(base::PathExists(active_path));
+ EXPECT_FALSE(base::PathExists(inactive_path));
+}
+
} // namespace content
« no previous file with comments | « content/browser/storage_partition_impl_map.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698