Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: components/search_engines/template_url_fetcher_unittest.cc

Issue 1135163002: Omnibox - Strip Extra Whitespace from Custom Search Engine Names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix more tests that don't set short_name Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « components/search_engines/template_url_data.cc ('k') | components/search_engines/template_url_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698