| 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/syncable/directory_unittest.h" | 5 #include "sync/syncable/directory_unittest.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/test/values_test_util.h" | 9 #include "base/test/values_test_util.h" |
| 10 #include "sync/internal_api/public/base/attachment_id_proto.h" | 10 #include "sync/internal_api/public/base/attachment_id_proto.h" |
| (...skipping 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2103 item.GetServerSpecifics())); | 2103 item.GetServerSpecifics())); |
| 2104 | 2104 |
| 2105 // Verify sharing with BASE_SERVER_SPECIFICS. | 2105 // Verify sharing with BASE_SERVER_SPECIFICS. |
| 2106 EXPECT_FALSE(EntitySpecificsValuesAreSame(item.GetServerSpecifics(), | 2106 EXPECT_FALSE(EntitySpecificsValuesAreSame(item.GetServerSpecifics(), |
| 2107 item.GetBaseServerSpecifics())); | 2107 item.GetBaseServerSpecifics())); |
| 2108 item.PutBaseServerSpecifics(specifics3); | 2108 item.PutBaseServerSpecifics(specifics3); |
| 2109 EXPECT_TRUE(EntitySpecificsValuesAreSame(item.GetServerSpecifics(), | 2109 EXPECT_TRUE(EntitySpecificsValuesAreSame(item.GetServerSpecifics(), |
| 2110 item.GetBaseServerSpecifics())); | 2110 item.GetBaseServerSpecifics())); |
| 2111 } | 2111 } |
| 2112 | 2112 |
| 2113 // Tests checking and marking a type as having its initial sync completed. |
| 2114 TEST_F(SyncableDirectoryTest, InitialSyncEndedForType) { |
| 2115 // Not completed if there is no root node. |
| 2116 EXPECT_FALSE(dir()->InitialSyncEndedForType(PREFERENCES)); |
| 2117 |
| 2118 WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); |
| 2119 // Create the root node. |
| 2120 ModelNeutralMutableEntry entry(&trans, syncable::CREATE_NEW_TYPE_ROOT, |
| 2121 PREFERENCES); |
| 2122 DCHECK(entry.good()); |
| 2123 |
| 2124 entry.PutServerIsDir(true); |
| 2125 entry.PutUniqueServerTag(ModelTypeToRootTag(PREFERENCES)); |
| 2126 |
| 2127 // Should still be marked as incomplete. |
| 2128 EXPECT_FALSE(dir()->InitialSyncEndedForType(&trans, PREFERENCES)); |
| 2129 |
| 2130 // Mark as complete and verify. |
| 2131 dir()->MarkInitialSyncEndedForType(&trans, PREFERENCES); |
| 2132 EXPECT_TRUE(dir()->InitialSyncEndedForType(&trans, PREFERENCES)); |
| 2133 } |
| 2134 |
| 2113 } // namespace syncable | 2135 } // namespace syncable |
| 2114 | 2136 |
| 2115 } // namespace syncer | 2137 } // namespace syncer |
| OLD | NEW |