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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 entry->SetString("suggest_url", | 323 entry->SetString("suggest_url", |
324 "http://override.com/suggest?q={searchTerms}"); | 324 "http://override.com/suggest?q={searchTerms}"); |
325 entry->SetString("instant_url", | 325 entry->SetString("instant_url", |
326 "http://override.com/instant?q={searchTerms}"); | 326 "http://override.com/instant?q={searchTerms}"); |
327 | 327 |
328 auto overrides_list = base::MakeUnique<base::ListValue>(); | 328 auto overrides_list = base::MakeUnique<base::ListValue>(); |
329 overrides_list->Append(std::move(entry)); | 329 overrides_list->Append(std::move(entry)); |
330 | 330 |
331 auto* prefs = test_util()->profile()->GetTestingPrefService(); | 331 auto* prefs = test_util()->profile()->GetTestingPrefService(); |
332 prefs->SetUserPref(prefs::kSearchProviderOverridesVersion, | 332 prefs->SetUserPref(prefs::kSearchProviderOverridesVersion, |
333 new base::Value(1)); | 333 base::MakeUnique<base::Value>(1)); |
334 prefs->SetUserPref(prefs::kSearchProviderOverrides, overrides_list.release()); | 334 prefs->SetUserPref(prefs::kSearchProviderOverrides, |
| 335 std::move(overrides_list)); |
335 } | 336 } |
336 | 337 |
337 void TemplateURLServiceTest::VerifyObserverCount(int expected_changed_count) { | 338 void TemplateURLServiceTest::VerifyObserverCount(int expected_changed_count) { |
338 EXPECT_EQ(expected_changed_count, test_util_->GetObserverCount()); | 339 EXPECT_EQ(expected_changed_count, test_util_->GetObserverCount()); |
339 test_util_->ResetObserverCount(); | 340 test_util_->ResetObserverCount(); |
340 } | 341 } |
341 | 342 |
342 void TemplateURLServiceTest::VerifyObserverFired() { | 343 void TemplateURLServiceTest::VerifyObserverFired() { |
343 EXPECT_LE(1, test_util_->GetObserverCount()); | 344 EXPECT_LE(1, test_util_->GetObserverCount()); |
344 test_util_->ResetObserverCount(); | 345 test_util_->ResetObserverCount(); |
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1936 TemplateURL* update_url = | 1937 TemplateURL* update_url = |
1937 model()->GetTemplateURLForKeyword(ASCIIToUTF16("engine_keyword")); | 1938 model()->GetTemplateURLForKeyword(ASCIIToUTF16("engine_keyword")); |
1938 const Time update_last_modified = update_url->last_modified(); | 1939 const Time update_last_modified = update_url->last_modified(); |
1939 model()->SetUserSelectedDefaultSearchProvider(update_url); | 1940 model()->SetUserSelectedDefaultSearchProvider(update_url); |
1940 TemplateURL* reloaded_url = | 1941 TemplateURL* reloaded_url = |
1941 model()->GetTemplateURLForKeyword(ASCIIToUTF16("engine_keyword")); | 1942 model()->GetTemplateURLForKeyword(ASCIIToUTF16("engine_keyword")); |
1942 const Time reloaded_last_modified = reloaded_url->last_modified(); | 1943 const Time reloaded_last_modified = reloaded_url->last_modified(); |
1943 EXPECT_NE(original_last_modified, reloaded_last_modified); | 1944 EXPECT_NE(original_last_modified, reloaded_last_modified); |
1944 EXPECT_EQ(update_last_modified, reloaded_last_modified); | 1945 EXPECT_EQ(update_last_modified, reloaded_last_modified); |
1945 } | 1946 } |
OLD | NEW |