| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/search_engines/default_search_pref_migration.h" | 5 #include "components/search_engines/default_search_pref_migration.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 scoped_ptr<TemplateURL> DefaultSearchPrefMigrationTest::CreateKeyword( | 130 scoped_ptr<TemplateURL> DefaultSearchPrefMigrationTest::CreateKeyword( |
| 131 const std::string& short_name, | 131 const std::string& short_name, |
| 132 const std::string& keyword, | 132 const std::string& keyword, |
| 133 const std::string& url) { | 133 const std::string& url) { |
| 134 TemplateURLData data; | 134 TemplateURLData data; |
| 135 data.SetShortName(base::ASCIIToUTF16(short_name)); | 135 data.SetShortName(base::ASCIIToUTF16(short_name)); |
| 136 data.SetKeyword(base::ASCIIToUTF16(keyword)); | 136 data.SetKeyword(base::ASCIIToUTF16(keyword)); |
| 137 data.SetURL(url); | 137 data.SetURL(url); |
| 138 scoped_ptr<TemplateURL> t_url(new TemplateURL(data)); | 138 scoped_ptr<TemplateURL> t_url(new TemplateURL(data)); |
| 139 return t_url.Pass(); | 139 return t_url; |
| 140 } | 140 } |
| 141 | 141 |
| 142 TEST_F(DefaultSearchPrefMigrationTest, MigrateUserSelectedValue) { | 142 TEST_F(DefaultSearchPrefMigrationTest, MigrateUserSelectedValue) { |
| 143 scoped_ptr<TemplateURL> t_url( | 143 scoped_ptr<TemplateURL> t_url( |
| 144 CreateKeyword("name1", "key1", "http://foo1/{searchTerms}")); | 144 CreateKeyword("name1", "key1", "http://foo1/{searchTerms}")); |
| 145 // Store a value in the legacy location. | 145 // Store a value in the legacy location. |
| 146 SaveDefaultSearchProviderToLegacyPrefs(t_url.get()); | 146 SaveDefaultSearchProviderToLegacyPrefs(t_url.get()); |
| 147 | 147 |
| 148 // Run the migration. | 148 // Run the migration. |
| 149 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service()); | 149 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service()); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // Store a value in the legacy location. | 225 // Store a value in the legacy location. |
| 226 SaveDefaultSearchProviderToLegacyPrefs(&prepopulated_turl); | 226 SaveDefaultSearchProviderToLegacyPrefs(&prepopulated_turl); |
| 227 | 227 |
| 228 // Run the migration. | 228 // Run the migration. |
| 229 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service()); | 229 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service()); |
| 230 | 230 |
| 231 // Test that the legacy value is not migrated, as it is not user-selected. | 231 // Test that the legacy value is not migrated, as it is not user-selected. |
| 232 default_search_manager()->GetDefaultSearchEngine(&source); | 232 default_search_manager()->GetDefaultSearchEngine(&source); |
| 233 EXPECT_EQ(DefaultSearchManager::FROM_FALLBACK, source); | 233 EXPECT_EQ(DefaultSearchManager::FROM_FALLBACK, source); |
| 234 } | 234 } |
| OLD | NEW |