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

Side by Side Diff: net/disk_cache/cache_util_unittest.cc

Issue 669813003: Update from chromium https://crrev.com/301725/ (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « net/cookies/cookie_store_test_helpers.cc ('k') | net/disk_cache/disk_cache_test_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/files/file_util.h" 5 #include "base/files/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
11 namespace disk_cache { 11 namespace disk_cache {
12 12
13 class CacheUtilTest : public PlatformTest { 13 class CacheUtilTest : public PlatformTest {
14 public: 14 public:
15 virtual void SetUp() { 15 void SetUp() override {
16 PlatformTest::SetUp(); 16 PlatformTest::SetUp();
17 ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir()); 17 ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir());
18 cache_dir_ = tmp_dir_.path().Append(FILE_PATH_LITERAL("Cache")); 18 cache_dir_ = tmp_dir_.path().Append(FILE_PATH_LITERAL("Cache"));
19 file1_ = base::FilePath(cache_dir_.Append(FILE_PATH_LITERAL("file01"))); 19 file1_ = base::FilePath(cache_dir_.Append(FILE_PATH_LITERAL("file01")));
20 file2_ = base::FilePath(cache_dir_.Append(FILE_PATH_LITERAL(".file02"))); 20 file2_ = base::FilePath(cache_dir_.Append(FILE_PATH_LITERAL(".file02")));
21 dir1_ = base::FilePath(cache_dir_.Append(FILE_PATH_LITERAL("dir01"))); 21 dir1_ = base::FilePath(cache_dir_.Append(FILE_PATH_LITERAL("dir01")));
22 file3_ = base::FilePath(dir1_.Append(FILE_PATH_LITERAL("file03"))); 22 file3_ = base::FilePath(dir1_.Append(FILE_PATH_LITERAL("file03")));
23 ASSERT_TRUE(base::CreateDirectory(cache_dir_)); 23 ASSERT_TRUE(base::CreateDirectory(cache_dir_));
24 FILE *fp = base::OpenFile(file1_, "w"); 24 FILE *fp = base::OpenFile(file1_, "w");
25 ASSERT_TRUE(fp != NULL); 25 ASSERT_TRUE(fp != NULL);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 TEST_F(CacheUtilTest, DeleteCacheFile) { 88 TEST_F(CacheUtilTest, DeleteCacheFile) {
89 EXPECT_TRUE(disk_cache::DeleteCacheFile(file1_)); 89 EXPECT_TRUE(disk_cache::DeleteCacheFile(file1_));
90 EXPECT_FALSE(base::PathExists(file1_)); 90 EXPECT_FALSE(base::PathExists(file1_));
91 EXPECT_TRUE(base::PathExists(cache_dir_)); // cache dir stays 91 EXPECT_TRUE(base::PathExists(cache_dir_)); // cache dir stays
92 EXPECT_TRUE(base::PathExists(dir1_)); 92 EXPECT_TRUE(base::PathExists(dir1_));
93 EXPECT_TRUE(base::PathExists(file3_)); 93 EXPECT_TRUE(base::PathExists(file3_));
94 } 94 }
95 95
96 } // namespace disk_cache 96 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/cookies/cookie_store_test_helpers.cc ('k') | net/disk_cache/disk_cache_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698