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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/memory/ptr_util.h" |
16 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
17 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
18 #include "base/synchronization/condition_variable.h" | 19 #include "base/synchronization/condition_variable.h" |
19 #include "base/test/values_test_util.h" | 20 #include "base/test/values_test_util.h" |
20 #include "base/threading/platform_thread.h" | 21 #include "base/threading/platform_thread.h" |
21 #include "base/values.h" | 22 #include "base/values.h" |
22 #include "build/build_config.h" | 23 #include "build/build_config.h" |
23 #include "components/sync/base/fake_encryptor.h" | 24 #include "components/sync/base/fake_encryptor.h" |
24 #include "components/sync/base/test_unrecoverable_error_handler.h" | 25 #include "components/sync/base/test_unrecoverable_error_handler.h" |
25 #include "components/sync/protocol/bookmark_specifics.pb.h" | 26 #include "components/sync/protocol/bookmark_specifics.pb.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 specifics.mutable_bookmark()->set_favicon("PNG"); | 336 specifics.mutable_bookmark()->set_favicon("PNG"); |
336 specifics.mutable_bookmark()->set_url("http://nowhere"); | 337 specifics.mutable_bookmark()->set_url("http://nowhere"); |
337 create.PutSpecifics(specifics); | 338 create.PutSpecifics(specifics); |
338 update.PutServerSpecifics(specifics); | 339 update.PutServerSpecifics(specifics); |
339 create_pre_save = create.GetKernelCopy(); | 340 create_pre_save = create.GetKernelCopy(); |
340 update_pre_save = update.GetKernelCopy(); | 341 update_pre_save = update.GetKernelCopy(); |
341 create_id = create.GetId(); | 342 create_id = create.GetId(); |
342 } | 343 } |
343 | 344 |
344 dir()->SaveChanges(); | 345 dir()->SaveChanges(); |
345 dir().reset( | 346 dir() = base::MakeUnique<Directory>( |
346 new Directory(new OnDiskDirectoryBackingStore(kDirectoryName, file_path_), | 347 new OnDiskDirectoryBackingStore(kDirectoryName, file_path_), |
347 MakeWeakHandle(unrecoverable_error_handler()->GetWeakPtr()), | 348 MakeWeakHandle(unrecoverable_error_handler()->GetWeakPtr()), |
348 base::Closure(), NULL, NULL)); | 349 base::Closure(), nullptr, nullptr); |
349 | 350 |
350 ASSERT_TRUE(dir().get()); | 351 ASSERT_TRUE(dir().get()); |
351 ASSERT_EQ(OPENED, dir()->Open(kDirectoryName, directory_change_delegate(), | 352 ASSERT_EQ(OPENED, dir()->Open(kDirectoryName, directory_change_delegate(), |
352 NullTransactionObserver())); | 353 NullTransactionObserver())); |
353 ASSERT_TRUE(dir()->good()); | 354 ASSERT_TRUE(dir()->good()); |
354 | 355 |
355 { | 356 { |
356 ReadTransaction trans(FROM_HERE, dir().get()); | 357 ReadTransaction trans(FROM_HERE, dir().get()); |
357 Entry create(&trans, GET_BY_ID, create_id); | 358 Entry create(&trans, GET_BY_ID, create_id); |
358 EXPECT_EQ(1, CountEntriesWithName(&trans, trans.root_id(), create_name)); | 359 EXPECT_EQ(1, CountEntriesWithName(&trans, trans.root_id(), create_name)); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 TEST_F(SyncableClientTagTest, TestClientTagIndexDuplicateServer) { | 656 TEST_F(SyncableClientTagTest, TestClientTagIndexDuplicateServer) { |
656 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); | 657 EXPECT_TRUE(CreateWithDefaultTag(factory_.NewServerId(), true)); |
657 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); | 658 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), true)); |
658 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); | 659 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewServerId(), false)); |
659 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); | 660 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), false)); |
660 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); | 661 EXPECT_FALSE(CreateWithDefaultTag(factory_.NewLocalId(), true)); |
661 } | 662 } |
662 | 663 |
663 } // namespace syncable | 664 } // namespace syncable |
664 } // namespace syncer | 665 } // namespace syncer |
OLD | NEW |