Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: components/sync_driver/generic_change_processor_unittest.cc

Issue 623133002: replace OVERRIDE and FINAL with override and final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 23 matching lines...) Expand all
34 34
35 namespace { 35 namespace {
36 36
37 // A mock that keeps track of attachments passed to UploadAttachments. 37 // A mock that keeps track of attachments passed to UploadAttachments.
38 class MockAttachmentService : public syncer::AttachmentServiceImpl { 38 class MockAttachmentService : public syncer::AttachmentServiceImpl {
39 public: 39 public:
40 MockAttachmentService( 40 MockAttachmentService(
41 const scoped_refptr<syncer::AttachmentStore>& attachment_store); 41 const scoped_refptr<syncer::AttachmentStore>& attachment_store);
42 virtual ~MockAttachmentService(); 42 virtual ~MockAttachmentService();
43 virtual void UploadAttachments( 43 virtual void UploadAttachments(
44 const syncer::AttachmentIdSet& attachment_ids) OVERRIDE; 44 const syncer::AttachmentIdSet& attachment_ids) override;
45 std::vector<syncer::AttachmentIdSet>* attachment_id_sets(); 45 std::vector<syncer::AttachmentIdSet>* attachment_id_sets();
46 46
47 private: 47 private:
48 std::vector<syncer::AttachmentIdSet> attachment_id_sets_; 48 std::vector<syncer::AttachmentIdSet> attachment_id_sets_;
49 }; 49 };
50 50
51 MockAttachmentService::MockAttachmentService( 51 MockAttachmentService::MockAttachmentService(
52 const scoped_refptr<syncer::AttachmentStore>& attachment_store) 52 const scoped_refptr<syncer::AttachmentStore>& attachment_store)
53 : AttachmentServiceImpl(attachment_store, 53 : AttachmentServiceImpl(attachment_store,
54 scoped_ptr<syncer::AttachmentUploader>( 54 scoped_ptr<syncer::AttachmentUploader>(
(...skipping 21 matching lines...) Expand all
76 76
77 // MockSyncApiComponentFactory needed to initialize GenericChangeProcessor and 77 // MockSyncApiComponentFactory needed to initialize GenericChangeProcessor and
78 // pass MockAttachmentService to it. 78 // pass MockAttachmentService to it.
79 class MockSyncApiComponentFactory : public SyncApiComponentFactory { 79 class MockSyncApiComponentFactory : public SyncApiComponentFactory {
80 public: 80 public:
81 MockSyncApiComponentFactory( 81 MockSyncApiComponentFactory(
82 scoped_ptr<syncer::AttachmentService> attachment_service) 82 scoped_ptr<syncer::AttachmentService> attachment_service)
83 : attachment_service_(attachment_service.Pass()) {} 83 : attachment_service_(attachment_service.Pass()) {}
84 84
85 virtual base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( 85 virtual base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType(
86 syncer::ModelType type) OVERRIDE { 86 syncer::ModelType type) override {
87 // Shouldn't be called for this test. 87 // Shouldn't be called for this test.
88 NOTREACHED(); 88 NOTREACHED();
89 return base::WeakPtr<syncer::SyncableService>(); 89 return base::WeakPtr<syncer::SyncableService>();
90 } 90 }
91 91
92 virtual scoped_ptr<syncer::AttachmentService> CreateAttachmentService( 92 virtual scoped_ptr<syncer::AttachmentService> CreateAttachmentService(
93 const scoped_refptr<syncer::AttachmentStore>& attachment_store, 93 const scoped_refptr<syncer::AttachmentStore>& attachment_store,
94 const syncer::UserShare& user_share, 94 const syncer::UserShare& user_share,
95 syncer::AttachmentService::Delegate* delegate) OVERRIDE { 95 syncer::AttachmentService::Delegate* delegate) override {
96 EXPECT_TRUE(attachment_service_ != NULL); 96 EXPECT_TRUE(attachment_service_ != NULL);
97 return attachment_service_.Pass(); 97 return attachment_service_.Pass();
98 } 98 }
99 99
100 private: 100 private:
101 scoped_ptr<syncer::AttachmentService> attachment_service_; 101 scoped_ptr<syncer::AttachmentService> attachment_service_;
102 }; 102 };
103 103
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 virtual 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 virtual 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
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
OLDNEW
« no previous file with comments | « components/sync_driver/generic_change_processor.h ('k') | components/sync_driver/local_device_info_provider_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698