| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/ref_counted.h" | 6 #include "base/ref_counted.h" |
| 7 #include "base/scoped_vector.h" | 7 #include "base/scoped_vector.h" |
| 8 #include "base/string_split.h" | 8 #include "base/string_split.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 113 } |
| 114 | 114 |
| 115 virtual void TearDown() { | 115 virtual void TearDown() { |
| 116 test_util_.TearDown(); | 116 test_util_.TearDown(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 TemplateURL* AddKeywordWithDate(const std::string& keyword, | 119 TemplateURL* AddKeywordWithDate(const std::string& keyword, |
| 120 bool autogenerate_keyword, | 120 bool autogenerate_keyword, |
| 121 const std::string& url, | 121 const std::string& url, |
| 122 const std::string& suggest_url, | 122 const std::string& suggest_url, |
| 123 const std::string& fav_icon_url, | 123 const std::string& favicon_url, |
| 124 const std::string& encodings, | 124 const std::string& encodings, |
| 125 const std::string& short_name, | 125 const std::string& short_name, |
| 126 bool safe_for_autoreplace, | 126 bool safe_for_autoreplace, |
| 127 Time created_date) { | 127 Time created_date) { |
| 128 TemplateURL* template_url = new TemplateURL(); | 128 TemplateURL* template_url = new TemplateURL(); |
| 129 template_url->SetURL(url, 0, 0); | 129 template_url->SetURL(url, 0, 0); |
| 130 template_url->SetSuggestionsURL(suggest_url, 0, 0); | 130 template_url->SetSuggestionsURL(suggest_url, 0, 0); |
| 131 template_url->SetFaviconURL(GURL(fav_icon_url)); | 131 template_url->SetFaviconURL(GURL(favicon_url)); |
| 132 template_url->set_keyword(UTF8ToUTF16(keyword)); | 132 template_url->set_keyword(UTF8ToUTF16(keyword)); |
| 133 template_url->set_autogenerate_keyword(autogenerate_keyword); | 133 template_url->set_autogenerate_keyword(autogenerate_keyword); |
| 134 template_url->set_short_name(UTF8ToUTF16(short_name)); | 134 template_url->set_short_name(UTF8ToUTF16(short_name)); |
| 135 std::vector<std::string> encodings_vector; | 135 std::vector<std::string> encodings_vector; |
| 136 base::SplitString(encodings, ';', &encodings_vector); | 136 base::SplitString(encodings, ';', &encodings_vector); |
| 137 template_url->set_input_encodings(encodings_vector); | 137 template_url->set_input_encodings(encodings_vector); |
| 138 template_url->set_date_created(created_date); | 138 template_url->set_date_created(created_date); |
| 139 template_url->set_safe_for_autoreplace(safe_for_autoreplace); | 139 template_url->set_safe_for_autoreplace(safe_for_autoreplace); |
| 140 model()->Add(template_url); | 140 model()->Add(template_url); |
| 141 EXPECT_NE(0, template_url->id()); | 141 EXPECT_NE(0, template_url->id()); |
| (...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 kEncodings, ""); | 1188 kEncodings, ""); |
| 1189 VerifyObserverFired(); | 1189 VerifyObserverFired(); |
| 1190 EXPECT_TRUE(model()->is_default_search_managed()); | 1190 EXPECT_TRUE(model()->is_default_search_managed()); |
| 1191 EXPECT_EQ(2 + initial_count, model()->GetTemplateURLs().size()); | 1191 EXPECT_EQ(2 + initial_count, model()->GetTemplateURLs().size()); |
| 1192 | 1192 |
| 1193 // Verify that the default manager we are getting is the managed one. | 1193 // Verify that the default manager we are getting is the managed one. |
| 1194 actual_managed_default = model()->GetDefaultSearchProvider(); | 1194 actual_managed_default = model()->GetDefaultSearchProvider(); |
| 1195 ExpectSimilar(actual_managed_default, expected_managed_default1.get()); | 1195 ExpectSimilar(actual_managed_default, expected_managed_default1.get()); |
| 1196 EXPECT_EQ(actual_managed_default->show_in_default_list(), true); | 1196 EXPECT_EQ(actual_managed_default->show_in_default_list(), true); |
| 1197 } | 1197 } |
| OLD | NEW |