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

Side by Side Diff: chrome/browser/search_engines/template_url_service_unittest.cc

Issue 272573004: Handle TemplateURLService load failure better, and make some test correctness fixes that will be ne… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase after revert / presubmit fixes. Created 6 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 | Annotate | Revision Log
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/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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 EXPECT_EQ(ASCIIToUTF16("keyword"), t_url->keyword()); 493 EXPECT_EQ(ASCIIToUTF16("keyword"), t_url->keyword());
494 EXPECT_FALSE(t_url->safe_for_autoreplace()); 494 EXPECT_FALSE(t_url->safe_for_autoreplace());
495 495
496 // Now try adding a non-replaceable TemplateURL again. This should uniquify 496 // Now try adding a non-replaceable TemplateURL again. This should uniquify
497 // the existing entry's keyword. 497 // the existing entry's keyword.
498 data.short_name = ASCIIToUTF16("fourth"); 498 data.short_name = ASCIIToUTF16("fourth");
499 data.SetURL("http://test4"); 499 data.SetURL("http://test4");
500 data.safe_for_autoreplace = false; 500 data.safe_for_autoreplace = false;
501 TemplateURL* t_url2 = new TemplateURL(test_util_.profile(), data); 501 TemplateURL* t_url2 = new TemplateURL(test_util_.profile(), data);
502 model()->Add(t_url2); 502 model()->Add(t_url2);
503 VerifyObserverCount(2); 503 VerifyObserverCount(1);
504 EXPECT_EQ(t_url2, model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword"))); 504 EXPECT_EQ(t_url2, model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword")));
505 EXPECT_EQ(ASCIIToUTF16("fourth"), t_url2->short_name()); 505 EXPECT_EQ(ASCIIToUTF16("fourth"), t_url2->short_name());
506 EXPECT_EQ(ASCIIToUTF16("keyword"), t_url2->keyword()); 506 EXPECT_EQ(ASCIIToUTF16("keyword"), t_url2->keyword());
507 EXPECT_EQ(ASCIIToUTF16("second"), t_url->short_name()); 507 EXPECT_EQ(ASCIIToUTF16("second"), t_url->short_name());
508 EXPECT_EQ(ASCIIToUTF16("test2"), t_url->keyword()); 508 EXPECT_EQ(ASCIIToUTF16("test2"), t_url->keyword());
509 } 509 }
510 510
511 TEST_F(TemplateURLServiceTest, AddExtensionKeyword) { 511 TEST_F(TemplateURLServiceTest, AddExtensionKeyword) {
512 test_util_.VerifyLoad(); 512 test_util_.VerifyLoad();
513 513
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 scoped_ptr<AssociatedExtensionInfo> extension_info( 1679 scoped_ptr<AssociatedExtensionInfo> extension_info(
1680 new AssociatedExtensionInfo); 1680 new AssociatedExtensionInfo);
1681 extension_info->wants_to_be_default_engine = true; 1681 extension_info->wants_to_be_default_engine = true;
1682 extension_info->extension_id = "ext1"; 1682 extension_info->extension_id = "ext1";
1683 model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass()); 1683 model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass());
1684 EXPECT_EQ(ext_dse, model()->GetTemplateURLForKeyword(ASCIIToUTF16("ext1"))); 1684 EXPECT_EQ(ext_dse, model()->GetTemplateURLForKeyword(ASCIIToUTF16("ext1")));
1685 EXPECT_TRUE(model()->is_default_search_managed()); 1685 EXPECT_TRUE(model()->is_default_search_managed());
1686 actual_managed_default = model()->GetDefaultSearchProvider(); 1686 actual_managed_default = model()->GetDefaultSearchProvider();
1687 ExpectSimilar(expected_managed_default.get(), actual_managed_default); 1687 ExpectSimilar(expected_managed_default.get(), actual_managed_default);
1688 } 1688 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_service.cc ('k') | chrome/browser/ui/browser_instant_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698