| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // Dummy SyncChangeProcessor used to help review what SyncChanges are pushed | 84 // Dummy SyncChangeProcessor used to help review what SyncChanges are pushed |
| 85 // back up to Sync. | 85 // back up to Sync. |
| 86 class TestChangeProcessor : public syncer::SyncChangeProcessor { | 86 class TestChangeProcessor : public syncer::SyncChangeProcessor { |
| 87 public: | 87 public: |
| 88 TestChangeProcessor(); | 88 TestChangeProcessor(); |
| 89 virtual ~TestChangeProcessor(); | 89 virtual ~TestChangeProcessor(); |
| 90 | 90 |
| 91 // Store a copy of all the changes passed in so we can examine them later. | 91 // Store a copy of all the changes passed in so we can examine them later. |
| 92 virtual syncer::SyncError ProcessSyncChanges( | 92 virtual syncer::SyncError ProcessSyncChanges( |
| 93 const tracked_objects::Location& from_here, | 93 const tracked_objects::Location& from_here, |
| 94 const syncer::SyncChangeList& change_list) OVERRIDE; | 94 const syncer::SyncChangeList& change_list) override; |
| 95 | 95 |
| 96 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const | 96 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const |
| 97 OVERRIDE { | 97 override { |
| 98 return syncer::SyncDataList(); | 98 return syncer::SyncDataList(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool contains_guid(const std::string& guid) const { | 101 bool contains_guid(const std::string& guid) const { |
| 102 return change_map_.count(guid) != 0; | 102 return change_map_.count(guid) != 0; |
| 103 } | 103 } |
| 104 | 104 |
| 105 syncer::SyncChange change_for_guid(const std::string& guid) const { | 105 syncer::SyncChange change_for_guid(const std::string& guid) const { |
| 106 DCHECK(contains_guid(guid)); | 106 DCHECK(contains_guid(guid)); |
| 107 return change_map_.find(guid)->second; | 107 return change_map_.find(guid)->second; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 | 148 |
| 149 // TemplateURLServiceSyncTest ------------------------------------------------- | 149 // TemplateURLServiceSyncTest ------------------------------------------------- |
| 150 | 150 |
| 151 class TemplateURLServiceSyncTest : public testing::Test { | 151 class TemplateURLServiceSyncTest : public testing::Test { |
| 152 public: | 152 public: |
| 153 typedef TemplateURLService::SyncDataMap SyncDataMap; | 153 typedef TemplateURLService::SyncDataMap SyncDataMap; |
| 154 | 154 |
| 155 TemplateURLServiceSyncTest(); | 155 TemplateURLServiceSyncTest(); |
| 156 | 156 |
| 157 virtual void SetUp() OVERRIDE; | 157 virtual void SetUp() override; |
| 158 virtual void TearDown() OVERRIDE; | 158 virtual void TearDown() override; |
| 159 | 159 |
| 160 TemplateURLService* model() { return test_util_a_->model(); } | 160 TemplateURLService* model() { return test_util_a_->model(); } |
| 161 // For readability, we redefine an accessor for Model A for use in tests that | 161 // For readability, we redefine an accessor for Model A for use in tests that |
| 162 // involve syncing two models. | 162 // involve syncing two models. |
| 163 TemplateURLService* model_a() { return test_util_a_->model(); } | 163 TemplateURLService* model_a() { return test_util_a_->model(); } |
| 164 TemplateURLService* model_b() { return test_util_b_->model(); } | 164 TemplateURLService* model_b() { return test_util_b_->model(); } |
| 165 TestingProfile* profile_a() { return test_util_a_->profile(); } | 165 TestingProfile* profile_a() { return test_util_a_->profile(); } |
| 166 TestChangeProcessor* processor() { return sync_processor_.get(); } | 166 TestChangeProcessor* processor() { return sync_processor_.get(); } |
| 167 scoped_ptr<syncer::SyncChangeProcessor> PassProcessor(); | 167 scoped_ptr<syncer::SyncChangeProcessor> PassProcessor(); |
| 168 scoped_ptr<syncer::SyncErrorFactory> CreateAndPassSyncErrorFactory(); | 168 scoped_ptr<syncer::SyncErrorFactory> CreateAndPassSyncErrorFactory(); |
| (...skipping 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2230 const char kNewGUID[] = "newdefault"; | 2230 const char kNewGUID[] = "newdefault"; |
| 2231 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("what"), | 2231 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("what"), |
| 2232 "http://thewhat.com/{searchTerms}", | 2232 "http://thewhat.com/{searchTerms}", |
| 2233 kNewGUID)); | 2233 kNewGUID)); |
| 2234 model()->SetUserSelectedDefaultSearchProvider( | 2234 model()->SetUserSelectedDefaultSearchProvider( |
| 2235 model()->GetTemplateURLForGUID(kNewGUID)); | 2235 model()->GetTemplateURLForGUID(kNewGUID)); |
| 2236 | 2236 |
| 2237 EXPECT_EQ(kNewGUID, profile_a()->GetTestingPrefService()->GetString( | 2237 EXPECT_EQ(kNewGUID, profile_a()->GetTestingPrefService()->GetString( |
| 2238 prefs::kSyncedDefaultSearchProviderGUID)); | 2238 prefs::kSyncedDefaultSearchProviderGUID)); |
| 2239 } | 2239 } |
| OLD | NEW |