| 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 "components/sync/driver/generic_change_processor.h" | 5 #include "components/sync/driver/generic_change_processor.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 class SyncGenericChangeProcessorTest : public testing::Test { | 120 class SyncGenericChangeProcessorTest : public testing::Test { |
| 121 public: | 121 public: |
| 122 // Most test cases will use this type. For those that need a | 122 // Most test cases will use this type. For those that need a |
| 123 // GenericChangeProcessor for a different type, use |InitializeForType|. | 123 // GenericChangeProcessor for a different type, use |InitializeForType|. |
| 124 static const ModelType kType = PREFERENCES; | 124 static const ModelType kType = PREFERENCES; |
| 125 | 125 |
| 126 SyncGenericChangeProcessorTest() | 126 SyncGenericChangeProcessorTest() |
| 127 : syncable_service_ptr_factory_(&fake_syncable_service_), | 127 : syncable_service_ptr_factory_(&fake_syncable_service_), |
| 128 mock_attachment_service_(NULL), | 128 mock_attachment_service_(nullptr), |
| 129 sync_client_(&sync_factory_) {} | 129 sync_client_(&sync_factory_) {} |
| 130 | 130 |
| 131 void SetUp() override { | 131 void SetUp() override { |
| 132 // Use kType by default, but allow test cases to re-initialize with whatever | 132 // Use kType by default, but allow test cases to re-initialize with whatever |
| 133 // type they choose. Therefore, it's important that all type dependent | 133 // type they choose. Therefore, it's important that all type dependent |
| 134 // initialization occurs in InitializeForType. | 134 // initialization occurs in InitializeForType. |
| 135 InitializeForType(kType); | 135 InitializeForType(kType); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void TearDown() override { | 138 void TearDown() override { |
| 139 mock_attachment_service_ = NULL; | 139 mock_attachment_service_ = nullptr; |
| 140 if (test_user_share_) { | 140 if (test_user_share_) { |
| 141 test_user_share_->TearDown(); | 141 test_user_share_->TearDown(); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 // Initialize GenericChangeProcessor and related classes for testing with | 145 // Initialize GenericChangeProcessor and related classes for testing with |
| 146 // model type |type|. | 146 // model type |type|. |
| 147 void InitializeForType(ModelType type) { | 147 void InitializeForType(ModelType type) { |
| 148 TearDown(); | 148 TearDown(); |
| 149 test_user_share_ = base::MakeUnique<TestUserShare>(); | 149 test_user_share_ = base::MakeUnique<TestUserShare>(); |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 SyncDataList sync_data = change_processor()->GetAllSyncData(SESSIONS); | 502 SyncDataList sync_data = change_processor()->GetAllSyncData(SESSIONS); |
| 503 ASSERT_EQ(sync_data.size(), 1U); | 503 ASSERT_EQ(sync_data.size(), 1U); |
| 504 ASSERT_EQ("session tag 2", | 504 ASSERT_EQ("session tag 2", |
| 505 sync_data[0].GetSpecifics().session().session_tag()); | 505 sync_data[0].GetSpecifics().session().session_tag()); |
| 506 EXPECT_FALSE(SyncDataRemote(sync_data[0]).GetClientTagHash().empty()); | 506 EXPECT_FALSE(SyncDataRemote(sync_data[0]).GetClientTagHash().empty()); |
| 507 } | 507 } |
| 508 | 508 |
| 509 } // namespace | 509 } // namespace |
| 510 | 510 |
| 511 } // namespace syncer | 511 } // namespace syncer |
| OLD | NEW |