| 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/entry_kernel.h" | 5 #include "sync/syncable/entry_kernel.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace syncer { | 9 namespace syncer { |
| 10 | 10 |
| 11 namespace syncable { | 11 namespace syncable { |
| 12 | 12 |
| 13 class EntryKernelTest : public testing::Test {}; | 13 class EntryKernelTest : public testing::Test {}; |
| 14 | 14 |
| 15 TEST_F(EntryKernelTest, ToValue) { | 15 TEST_F(EntryKernelTest, ToValue) { |
| 16 EntryKernel kernel; | 16 EntryKernel kernel; |
| 17 scoped_ptr<base::DictionaryValue> value(kernel.ToValue(NULL)); | 17 scoped_ptr<base::DictionaryValue> value(kernel.ToValue(NULL)); |
| 18 if (value) { | 18 if (value) { |
| 19 // Not much to check without repeating the ToValue() code. | 19 // Not much to check without repeating the ToValue() code. |
| 20 EXPECT_TRUE(value->HasKey("isDirty")); | 20 EXPECT_TRUE(value->HasKey("isDirty")); |
| 21 // The extra +2 is for "isDirty" and "serverModelType". | 21 // The extra +2 is for "isDirty" and "modelType". |
| 22 EXPECT_EQ(BIT_TEMPS_END - BEGIN_FIELDS + 2, | 22 EXPECT_EQ(BIT_TEMPS_END - BEGIN_FIELDS + 2, |
| 23 static_cast<int>(value->size())); | 23 static_cast<int>(value->size())); |
| 24 } else { | 24 } else { |
| 25 ADD_FAILURE(); | 25 ADD_FAILURE(); |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 | 28 |
| 29 bool ProtoFieldValuesEqual(const sync_pb::EntitySpecifics& v1, | 29 bool ProtoFieldValuesEqual(const sync_pb::EntitySpecifics& v1, |
| 30 const sync_pb::EntitySpecifics& v2) { | 30 const sync_pb::EntitySpecifics& v2) { |
| 31 return v1.SerializeAsString() == v2.SerializeAsString(); | 31 return v1.SerializeAsString() == v2.SerializeAsString(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // Put the new value into SPECIFICS and verify that that stops sharing even | 77 // Put the new value into SPECIFICS and verify that that stops sharing even |
| 78 // though the values are still equal. | 78 // though the values are still equal. |
| 79 kernel.put(SPECIFICS, specifics); | 79 kernel.put(SPECIFICS, specifics); |
| 80 EXPECT_FALSE(ProtoFieldValuesAreSame(kernel.ref(SPECIFICS), | 80 EXPECT_FALSE(ProtoFieldValuesAreSame(kernel.ref(SPECIFICS), |
| 81 kernel.ref(SERVER_SPECIFICS))); | 81 kernel.ref(SERVER_SPECIFICS))); |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace syncable | 84 } // namespace syncable |
| 85 | 85 |
| 86 } // namespace syncer | 86 } // namespace syncer |
| OLD | NEW |