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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/search_engines/template_url.h" | 10 #include "chrome/browser/search_engines/template_url.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 last_callback_template_url_->keyword()); | 289 last_callback_template_url_->keyword()); |
290 EXPECT_FALSE(last_callback_template_url_->safe_for_autoreplace()); | 290 EXPECT_FALSE(last_callback_template_url_->safe_for_autoreplace()); |
291 } | 291 } |
292 | 292 |
293 TEST_F(TemplateURLFetcherTest, DuplicateKeywordsTest) { | 293 TEST_F(TemplateURLFetcherTest, DuplicateKeywordsTest) { |
294 base::string16 keyword(ASCIIToUTF16("test")); | 294 base::string16 keyword(ASCIIToUTF16("test")); |
295 TemplateURLData data; | 295 TemplateURLData data; |
296 data.short_name = keyword; | 296 data.short_name = keyword; |
297 data.SetKeyword(keyword); | 297 data.SetKeyword(keyword); |
298 data.SetURL("http://example.com/"); | 298 data.SetURL("http://example.com/"); |
299 test_util_.model()->Add(new TemplateURL(test_util_.profile(), data)); | 299 test_util_.model()->Add(new TemplateURL(data)); |
300 test_util_.ChangeModelToLoadState(); | 300 test_util_.ChangeModelToLoadState(); |
301 | 301 |
302 ASSERT_TRUE(test_util_.model()->GetTemplateURLForKeyword(keyword)); | 302 ASSERT_TRUE(test_util_.model()->GetTemplateURLForKeyword(keyword)); |
303 | 303 |
304 // This should bail because the keyword already exists. | 304 // This should bail because the keyword already exists. |
305 std::string osdd_file_name("simple_open_search.xml"); | 305 std::string osdd_file_name("simple_open_search.xml"); |
306 StartDownload(keyword, osdd_file_name, | 306 StartDownload(keyword, osdd_file_name, |
307 TemplateURLFetcher::AUTODETECTED_PROVIDER, true); | 307 TemplateURLFetcher::AUTODETECTED_PROVIDER, true); |
308 ASSERT_EQ(0, add_provider_called_); | 308 ASSERT_EQ(0, add_provider_called_); |
309 ASSERT_EQ(1, callbacks_destroyed_); | 309 ASSERT_EQ(1, callbacks_destroyed_); |
(...skipping 12 matching lines...) Expand all Loading... |
322 StartDownload(keyword, osdd_file_name, | 322 StartDownload(keyword, osdd_file_name, |
323 TemplateURLFetcher::EXPLICIT_PROVIDER, true); | 323 TemplateURLFetcher::EXPLICIT_PROVIDER, true); |
324 ASSERT_EQ(0, add_provider_called_); | 324 ASSERT_EQ(0, add_provider_called_); |
325 ASSERT_EQ(1, callbacks_destroyed_); | 325 ASSERT_EQ(1, callbacks_destroyed_); |
326 | 326 |
327 WaitForDownloadToFinish(); | 327 WaitForDownloadToFinish(); |
328 ASSERT_EQ(1, add_provider_called_); | 328 ASSERT_EQ(1, add_provider_called_); |
329 ASSERT_EQ(2, callbacks_destroyed_); | 329 ASSERT_EQ(2, callbacks_destroyed_); |
330 ASSERT_TRUE(last_callback_template_url_.get()); | 330 ASSERT_TRUE(last_callback_template_url_.get()); |
331 } | 331 } |
OLD | NEW |