| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/sync/internal_api/change_record.h" | 5 #include "chrome/browser/sync/internal_api/change_record.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/test/values_test_util.h" | 9 #include "base/test/values_test_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 class MockExtraChangeRecordData | 70 class MockExtraChangeRecordData |
| 71 : public ExtraPasswordChangeRecordData { | 71 : public ExtraPasswordChangeRecordData { |
| 72 public: | 72 public: |
| 73 MOCK_CONST_METHOD0(ToValue, DictionaryValue*()); | 73 MOCK_CONST_METHOD0(ToValue, DictionaryValue*()); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 TEST_F(ChangeRecordTest, ChangeRecordToValue) { | 76 TEST_F(ChangeRecordTest, ChangeRecordToValue) { |
| 77 sync_pb::EntitySpecifics old_specifics; | 77 sync_pb::EntitySpecifics old_specifics; |
| 78 old_specifics.MutableExtension(sync_pb::extension)->set_id("old"); | 78 old_specifics.mutable_extension()->set_id("old"); |
| 79 sync_pb::EntitySpecifics new_specifics; | 79 sync_pb::EntitySpecifics new_specifics; |
| 80 old_specifics.MutableExtension(sync_pb::extension)->set_id("new"); | 80 old_specifics.mutable_extension()->set_id("new"); |
| 81 | 81 |
| 82 const int64 kTestId = 5; | 82 const int64 kTestId = 5; |
| 83 | 83 |
| 84 // Add | 84 // Add |
| 85 { | 85 { |
| 86 ChangeRecord record; | 86 ChangeRecord record; |
| 87 record.action = ChangeRecord::ACTION_ADD; | 87 record.action = ChangeRecord::ACTION_ADD; |
| 88 record.id = kTestId; | 88 record.id = kTestId; |
| 89 record.specifics = old_specifics; | 89 record.specifics = old_specifics; |
| 90 record.extra.reset(new StrictMock<MockExtraChangeRecordData>()); | 90 record.extra.reset(new StrictMock<MockExtraChangeRecordData>()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 Invoke(&extra_value, &DictionaryValue::DeepCopy)); | 128 Invoke(&extra_value, &DictionaryValue::DeepCopy)); |
| 129 | 129 |
| 130 record.extra.reset(extra.release()); | 130 record.extra.reset(extra.release()); |
| 131 scoped_ptr<DictionaryValue> value(record.ToValue()); | 131 scoped_ptr<DictionaryValue> value(record.ToValue()); |
| 132 CheckChangeRecordValue(record, *value); | 132 CheckChangeRecordValue(record, *value); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace | 136 } // namespace |
| 137 } // namespace sync_api | 137 } // namespace sync_api |
| OLD | NEW |