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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 entry->SetString("suggest_url", | 336 entry->SetString("suggest_url", |
337 "http://override.com/suggest?q={searchTerms}"); | 337 "http://override.com/suggest?q={searchTerms}"); |
338 entry->SetString("instant_url", | 338 entry->SetString("instant_url", |
339 "http://override.com/instant?q={searchTerms}"); | 339 "http://override.com/instant?q={searchTerms}"); |
340 | 340 |
341 auto overrides_list = base::MakeUnique<base::ListValue>(); | 341 auto overrides_list = base::MakeUnique<base::ListValue>(); |
342 overrides_list->Append(std::move(entry)); | 342 overrides_list->Append(std::move(entry)); |
343 | 343 |
344 auto* prefs = test_util()->profile()->GetTestingPrefService(); | 344 auto* prefs = test_util()->profile()->GetTestingPrefService(); |
345 prefs->SetUserPref(prefs::kSearchProviderOverridesVersion, | 345 prefs->SetUserPref(prefs::kSearchProviderOverridesVersion, |
346 new base::FundamentalValue(1)); | 346 new base::Value(1)); |
347 prefs->SetUserPref(prefs::kSearchProviderOverrides, overrides_list.release()); | 347 prefs->SetUserPref(prefs::kSearchProviderOverrides, overrides_list.release()); |
348 } | 348 } |
349 | 349 |
350 void TemplateURLServiceTest::VerifyObserverCount(int expected_changed_count) { | 350 void TemplateURLServiceTest::VerifyObserverCount(int expected_changed_count) { |
351 EXPECT_EQ(expected_changed_count, test_util_->GetObserverCount()); | 351 EXPECT_EQ(expected_changed_count, test_util_->GetObserverCount()); |
352 test_util_->ResetObserverCount(); | 352 test_util_->ResetObserverCount(); |
353 } | 353 } |
354 | 354 |
355 void TemplateURLServiceTest::VerifyObserverFired() { | 355 void TemplateURLServiceTest::VerifyObserverFired() { |
356 EXPECT_LE(1, test_util_->GetObserverCount()); | 356 EXPECT_LE(1, test_util_->GetObserverCount()); |
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 TemplateURL* update_url = | 1890 TemplateURL* update_url = |
1891 model()->GetTemplateURLForKeyword(ASCIIToUTF16("engine_keyword")); | 1891 model()->GetTemplateURLForKeyword(ASCIIToUTF16("engine_keyword")); |
1892 const base::Time update_last_modified = update_url->last_modified(); | 1892 const base::Time update_last_modified = update_url->last_modified(); |
1893 model()->SetUserSelectedDefaultSearchProvider(update_url); | 1893 model()->SetUserSelectedDefaultSearchProvider(update_url); |
1894 TemplateURL* reloaded_url = | 1894 TemplateURL* reloaded_url = |
1895 model()->GetTemplateURLForKeyword(ASCIIToUTF16("engine_keyword")); | 1895 model()->GetTemplateURLForKeyword(ASCIIToUTF16("engine_keyword")); |
1896 const base::Time reloaded_last_modified = reloaded_url->last_modified(); | 1896 const base::Time reloaded_last_modified = reloaded_url->last_modified(); |
1897 EXPECT_NE(original_last_modified, reloaded_last_modified); | 1897 EXPECT_NE(original_last_modified, reloaded_last_modified); |
1898 EXPECT_EQ(update_last_modified, reloaded_last_modified); | 1898 EXPECT_EQ(update_last_modified, reloaded_last_modified); |
1899 } | 1899 } |
OLD | NEW |