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

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

Issue 2367373003: [Android] Allow setting recently visited search engines as default search engine (Closed)
Patch Set: Update based on Dan's new comments. Created 4 years, 1 month 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 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 1086
1087 model()->RegisterOmniboxKeyword("extension2", "unittest", "keyword2", 1087 model()->RegisterOmniboxKeyword("extension2", "unittest", "keyword2",
1088 "http://extension2"); 1088 "http://extension2");
1089 TemplateURL* extension2 = 1089 TemplateURL* extension2 =
1090 model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword2")); 1090 model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword2"));
1091 ASSERT_TRUE(extension2); 1091 ASSERT_TRUE(extension2);
1092 EXPECT_EQ(0U, processor()->change_list_size()); 1092 EXPECT_EQ(0U, processor()->change_list_size());
1093 1093
1094 // Create some sync changes that will conflict with the extension keywords. 1094 // Create some sync changes that will conflict with the extension keywords.
1095 syncer::SyncChangeList changes; 1095 syncer::SyncChangeList changes;
1096 changes.push_back(CreateTestSyncChange(syncer::SyncChange::ACTION_ADD, 1096 changes.push_back(CreateTestSyncChange(
1097 CreateTestTemplateURL(ASCIIToUTF16("keyword1"), "http://aaa.com", 1097 syncer::SyncChange::ACTION_ADD,
1098 std::string(), 100, true))); 1098 CreateTestTemplateURL(ASCIIToUTF16("keyword1"), "http://aaa.com",
1099 std::string(), 100, true, false, 0)));
1099 changes.push_back(CreateTestSyncChange(syncer::SyncChange::ACTION_ADD, 1100 changes.push_back(CreateTestSyncChange(syncer::SyncChange::ACTION_ADD,
1100 CreateTestTemplateURL(ASCIIToUTF16("keyword2"), "http://bbb.com"))); 1101 CreateTestTemplateURL(ASCIIToUTF16("keyword2"), "http://bbb.com")));
1101 model()->ProcessSyncChanges(FROM_HERE, changes); 1102 model()->ProcessSyncChanges(FROM_HERE, changes);
1102 1103
1103 EXPECT_FALSE(model()->GetTemplateURLForHost("aaa.com") == NULL); 1104 EXPECT_FALSE(model()->GetTemplateURLForHost("aaa.com") == NULL);
1104 EXPECT_EQ(extension1, 1105 EXPECT_EQ(extension1,
1105 model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword1"))); 1106 model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword1")));
1106 TemplateURL* url_for_keyword2 = 1107 TemplateURL* url_for_keyword2 =
1107 model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword2")); 1108 model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword2"));
1108 EXPECT_NE(extension2, url_for_keyword2); 1109 EXPECT_NE(extension2, url_for_keyword2);
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
2317 2318
2318 TEST_F(TemplateURLServiceSyncTest, NonAsciiKeywordDoesNotCrash) { 2319 TEST_F(TemplateURLServiceSyncTest, NonAsciiKeywordDoesNotCrash) {
2319 model()->Add(CreateTestTemplateURL(UTF8ToUTF16("\xf0\xaf\xa6\x8d"), 2320 model()->Add(CreateTestTemplateURL(UTF8ToUTF16("\xf0\xaf\xa6\x8d"),
2320 "http://key1.com")); 2321 "http://key1.com"));
2321 syncer::SyncDataList initial_data = CreateInitialSyncData(); 2322 syncer::SyncDataList initial_data = CreateInitialSyncData();
2322 2323
2323 model()->MergeDataAndStartSyncing( 2324 model()->MergeDataAndStartSyncing(
2324 syncer::SEARCH_ENGINES, initial_data, PassProcessor(), 2325 syncer::SEARCH_ENGINES, initial_data, PassProcessor(),
2325 CreateAndPassSyncErrorFactory()); 2326 CreateAndPassSyncErrorFactory());
2326 } 2327 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698