Chromium Code Reviews| 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/syncer_util.h" | 5 #include "sync/engine/syncer_util.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
|
Nicolas Zea
2016/04/07 21:48:58
include memory?
| |
| 8 | 8 |
| 9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "sync/internal_api/public/base/unique_position.h" | 10 #include "sync/internal_api/public/base/unique_position.h" |
| 11 #include "sync/internal_api/public/test/test_entry_factory.h" | 11 #include "sync/internal_api/public/test/test_entry_factory.h" |
| 12 #include "sync/protocol/sync.pb.h" | 12 #include "sync/protocol/sync.pb.h" |
| 13 #include "sync/syncable/mutable_entry.h" | 13 #include "sync/syncable/mutable_entry.h" |
| 14 #include "sync/syncable/syncable_write_transaction.h" | 14 #include "sync/syncable/syncable_write_transaction.h" |
| 15 #include "sync/test/engine/test_directory_setter_upper.h" | 15 #include "sync/test/engine/test_directory_setter_upper.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 } | 65 } |
| 66 | 66 |
| 67 void InitInt64Position(int64_t pos_value) { | 67 void InitInt64Position(int64_t pos_value) { |
| 68 update.set_position_in_parent(pos_value); | 68 update.set_position_in_parent(pos_value); |
| 69 } | 69 } |
| 70 | 70 |
| 71 sync_pb::SyncEntity update; | 71 sync_pb::SyncEntity update; |
| 72 UniquePosition test_position; | 72 UniquePosition test_position; |
| 73 base::MessageLoop message_loop_; | 73 base::MessageLoop message_loop_; |
| 74 TestDirectorySetterUpper dir_maker_; | 74 TestDirectorySetterUpper dir_maker_; |
| 75 scoped_ptr<TestEntryFactory> entry_factory_; | 75 std::unique_ptr<TestEntryFactory> entry_factory_; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 // Generate a suffix from originator client GUID and client-assigned ID. These | 78 // Generate a suffix from originator client GUID and client-assigned ID. These |
| 79 // values should always be present in updates sent down to the client, and | 79 // values should always be present in updates sent down to the client, and |
| 80 // combine to create a globally unique value. | 80 // combine to create a globally unique value. |
| 81 TEST_F(GetUpdatePositionTest, SuffixFromUpdate) { | 81 TEST_F(GetUpdatePositionTest, SuffixFromUpdate) { |
| 82 InitSuffixIngredients(); | 82 InitSuffixIngredients(); |
| 83 | 83 |
| 84 // Expect suffix is valid and consistent. | 84 // Expect suffix is valid and consistent. |
| 85 std::string suffix1 = GetUniqueBookmarkTagFromUpdate(update); | 85 std::string suffix1 = GetUniqueBookmarkTagFromUpdate(update); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 EXPECT_FALSE(UniquePosition::IsValidSuffix(target.GetUniqueBookmarkTag())); | 223 EXPECT_FALSE(UniquePosition::IsValidSuffix(target.GetUniqueBookmarkTag())); |
| 224 EXPECT_FALSE(target.GetServerUniquePosition().IsValid()); | 224 EXPECT_FALSE(target.GetServerUniquePosition().IsValid()); |
| 225 UpdateServerFieldsFromUpdate(&target, invalid_update, "name"); | 225 UpdateServerFieldsFromUpdate(&target, invalid_update, "name"); |
| 226 | 226 |
| 227 // After update, target has valid bookmark tag and unique position. | 227 // After update, target has valid bookmark tag and unique position. |
| 228 EXPECT_TRUE(UniquePosition::IsValidSuffix(target.GetUniqueBookmarkTag())); | 228 EXPECT_TRUE(UniquePosition::IsValidSuffix(target.GetUniqueBookmarkTag())); |
| 229 EXPECT_TRUE(target.GetServerUniquePosition().IsValid()); | 229 EXPECT_TRUE(target.GetServerUniquePosition().IsValid()); |
| 230 } | 230 } |
| 231 | 231 |
| 232 } // namespace syncer | 232 } // namespace syncer |
| OLD | NEW |