| 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 "chrome/browser/search_engines/default_search_pref_migration.h" | 5 #include "chrome/browser/search_engines/default_search_pref_migration.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "chrome/browser/search_engines/template_url_service.h" |
| 16 #include "chrome/test/base/testing_pref_service_syncable.h" | 17 #include "chrome/test/base/testing_pref_service_syncable.h" |
| 17 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| 18 #include "components/search_engines/template_url.h" | 19 #include "components/search_engines/template_url.h" |
| 19 #include "components/search_engines/template_url_service.h" | |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 21 |
| 22 class DefaultSearchPrefMigrationTest : public testing::Test { | 22 class DefaultSearchPrefMigrationTest : public testing::Test { |
| 23 public: | 23 public: |
| 24 DefaultSearchPrefMigrationTest(); | 24 DefaultSearchPrefMigrationTest(); |
| 25 | 25 |
| 26 // testing::Test: | 26 // testing::Test: |
| 27 virtual void SetUp() OVERRIDE; | 27 virtual void SetUp() OVERRIDE; |
| 28 | 28 |
| 29 scoped_ptr<TemplateURL> CreateKeyword(const std::string& short_name, | 29 scoped_ptr<TemplateURL> CreateKeyword(const std::string& short_name, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 TemplateURLService::SaveDefaultSearchProviderToPrefs(&prepopulated_turl, | 156 TemplateURLService::SaveDefaultSearchProviderToPrefs(&prepopulated_turl, |
| 157 profile()->GetPrefs()); | 157 profile()->GetPrefs()); |
| 158 | 158 |
| 159 // Run the migration. | 159 // Run the migration. |
| 160 ConfigureDefaultSearchPrefMigrationToDictionaryValue(profile()->GetPrefs()); | 160 ConfigureDefaultSearchPrefMigrationToDictionaryValue(profile()->GetPrefs()); |
| 161 | 161 |
| 162 // Test that the legacy value is not migrated, as it is not user-selected. | 162 // Test that the legacy value is not migrated, as it is not user-selected. |
| 163 default_search_manager()->GetDefaultSearchEngine(&source); | 163 default_search_manager()->GetDefaultSearchEngine(&source); |
| 164 EXPECT_EQ(DefaultSearchManager::FROM_FALLBACK, source); | 164 EXPECT_EQ(DefaultSearchManager::FROM_FALLBACK, source); |
| 165 } | 165 } |
| OLD | NEW |