| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 } // namespace | 151 } // namespace |
| 152 | 152 |
| 153 | 153 |
| 154 // TemplateURLServiceTest ----------------------------------------------------- | 154 // TemplateURLServiceTest ----------------------------------------------------- |
| 155 | 155 |
| 156 class TemplateURLServiceTest : public testing::Test { | 156 class TemplateURLServiceTest : public testing::Test { |
| 157 public: | 157 public: |
| 158 TemplateURLServiceTest(); | 158 TemplateURLServiceTest(); |
| 159 | 159 |
| 160 // testing::Test | |
| 161 virtual void SetUp(); | |
| 162 virtual void TearDown(); | |
| 163 | |
| 164 TemplateURL* AddKeywordWithDate(const std::string& short_name, | 160 TemplateURL* AddKeywordWithDate(const std::string& short_name, |
| 165 const std::string& keyword, | 161 const std::string& keyword, |
| 166 const std::string& url, | 162 const std::string& url, |
| 167 const std::string& suggest_url, | 163 const std::string& suggest_url, |
| 168 const std::string& alternate_url, | 164 const std::string& alternate_url, |
| 169 const std::string& favicon_url, | 165 const std::string& favicon_url, |
| 170 bool safe_for_autoreplace, | 166 bool safe_for_autoreplace, |
| 171 const std::string& encodings, | 167 const std::string& encodings, |
| 172 Time date_created, | 168 Time date_created, |
| 173 Time last_modified); | 169 Time last_modified); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 202 |
| 207 virtual void TearDown() OVERRIDE { | 203 virtual void TearDown() OVERRIDE { |
| 208 TemplateURLServiceTest::TearDown(); | 204 TemplateURLServiceTest::TearDown(); |
| 209 DefaultSearchManager::SetFallbackSearchEnginesDisabledForTesting(false); | 205 DefaultSearchManager::SetFallbackSearchEnginesDisabledForTesting(false); |
| 210 } | 206 } |
| 211 }; | 207 }; |
| 212 | 208 |
| 213 TemplateURLServiceTest::TemplateURLServiceTest() { | 209 TemplateURLServiceTest::TemplateURLServiceTest() { |
| 214 } | 210 } |
| 215 | 211 |
| 216 void TemplateURLServiceTest::SetUp() { | |
| 217 test_util_.SetUp(); | |
| 218 } | |
| 219 | |
| 220 void TemplateURLServiceTest::TearDown() { | |
| 221 test_util_.TearDown(); | |
| 222 } | |
| 223 | |
| 224 TemplateURL* TemplateURLServiceTest::AddKeywordWithDate( | 212 TemplateURL* TemplateURLServiceTest::AddKeywordWithDate( |
| 225 const std::string& short_name, | 213 const std::string& short_name, |
| 226 const std::string& keyword, | 214 const std::string& keyword, |
| 227 const std::string& url, | 215 const std::string& url, |
| 228 const std::string& suggest_url, | 216 const std::string& suggest_url, |
| 229 const std::string& alternate_url, | 217 const std::string& alternate_url, |
| 230 const std::string& favicon_url, | 218 const std::string& favicon_url, |
| 231 bool safe_for_autoreplace, | 219 bool safe_for_autoreplace, |
| 232 const std::string& encodings, | 220 const std::string& encodings, |
| 233 Time date_created, | 221 Time date_created, |
| (...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 scoped_ptr<TemplateURL::AssociatedExtensionInfo> extension_info( | 1480 scoped_ptr<TemplateURL::AssociatedExtensionInfo> extension_info( |
| 1493 new TemplateURL::AssociatedExtensionInfo( | 1481 new TemplateURL::AssociatedExtensionInfo( |
| 1494 TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext1")); | 1482 TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext1")); |
| 1495 extension_info->wants_to_be_default_engine = true; | 1483 extension_info->wants_to_be_default_engine = true; |
| 1496 model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass()); | 1484 model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass()); |
| 1497 EXPECT_EQ(ext_dse, model()->GetTemplateURLForKeyword(ASCIIToUTF16("ext1"))); | 1485 EXPECT_EQ(ext_dse, model()->GetTemplateURLForKeyword(ASCIIToUTF16("ext1"))); |
| 1498 EXPECT_TRUE(model()->is_default_search_managed()); | 1486 EXPECT_TRUE(model()->is_default_search_managed()); |
| 1499 actual_managed_default = model()->GetDefaultSearchProvider(); | 1487 actual_managed_default = model()->GetDefaultSearchProvider(); |
| 1500 ExpectSimilar(expected_managed_default.get(), actual_managed_default); | 1488 ExpectSimilar(expected_managed_default.get(), actual_managed_default); |
| 1501 } | 1489 } |
| OLD | NEW |