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 "components/search_engines/template_url_service.h" | 5 #include "components/search_engines/template_url_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 entry->SetString("encoding", "UTF-8"); | 308 entry->SetString("encoding", "UTF-8"); |
309 entry->SetInteger("id", 1001); | 309 entry->SetInteger("id", 1001); |
310 entry->SetString("suggest_url", | 310 entry->SetString("suggest_url", |
311 "http://override.com/suggest?q={searchTerms}"); | 311 "http://override.com/suggest?q={searchTerms}"); |
312 entry->SetString("instant_url", | 312 entry->SetString("instant_url", |
313 "http://override.com/instant?q={searchTerms}"); | 313 "http://override.com/instant?q={searchTerms}"); |
314 | 314 |
315 auto overrides_list = base::MakeUnique<base::ListValue>(); | 315 auto overrides_list = base::MakeUnique<base::ListValue>(); |
316 overrides_list->Append(std::move(entry)); | 316 overrides_list->Append(std::move(entry)); |
317 | 317 |
318 auto* prefs = test_util()->profile()->GetTestingPrefService(); | 318 auto prefs = test_util()->profile()->GetTestingPrefService(); |
319 prefs->SetUserPref(prefs::kSearchProviderOverridesVersion, | 319 prefs->SetUserPref(prefs::kSearchProviderOverridesVersion, |
320 new base::FundamentalValue(1)); | 320 new base::FundamentalValue(1)); |
321 prefs->SetUserPref(prefs::kSearchProviderOverrides, overrides_list.release()); | 321 prefs->SetUserPref(prefs::kSearchProviderOverrides, overrides_list.release()); |
322 } | 322 } |
323 | 323 |
324 void TemplateURLServiceTest::VerifyObserverCount(int expected_changed_count) { | 324 void TemplateURLServiceTest::VerifyObserverCount(int expected_changed_count) { |
325 EXPECT_EQ(expected_changed_count, test_util_->GetObserverCount()); | 325 EXPECT_EQ(expected_changed_count, test_util_->GetObserverCount()); |
326 test_util_->ResetObserverCount(); | 326 test_util_->ResetObserverCount(); |
327 } | 327 } |
328 | 328 |
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 TemplateURL* update_url = | 1719 TemplateURL* update_url = |
1720 model()->GetTemplateURLForKeyword(ASCIIToUTF16("engine_keyword")); | 1720 model()->GetTemplateURLForKeyword(ASCIIToUTF16("engine_keyword")); |
1721 const base::Time update_last_modified = update_url->last_modified(); | 1721 const base::Time update_last_modified = update_url->last_modified(); |
1722 model()->SetUserSelectedDefaultSearchProvider(update_url); | 1722 model()->SetUserSelectedDefaultSearchProvider(update_url); |
1723 TemplateURL* reloaded_url = | 1723 TemplateURL* reloaded_url = |
1724 model()->GetTemplateURLForKeyword(ASCIIToUTF16("engine_keyword")); | 1724 model()->GetTemplateURLForKeyword(ASCIIToUTF16("engine_keyword")); |
1725 const base::Time reloaded_last_modified = reloaded_url->last_modified(); | 1725 const base::Time reloaded_last_modified = reloaded_url->last_modified(); |
1726 EXPECT_NE(original_last_modified, reloaded_last_modified); | 1726 EXPECT_NE(original_last_modified, reloaded_last_modified); |
1727 EXPECT_EQ(update_last_modified, reloaded_last_modified); | 1727 EXPECT_EQ(update_last_modified, reloaded_last_modified); |
1728 } | 1728 } |
OLD | NEW |