OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "sync/engine/directory_commit_contribution.h" | 5 #include "sync/engine/directory_commit_contribution.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "sync/internal_api/public/base/attachment_id_proto.h" | 8 #include "sync/internal_api/public/base/attachment_id_proto.h" |
9 #include "sync/sessions/status_controller.h" | 9 #include "sync/sessions/status_controller.h" |
10 #include "sync/syncable/entry.h" | 10 #include "sync/syncable/entry.h" |
11 #include "sync/syncable/mutable_entry.h" | 11 #include "sync/syncable/mutable_entry.h" |
12 #include "sync/syncable/syncable_read_transaction.h" | 12 #include "sync/syncable/syncable_read_transaction.h" |
13 #include "sync/syncable/syncable_write_transaction.h" | 13 #include "sync/syncable/syncable_write_transaction.h" |
14 #include "sync/test/engine/test_directory_setter_upper.h" | 14 #include "sync/test/engine/test_directory_setter_upper.h" |
15 #include "sync/test/engine/test_id_factory.h" | 15 #include "sync/test/engine/test_id_factory.h" |
16 #include "sync/test/engine/test_syncable_utils.h" | 16 #include "sync/test/engine/test_syncable_utils.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 namespace syncer { | 19 namespace syncer { |
20 | 20 |
21 class DirectoryCommitContributionTest : public ::testing::Test { | 21 class DirectoryCommitContributionTest : public ::testing::Test { |
22 public: | 22 public: |
23 virtual void SetUp() override { | 23 void SetUp() override { |
24 dir_maker_.SetUp(); | 24 dir_maker_.SetUp(); |
25 | 25 |
26 syncable::WriteTransaction trans(FROM_HERE, syncable::UNITTEST, dir()); | 26 syncable::WriteTransaction trans(FROM_HERE, syncable::UNITTEST, dir()); |
27 CreateTypeRoot(&trans, dir(), PREFERENCES); | 27 CreateTypeRoot(&trans, dir(), PREFERENCES); |
28 CreateTypeRoot(&trans, dir(), EXTENSIONS); | 28 CreateTypeRoot(&trans, dir(), EXTENSIONS); |
29 CreateTypeRoot(&trans, dir(), ARTICLES); | 29 CreateTypeRoot(&trans, dir(), ARTICLES); |
30 CreateTypeRoot(&trans, dir(), BOOKMARKS); | 30 CreateTypeRoot(&trans, dir(), BOOKMARKS); |
31 } | 31 } |
32 | 32 |
33 virtual void TearDown() override { | 33 void TearDown() override { dir_maker_.TearDown(); } |
34 dir_maker_.TearDown(); | |
35 } | |
36 | 34 |
37 protected: | 35 protected: |
38 int64 CreateUnsyncedItemWithAttachments( | 36 int64 CreateUnsyncedItemWithAttachments( |
39 syncable::WriteTransaction* trans, | 37 syncable::WriteTransaction* trans, |
40 ModelType type, | 38 ModelType type, |
41 const std::string& tag, | 39 const std::string& tag, |
42 const sync_pb::AttachmentMetadata& attachment_metadata) { | 40 const sync_pb::AttachmentMetadata& attachment_metadata) { |
43 syncable::Entry parent_entry(trans, syncable::GET_TYPE_ROOT, type); | 41 syncable::Entry parent_entry(trans, syncable::GET_TYPE_ROOT, type); |
44 syncable::MutableEntry entry( | 42 syncable::MutableEntry entry( |
45 trans, | 43 trans, |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 syncable::Entry a3(&trans, syncable::GET_BY_HANDLE, art3_handle); | 493 syncable::Entry a3(&trans, syncable::GET_BY_HANDLE, art3_handle); |
496 EXPECT_FALSE(a3.GetId().ServerKnows()); | 494 EXPECT_FALSE(a3.GetId().ServerKnows()); |
497 EXPECT_FALSE(a3.GetSyncing()); | 495 EXPECT_FALSE(a3.GetSyncing()); |
498 EXPECT_EQ(0, a3.GetServerVersion()); | 496 EXPECT_EQ(0, a3.GetServerVersion()); |
499 } | 497 } |
500 | 498 |
501 art_cc->CleanUp(); | 499 art_cc->CleanUp(); |
502 } | 500 } |
503 | 501 |
504 } // namespace syncer | 502 } // namespace syncer |
OLD | NEW |