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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "net/disk_cache/cache_util.h" | 7 #include "net/disk_cache/cache_util.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "testing/platform_test.h" | 9 #include "testing/platform_test.h" |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 EXPECT_FALSE(base::PathExists(cache_dir_)); // old cache is gone | 58 EXPECT_FALSE(base::PathExists(cache_dir_)); // old cache is gone |
59 #endif | 59 #endif |
60 EXPECT_FALSE(base::PathExists(file1_)); | 60 EXPECT_FALSE(base::PathExists(file1_)); |
61 EXPECT_FALSE(base::PathExists(file2_)); | 61 EXPECT_FALSE(base::PathExists(file2_)); |
62 EXPECT_FALSE(base::PathExists(dir1_)); | 62 EXPECT_FALSE(base::PathExists(dir1_)); |
63 } | 63 } |
64 | 64 |
65 TEST_F(CacheUtilTest, DeleteCache) { | 65 TEST_F(CacheUtilTest, DeleteCache) { |
66 // DeleteCache won't delete subdirs, so let's not start with this | 66 // DeleteCache won't delete subdirs, so let's not start with this |
67 // one around. | 67 // one around. |
68 base::Delete(dir1_, false); | 68 base::DeleteFile(dir1_, false); |
69 disk_cache::DeleteCache(cache_dir_, false); | 69 disk_cache::DeleteCache(cache_dir_, false); |
70 EXPECT_TRUE(base::PathExists(cache_dir_)); // cache dir stays | 70 EXPECT_TRUE(base::PathExists(cache_dir_)); // cache dir stays |
71 EXPECT_FALSE(base::PathExists(file1_)); | 71 EXPECT_FALSE(base::PathExists(file1_)); |
72 EXPECT_FALSE(base::PathExists(file2_)); | 72 EXPECT_FALSE(base::PathExists(file2_)); |
73 } | 73 } |
74 | 74 |
75 TEST_F(CacheUtilTest, DeleteCacheAndDir) { | 75 TEST_F(CacheUtilTest, DeleteCacheAndDir) { |
76 // DeleteCache won't delete subdirs, so let's not start with this | 76 // DeleteCache won't delete subdirs, so let's not start with this |
77 // one around. | 77 // one around. |
78 base::Delete(dir1_, false); | 78 base::DeleteFile(dir1_, false); |
79 disk_cache::DeleteCache(cache_dir_, true); | 79 disk_cache::DeleteCache(cache_dir_, true); |
80 EXPECT_FALSE(base::PathExists(cache_dir_)); // cache dir is gone | 80 EXPECT_FALSE(base::PathExists(cache_dir_)); // cache dir is gone |
81 EXPECT_FALSE(base::PathExists(file1_)); | 81 EXPECT_FALSE(base::PathExists(file1_)); |
82 EXPECT_FALSE(base::PathExists(file2_)); | 82 EXPECT_FALSE(base::PathExists(file2_)); |
83 } | 83 } |
84 | 84 |
85 TEST_F(CacheUtilTest, DeleteCacheFile) { | 85 TEST_F(CacheUtilTest, DeleteCacheFile) { |
86 EXPECT_TRUE(disk_cache::DeleteCacheFile(file1_)); | 86 EXPECT_TRUE(disk_cache::DeleteCacheFile(file1_)); |
87 EXPECT_FALSE(base::PathExists(file1_)); | 87 EXPECT_FALSE(base::PathExists(file1_)); |
88 EXPECT_TRUE(base::PathExists(cache_dir_)); // cache dir stays | 88 EXPECT_TRUE(base::PathExists(cache_dir_)); // cache dir stays |
89 } | 89 } |
90 | 90 |
91 } // namespace disk_cache | 91 } // namespace disk_cache |
OLD | NEW |