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 "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 Loading... |
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 ASSERT_EQ(t_url, model()->GetDefaultSearchProvider()); |
| 1696 model()->WriteDataToPrefsDictionary(t_url); |
| 1697 scoped_ptr<TemplateURL> cloned_url(new TemplateURL(t_url->profile(), |
| 1698 t_url->data())); |
| 1699 model()->ReadDataFromPrefsDictionary(cloned_url.get()); |
| 1700 AssertEquals(*cloned_url.get(), *model()->GetDefaultSearchProvider()); |
| 1701 } |
OLD | NEW |