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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 | 80 |
81 | 81 |
82 // TestChangeProcessor -------------------------------------------------------- | 82 // TestChangeProcessor -------------------------------------------------------- |
83 | 83 |
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 ~TestChangeProcessor() override; |
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 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 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override { |
97 override { | |
98 return syncer::SyncDataList(); | 97 return syncer::SyncDataList(); |
99 } | 98 } |
100 | 99 |
101 bool contains_guid(const std::string& guid) const { | 100 bool contains_guid(const std::string& guid) const { |
102 return change_map_.count(guid) != 0; | 101 return change_map_.count(guid) != 0; |
103 } | 102 } |
104 | 103 |
105 syncer::SyncChange change_for_guid(const std::string& guid) const { | 104 syncer::SyncChange change_for_guid(const std::string& guid) const { |
106 DCHECK(contains_guid(guid)); | 105 DCHECK(contains_guid(guid)); |
107 return change_map_.find(guid)->second; | 106 return change_map_.find(guid)->second; |
(...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2232 const char kNewGUID[] = "newdefault"; | 2231 const char kNewGUID[] = "newdefault"; |
2233 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("what"), | 2232 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("what"), |
2234 "http://thewhat.com/{searchTerms}", | 2233 "http://thewhat.com/{searchTerms}", |
2235 kNewGUID)); | 2234 kNewGUID)); |
2236 model()->SetUserSelectedDefaultSearchProvider( | 2235 model()->SetUserSelectedDefaultSearchProvider( |
2237 model()->GetTemplateURLForGUID(kNewGUID)); | 2236 model()->GetTemplateURLForGUID(kNewGUID)); |
2238 | 2237 |
2239 EXPECT_EQ(kNewGUID, profile_a()->GetTestingPrefService()->GetString( | 2238 EXPECT_EQ(kNewGUID, profile_a()->GetTestingPrefService()->GetString( |
2240 prefs::kSyncedDefaultSearchProviderGUID)); | 2239 prefs::kSyncedDefaultSearchProviderGUID)); |
2241 } | 2240 } |
OLD | NEW |