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

Side by Side Diff: chrome/browser/search_engines/template_url_service_sync_unittest.cc

Issue 2354413004: Delete from Sync the artificial search engines created by the omnibox extensions. (Closed)
Patch Set: IsOmniboxExtensionURL Created 4 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 (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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 ~TestTemplateURLServiceClient() override {} 157 ~TestTemplateURLServiceClient() override {}
158 158
159 void Shutdown() override {} 159 void Shutdown() override {}
160 void SetOwner(TemplateURLService* owner) override {} 160 void SetOwner(TemplateURLService* owner) override {}
161 void DeleteAllSearchTermsForKeyword(TemplateURLID id) override {} 161 void DeleteAllSearchTermsForKeyword(TemplateURLID id) override {}
162 void SetKeywordSearchTermsForURL( 162 void SetKeywordSearchTermsForURL(
163 const GURL& url, 163 const GURL& url,
164 TemplateURLID id, 164 TemplateURLID id,
165 const base::string16& term) override {} 165 const base::string16& term) override {}
166 void AddKeywordGeneratedVisit(const GURL& url) override {} 166 void AddKeywordGeneratedVisit(const GURL& url) override {}
167 167
Peter Kasting 2016/10/05 00:15:20 Nit: No blank line
vasilii 2016/10/05 12:03:48 Done.
168 void RestoreExtensionInfoIfNecessary(TemplateURL* template_url) override; 168 bool IsOmniboxExtensionURL(const std::string& url) override { return false; }
169 }; 169 };
170 170
171 void TestTemplateURLServiceClient::RestoreExtensionInfoIfNecessary(
172 TemplateURL* template_url) {
173 const TemplateURLData& data = template_url->data();
174 GURL url(data.url());
175 if (url.SchemeIs(kOmniboxScheme)) {
176 const std::string& extension_id = url.host();
177 template_url->set_extension_info(
178 base::MakeUnique<TemplateURL::AssociatedExtensionInfo>(extension_id));
179 template_url->set_type(TemplateURL::OMNIBOX_API_EXTENSION);
180 }
181 }
182
183 } // namespace 171 } // namespace
184 172
185 173
186 // TemplateURLServiceSyncTest ------------------------------------------------- 174 // TemplateURLServiceSyncTest -------------------------------------------------
187 175
188 class TemplateURLServiceSyncTest : public testing::Test { 176 class TemplateURLServiceSyncTest : public testing::Test {
189 public: 177 public:
190 typedef TemplateURLService::SyncDataMap SyncDataMap; 178 typedef TemplateURLService::SyncDataMap SyncDataMap;
191 179
192 TemplateURLServiceSyncTest(); 180 TemplateURLServiceSyncTest();
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2330 2318
2331 TEST_F(TemplateURLServiceSyncTest, NonAsciiKeywordDoesNotCrash) { 2319 TEST_F(TemplateURLServiceSyncTest, NonAsciiKeywordDoesNotCrash) {
2332 model()->Add(CreateTestTemplateURL(UTF8ToUTF16("\xf0\xaf\xa6\x8d"), 2320 model()->Add(CreateTestTemplateURL(UTF8ToUTF16("\xf0\xaf\xa6\x8d"),
2333 "http://key1.com")); 2321 "http://key1.com"));
2334 syncer::SyncDataList initial_data = CreateInitialSyncData(); 2322 syncer::SyncDataList initial_data = CreateInitialSyncData();
2335 2323
2336 model()->MergeDataAndStartSyncing( 2324 model()->MergeDataAndStartSyncing(
2337 syncer::SEARCH_ENGINES, initial_data, PassProcessor(), 2325 syncer::SEARCH_ENGINES, initial_data, PassProcessor(),
2338 CreateAndPassSyncErrorFactory()); 2326 CreateAndPassSyncErrorFactory());
2339 } 2327 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698