Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(886)

Side by Side Diff: chrome/browser/search_engines/template_url_service_unittest.cc

Issue 229763005: Store default search provider data in dictionary pref. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: put constants in a namespace Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after
1676 scoped_ptr<AssociatedExtensionInfo> extension_info( 1676 scoped_ptr<AssociatedExtensionInfo> extension_info(
1677 new AssociatedExtensionInfo); 1677 new AssociatedExtensionInfo);
1678 extension_info->wants_to_be_default_engine = true; 1678 extension_info->wants_to_be_default_engine = true;
1679 extension_info->extension_id = "ext1"; 1679 extension_info->extension_id = "ext1";
1680 model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass()); 1680 model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass());
1681 EXPECT_EQ(ext_dse, model()->GetTemplateURLForKeyword(ASCIIToUTF16("ext1"))); 1681 EXPECT_EQ(ext_dse, model()->GetTemplateURLForKeyword(ASCIIToUTF16("ext1")));
1682 EXPECT_TRUE(model()->is_default_search_managed()); 1682 EXPECT_TRUE(model()->is_default_search_managed());
1683 actual_managed_default = model()->GetDefaultSearchProvider(); 1683 actual_managed_default = model()->GetDefaultSearchProvider();
1684 ExpectSimilar(expected_managed_default.get(), actual_managed_default); 1684 ExpectSimilar(expected_managed_default.get(), actual_managed_default);
1685 } 1685 }
1686
1687 TEST_F(TemplateURLServiceTest, PrefSaving) {
1688 // Add a new TemplateURL.
1689 test_util_.VerifyLoad();
1690 TemplateURL* t_url = AddKeywordWithDate(
1691 "name1", "key1", "http://foo1/{searchTerms}", "http://sugg1",
1692 std::string(), "http://icon1", true, "UTF-8;UTF-16", Time(), Time());
1693 model()->SetUserSelectedDefaultSearchProvider(t_url);
1694
1695 AssertEquals(*t_url, *model()->GetDefaultSearchProvider());
1696 TemplateURL* read_url = NULL;
1697 model()->ReadDataFromPrefsDictionary(&read_url);
1698 AssertEquals(*read_url, *model()->GetDefaultSearchProvider());
1699 }
erikwright (departed) 2014/04/22 15:47:24 Are there not some "is equivalent TemplateURL" met
Cait (Slow) 2014/04/22 19:54:13 ExpectSimilar is what we want here I think.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698