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

Side by Side Diff: sync/syncable/syncable_unittest.cc

Issue 1471073008: Do not do unnecessary recursive deletes for files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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 | « storage/browser/fileapi/obfuscated_file_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // A variant of SyncableDirectoryTest that uses a real sqlite database. 150 // A variant of SyncableDirectoryTest that uses a real sqlite database.
151 class OnDiskSyncableDirectoryTest : public SyncableDirectoryTest { 151 class OnDiskSyncableDirectoryTest : public SyncableDirectoryTest {
152 protected: 152 protected:
153 // SetUp() is called before each test case is run. 153 // SetUp() is called before each test case is run.
154 // The sqlite3 DB is deleted before each test is run. 154 // The sqlite3 DB is deleted before each test is run.
155 void SetUp() override { 155 void SetUp() override {
156 SyncableDirectoryTest::SetUp(); 156 SyncableDirectoryTest::SetUp();
157 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 157 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
158 file_path_ = temp_dir_.path().Append( 158 file_path_ = temp_dir_.path().Append(
159 FILE_PATH_LITERAL("Test.sqlite3")); 159 FILE_PATH_LITERAL("Test.sqlite3"));
160 base::DeleteFile(file_path_, true); 160 base::DeleteFile(file_path_, false);
161 CreateDirectory(); 161 CreateDirectory();
162 } 162 }
163 163
164 void TearDown() override { 164 void TearDown() override {
165 // This also closes file handles. 165 // This also closes file handles.
166 dir()->SaveChanges(); 166 dir()->SaveChanges();
167 dir().reset(); 167 dir().reset();
168 base::DeleteFile(file_path_, true); 168 base::DeleteFile(file_path_, false);
169 SyncableDirectoryTest::TearDown(); 169 SyncableDirectoryTest::TearDown();
170 } 170 }
171 171
172 // Creates a new directory. Deletes the old directory, if it exists. 172 // Creates a new directory. Deletes the old directory, if it exists.
173 void CreateDirectory() { 173 void CreateDirectory() {
174 test_directory_ = TestDirectory::Create( 174 test_directory_ = TestDirectory::Create(
175 encryptor(), 175 encryptor(),
176 MakeWeakHandle(unrecoverable_error_handler()->GetWeakPtr()), 176 MakeWeakHandle(unrecoverable_error_handler()->GetWeakPtr()),
177 kDirectoryName, file_path_); 177 kDirectoryName, file_path_);
178 dir().reset(test_directory_); 178 dir().reset(test_directory_);
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 TEST_F(SyncableClientTagTest, TestClientTagIndexDuplicateServer) { 670 TEST_F(SyncableClientTagTest, TestClientTagIndexDuplicateServer) {
671 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); 671 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true));
672 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); 672 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true));
673 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); 673 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false));
674 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); 674 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false));
675 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); 675 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true));
676 } 676 }
677 677
678 } // namespace syncable 678 } // namespace syncable
679 } // namespace syncer 679 } // namespace syncer
OLDNEW
« no previous file with comments | « storage/browser/fileapi/obfuscated_file_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698