| 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_manager.h" | 5 #include "components/search_engines/default_search_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "components/search_engines/template_url_prepopulate_data.h" | 23 #include "components/search_engines/template_url_prepopulate_data.h" |
| 24 #include "components/sync_preferences/testing_pref_service_syncable.h" | 24 #include "components/sync_preferences/testing_pref_service_syncable.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 // TODO(caitkp): TemplateURLData-ify this. | 29 // TODO(caitkp): TemplateURLData-ify this. |
| 30 void SetOverrides(sync_preferences::TestingPrefServiceSyncable* prefs, | 30 void SetOverrides(sync_preferences::TestingPrefServiceSyncable* prefs, |
| 31 bool update) { | 31 bool update) { |
| 32 prefs->SetUserPref(prefs::kSearchProviderOverridesVersion, | 32 prefs->SetUserPref(prefs::kSearchProviderOverridesVersion, |
| 33 new base::FundamentalValue(1)); | 33 new base::Value(1)); |
| 34 base::ListValue* overrides = new base::ListValue; | 34 base::ListValue* overrides = new base::ListValue; |
| 35 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue); | 35 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue); |
| 36 | 36 |
| 37 entry->SetString("name", update ? "new_foo" : "foo"); | 37 entry->SetString("name", update ? "new_foo" : "foo"); |
| 38 entry->SetString("keyword", update ? "new_fook" : "fook"); | 38 entry->SetString("keyword", update ? "new_fook" : "fook"); |
| 39 entry->SetString("search_url", "http://foo.com/s?q={searchTerms}"); | 39 entry->SetString("search_url", "http://foo.com/s?q={searchTerms}"); |
| 40 entry->SetString("favicon_url", "http://foi.com/favicon.ico"); | 40 entry->SetString("favicon_url", "http://foi.com/favicon.ico"); |
| 41 entry->SetString("encoding", "UTF-8"); | 41 entry->SetString("encoding", "UTF-8"); |
| 42 entry->SetInteger("id", 1001); | 42 entry->SetInteger("id", 1001); |
| 43 entry->SetString("suggest_url", "http://foo.com/suggest?q={searchTerms}"); | 43 entry->SetString("suggest_url", "http://foo.com/suggest?q={searchTerms}"); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 SetExtensionDefaultSearchInPrefs(pref_service(), *extension_data_2); | 259 SetExtensionDefaultSearchInPrefs(pref_service(), *extension_data_2); |
| 260 SetExtensionDefaultSearchInPrefs(pref_service(), *extension_data_3); | 260 SetExtensionDefaultSearchInPrefs(pref_service(), *extension_data_3); |
| 261 ExpectSimilar(extension_data_3.get(), | 261 ExpectSimilar(extension_data_3.get(), |
| 262 manager.GetDefaultSearchEngine(&source)); | 262 manager.GetDefaultSearchEngine(&source)); |
| 263 EXPECT_EQ(DefaultSearchManager::FROM_EXTENSION, source); | 263 EXPECT_EQ(DefaultSearchManager::FROM_EXTENSION, source); |
| 264 | 264 |
| 265 RemoveExtensionDefaultSearchFromPrefs(pref_service()); | 265 RemoveExtensionDefaultSearchFromPrefs(pref_service()); |
| 266 ExpectSimilar(data.get(), manager.GetDefaultSearchEngine(&source)); | 266 ExpectSimilar(data.get(), manager.GetDefaultSearchEngine(&source)); |
| 267 EXPECT_EQ(DefaultSearchManager::FROM_USER, source); | 267 EXPECT_EQ(DefaultSearchManager::FROM_USER, source); |
| 268 } | 268 } |
| OLD | NEW |