| 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 <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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |