| 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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 class SyncGenericChangeProcessorTest : public testing::Test { | 104 class SyncGenericChangeProcessorTest : public testing::Test { |
| 105 public: | 105 public: |
| 106 // Most test cases will use this type. For those that need a | 106 // Most test cases will use this type. For those that need a |
| 107 // GenericChangeProcessor for a different type, use |InitializeForType|. | 107 // GenericChangeProcessor for a different type, use |InitializeForType|. |
| 108 static const syncer::ModelType kType = syncer::PREFERENCES; | 108 static const syncer::ModelType kType = syncer::PREFERENCES; |
| 109 | 109 |
| 110 SyncGenericChangeProcessorTest() | 110 SyncGenericChangeProcessorTest() |
| 111 : syncable_service_ptr_factory_(&fake_syncable_service_), | 111 : syncable_service_ptr_factory_(&fake_syncable_service_), |
| 112 mock_attachment_service_(NULL) {} | 112 mock_attachment_service_(NULL) {} |
| 113 | 113 |
| 114 virtual void SetUp() override { | 114 void SetUp() override { |
| 115 // Use kType by default, but allow test cases to re-initialize with whatever | 115 // Use kType by default, but allow test cases to re-initialize with whatever |
| 116 // type they choose. Therefore, it's important that all type dependent | 116 // type they choose. Therefore, it's important that all type dependent |
| 117 // initialization occurs in InitializeForType. | 117 // initialization occurs in InitializeForType. |
| 118 InitializeForType(kType); | 118 InitializeForType(kType); |
| 119 } | 119 } |
| 120 | 120 |
| 121 virtual void TearDown() override { | 121 void TearDown() override { |
| 122 mock_attachment_service_ = NULL; | 122 mock_attachment_service_ = NULL; |
| 123 if (test_user_share_) { | 123 if (test_user_share_) { |
| 124 test_user_share_->TearDown(); | 124 test_user_share_->TearDown(); |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Initialize GenericChangeProcessor and related classes for testing with | 128 // Initialize GenericChangeProcessor and related classes for testing with |
| 129 // model type |type|. | 129 // model type |type|. |
| 130 void InitializeForType(syncer::ModelType type) { | 130 void InitializeForType(syncer::ModelType type) { |
| 131 TearDown(); | 131 TearDown(); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 // AttachmentService to upload id1 only. | 476 // AttachmentService to upload id1 only. |
| 477 ConstructGenericChangeProcessor(kType); | 477 ConstructGenericChangeProcessor(kType); |
| 478 ASSERT_EQ(1U, mock_attachment_service()->attachment_id_sets()->size()); | 478 ASSERT_EQ(1U, mock_attachment_service()->attachment_id_sets()->size()); |
| 479 ASSERT_THAT(mock_attachment_service()->attachment_id_sets()->front(), | 479 ASSERT_THAT(mock_attachment_service()->attachment_id_sets()->front(), |
| 480 testing::UnorderedElementsAre(id1)); | 480 testing::UnorderedElementsAre(id1)); |
| 481 } | 481 } |
| 482 | 482 |
| 483 } // namespace | 483 } // namespace |
| 484 | 484 |
| 485 } // namespace sync_driver | 485 } // namespace sync_driver |
| OLD | NEW |