OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |