| 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 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/webdata/web_data_service_factory.h" | 27 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 28 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
| 29 #include "chrome/test/base/testing_profile.h" | 29 #include "chrome/test/base/testing_profile.h" |
| 30 #include "components/webdata/common/web_database.h" | 30 #include "components/webdata/common/web_database.h" |
| 31 #include "content/public/test/test_browser_thread.h" | 31 #include "content/public/test/test_browser_thread.h" |
| 32 #include "extensions/common/constants.h" | 32 #include "extensions/common/constants.h" |
| 33 #include "extensions/common/extension.h" | 33 #include "extensions/common/extension.h" |
| 34 #include "extensions/common/manifest_constants.h" | 34 #include "extensions/common/manifest_constants.h" |
| 35 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
| 36 | 36 |
| 37 using base::ASCIIToUTF16; |
| 37 using base::Time; | 38 using base::Time; |
| 38 using base::TimeDelta; | 39 using base::TimeDelta; |
| 39 using content::BrowserThread; | 40 using content::BrowserThread; |
| 40 using ::testing::Return; | 41 using ::testing::Return; |
| 41 using ::testing::StrictMock; | 42 using ::testing::StrictMock; |
| 42 | 43 |
| 43 namespace { | 44 namespace { |
| 44 | 45 |
| 45 // TestSearchTermsData -------------------------------------------------------- | 46 // TestSearchTermsData -------------------------------------------------------- |
| 46 | 47 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 const std::string& keyword, | 94 const std::string& keyword, |
| 94 const std::string& url, | 95 const std::string& url, |
| 95 const std::string& suggest_url, | 96 const std::string& suggest_url, |
| 96 const std::string& alternate_url, | 97 const std::string& alternate_url, |
| 97 const std::string& favicon_url, | 98 const std::string& favicon_url, |
| 98 bool safe_for_autoreplace, | 99 bool safe_for_autoreplace, |
| 99 const std::string& encodings, | 100 const std::string& encodings, |
| 100 Time date_created, | 101 Time date_created, |
| 101 Time last_modified) { | 102 Time last_modified) { |
| 102 TemplateURLData data; | 103 TemplateURLData data; |
| 103 data.short_name = UTF8ToUTF16(short_name); | 104 data.short_name = base::UTF8ToUTF16(short_name); |
| 104 data.SetKeyword(UTF8ToUTF16(keyword)); | 105 data.SetKeyword(base::UTF8ToUTF16(keyword)); |
| 105 data.SetURL(url); | 106 data.SetURL(url); |
| 106 data.suggestions_url = suggest_url; | 107 data.suggestions_url = suggest_url; |
| 107 if (!alternate_url.empty()) | 108 if (!alternate_url.empty()) |
| 108 data.alternate_urls.push_back(alternate_url); | 109 data.alternate_urls.push_back(alternate_url); |
| 109 data.favicon_url = GURL(favicon_url); | 110 data.favicon_url = GURL(favicon_url); |
| 110 data.safe_for_autoreplace = safe_for_autoreplace; | 111 data.safe_for_autoreplace = safe_for_autoreplace; |
| 111 base::SplitString(encodings, ';', &data.input_encodings); | 112 base::SplitString(encodings, ';', &data.input_encodings); |
| 112 data.date_created = date_created; | 113 data.date_created = date_created; |
| 113 data.last_modified = last_modified; | 114 data.last_modified = last_modified; |
| 114 return new TemplateURL(model->profile(), data); | 115 return new TemplateURL(model->profile(), data); |
| (...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1675 scoped_ptr<AssociatedExtensionInfo> extension_info( | 1676 scoped_ptr<AssociatedExtensionInfo> extension_info( |
| 1676 new AssociatedExtensionInfo); | 1677 new AssociatedExtensionInfo); |
| 1677 extension_info->wants_to_be_default_engine = true; | 1678 extension_info->wants_to_be_default_engine = true; |
| 1678 extension_info->extension_id = "ext1"; | 1679 extension_info->extension_id = "ext1"; |
| 1679 model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass()); | 1680 model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass()); |
| 1680 EXPECT_EQ(ext_dse, model()->GetTemplateURLForKeyword(ASCIIToUTF16("ext1"))); | 1681 EXPECT_EQ(ext_dse, model()->GetTemplateURLForKeyword(ASCIIToUTF16("ext1"))); |
| 1681 EXPECT_TRUE(model()->is_default_search_managed()); | 1682 EXPECT_TRUE(model()->is_default_search_managed()); |
| 1682 actual_managed_default = model()->GetDefaultSearchProvider(); | 1683 actual_managed_default = model()->GetDefaultSearchProvider(); |
| 1683 ExpectSimilar(expected_managed_default.get(), actual_managed_default); | 1684 ExpectSimilar(expected_managed_default.get(), actual_managed_default); |
| 1684 } | 1685 } |
| OLD | NEW |