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/callback_helpers.h" | 5 #include "base/callback_helpers.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 last_callback_template_url()->url_ref().DisplayURL( | 273 last_callback_template_url()->url_ref().DisplayURL( |
274 test_util()->model()->search_terms_data())); | 274 test_util()->model()->search_terms_data())); |
275 EXPECT_EQ(ASCIIToUTF16("example.com"), | 275 EXPECT_EQ(ASCIIToUTF16("example.com"), |
276 last_callback_template_url()->keyword()); | 276 last_callback_template_url()->keyword()); |
277 EXPECT_FALSE(last_callback_template_url()->safe_for_autoreplace()); | 277 EXPECT_FALSE(last_callback_template_url()->safe_for_autoreplace()); |
278 } | 278 } |
279 | 279 |
280 TEST_F(TemplateURLFetcherTest, DuplicateKeywordsTest) { | 280 TEST_F(TemplateURLFetcherTest, DuplicateKeywordsTest) { |
281 base::string16 keyword(ASCIIToUTF16("test")); | 281 base::string16 keyword(ASCIIToUTF16("test")); |
282 TemplateURLData data; | 282 TemplateURLData data; |
283 data.short_name = keyword; | 283 data.SetShortName(keyword); |
284 data.SetKeyword(keyword); | 284 data.SetKeyword(keyword); |
285 data.SetURL("http://example.com/"); | 285 data.SetURL("http://example.com/"); |
286 test_util()->model()->Add(new TemplateURL(data)); | 286 test_util()->model()->Add(new TemplateURL(data)); |
287 test_util()->ChangeModelToLoadState(); | 287 test_util()->ChangeModelToLoadState(); |
288 | 288 |
289 ASSERT_TRUE(test_util()->model()->GetTemplateURLForKeyword(keyword)); | 289 ASSERT_TRUE(test_util()->model()->GetTemplateURLForKeyword(keyword)); |
290 | 290 |
291 // This should bail because the keyword already exists. | 291 // This should bail because the keyword already exists. |
292 std::string osdd_file_name("simple_open_search.xml"); | 292 std::string osdd_file_name("simple_open_search.xml"); |
293 StartDownload(keyword, osdd_file_name, | 293 StartDownload(keyword, osdd_file_name, |
(...skipping 15 matching lines...) Expand all Loading... |
309 StartDownload(keyword, osdd_file_name, | 309 StartDownload(keyword, osdd_file_name, |
310 TemplateURLFetcher::EXPLICIT_PROVIDER, true); | 310 TemplateURLFetcher::EXPLICIT_PROVIDER, true); |
311 ASSERT_EQ(0, add_provider_called()); | 311 ASSERT_EQ(0, add_provider_called()); |
312 ASSERT_EQ(1, callbacks_destroyed()); | 312 ASSERT_EQ(1, callbacks_destroyed()); |
313 | 313 |
314 WaitForDownloadToFinish(); | 314 WaitForDownloadToFinish(); |
315 ASSERT_EQ(1, add_provider_called()); | 315 ASSERT_EQ(1, add_provider_called()); |
316 ASSERT_EQ(2, callbacks_destroyed()); | 316 ASSERT_EQ(2, callbacks_destroyed()); |
317 ASSERT_TRUE(last_callback_template_url()); | 317 ASSERT_TRUE(last_callback_template_url()); |
318 } | 318 } |
OLD | NEW |