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

Side by Side Diff: chrome/browser/autocomplete/search_provider_unittest.cc

Issue 7337007: Introduce a field trial for Instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added opt-out histogram Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/autocomplete/search_provider.h" 5 #include "chrome/browser/autocomplete/search_provider.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 616
617 // Verifies AutocompleteControllers sets descriptions for results correctly. 617 // Verifies AutocompleteControllers sets descriptions for results correctly.
618 TEST_F(SearchProviderTest, UpdateKeywordDescriptions) { 618 TEST_F(SearchProviderTest, UpdateKeywordDescriptions) {
619 // Add an entry that corresponds to a keyword search with 'term2'. 619 // Add an entry that corresponds to a keyword search with 'term2'.
620 AddSearchToHistory(keyword_t_url_, ASCIIToUTF16("term2"), 1); 620 AddSearchToHistory(keyword_t_url_, ASCIIToUTF16("term2"), 1);
621 profile_.BlockUntilHistoryProcessesPendingRequests(); 621 profile_.BlockUntilHistoryProcessesPendingRequests();
622 622
623 ACProviders providers; 623 ACProviders providers;
624 SearchProvider* provider = provider_.release(); 624 SearchProvider* provider = provider_.release();
625 providers.push_back(provider); 625 providers.push_back(provider);
626 AutocompleteController controller(providers); 626 AutocompleteController controller(providers, &profile_);
627 controller.set_search_provider(provider); 627 controller.set_search_provider(provider);
628 provider->set_listener(&controller); 628 provider->set_listener(&controller);
629 controller.Start(ASCIIToUTF16("k t"), string16(), false, false, true, 629 controller.Start(ASCIIToUTF16("k t"), string16(), false, false, true,
630 AutocompleteInput::ALL_MATCHES); 630 AutocompleteInput::ALL_MATCHES);
631 const AutocompleteResult& result = controller.result(); 631 const AutocompleteResult& result = controller.result();
632 632
633 // There should be two matches, one for the keyword one for what you typed. 633 // There should be two matches, one for the keyword one for what you typed.
634 ASSERT_EQ(2u, result.size()); 634 ASSERT_EQ(2u, result.size());
635 635
636 EXPECT_TRUE(result.match_at(0).template_url != NULL); 636 EXPECT_TRUE(result.match_at(0).template_url != NULL);
637 EXPECT_TRUE(result.match_at(1).template_url != NULL); 637 EXPECT_TRUE(result.match_at(1).template_url != NULL);
638 EXPECT_NE(result.match_at(0).template_url, 638 EXPECT_NE(result.match_at(0).template_url,
639 result.match_at(1).template_url); 639 result.match_at(1).template_url);
640 640
641 EXPECT_FALSE(result.match_at(0).description.empty()); 641 EXPECT_FALSE(result.match_at(0).description.empty());
642 EXPECT_FALSE(result.match_at(1).description.empty()); 642 EXPECT_FALSE(result.match_at(1).description.empty());
643 EXPECT_NE(result.match_at(0).description, 643 EXPECT_NE(result.match_at(0).description,
644 result.match_at(1).description); 644 result.match_at(1).description);
645 } 645 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698