| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/autocomplete/search_provider.h" | 5 #include "chrome/browser/autocomplete/search_provider.h" |
| 6 | 6 |
| 7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 14 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 15 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 15 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
| 16 #include "chrome/browser/autocomplete/autocomplete_field_trial.h" | 16 #include "chrome/browser/autocomplete/autocomplete_field_trial.h" |
| 17 #include "chrome/browser/autocomplete/autocomplete_input.h" | 17 #include "chrome/browser/autocomplete/autocomplete_input.h" |
| 18 #include "chrome/browser/autocomplete/autocomplete_match.h" | 18 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 19 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 19 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
| 20 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" | 20 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" |
| 21 #include "chrome/browser/autocomplete/history_url_provider.h" | 21 #include "chrome/browser/autocomplete/history_url_provider.h" |
| 22 #include "chrome/browser/history/history_service.h" | 22 #include "chrome/browser/history/history_service.h" |
| 23 #include "chrome/browser/history/history_service_factory.h" | 23 #include "chrome/browser/history/history_service_factory.h" |
| 24 #include "chrome/browser/search_engines/template_url.h" | 24 #include "chrome/browser/search_engines/template_url.h" |
| 25 #include "chrome/browser/search_engines/template_url_service.h" | 25 #include "chrome/browser/search_engines/template_url_service.h" |
| 26 #include "chrome/browser/search_engines/template_url_service_factory.h" | 26 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 27 #include "chrome/browser/ui/browser_instant_controller.h" | 27 #include "chrome/browser/ui/search/search.h" |
| 28 #include "chrome/common/metrics/entropy_provider.h" | 28 #include "chrome/common/metrics/entropy_provider.h" |
| 29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 30 #include "chrome/test/base/testing_browser_process.h" | 30 #include "chrome/test/base/testing_browser_process.h" |
| 31 #include "chrome/test/base/testing_profile.h" | 31 #include "chrome/test/base/testing_profile.h" |
| 32 #include "content/public/test/test_browser_thread.h" | 32 #include "content/public/test/test_browser_thread.h" |
| 33 #include "net/url_request/test_url_fetcher_factory.h" | 33 #include "net/url_request/test_url_fetcher_factory.h" |
| 34 #include "net/url_request/url_request_status.h" | 34 #include "net/url_request/url_request_status.h" |
| 35 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
| 36 | 36 |
| 37 using content::BrowserThread; | 37 using content::BrowserThread; |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // URLFetchers runs. | 267 // URLFetchers runs. |
| 268 message_loop_.RunUntilIdle(); | 268 message_loop_.RunUntilIdle(); |
| 269 } | 269 } |
| 270 | 270 |
| 271 void SearchProviderTest::QueryForInputAndSetWYTMatch( | 271 void SearchProviderTest::QueryForInputAndSetWYTMatch( |
| 272 const string16& text, | 272 const string16& text, |
| 273 AutocompleteMatch* wyt_match) { | 273 AutocompleteMatch* wyt_match) { |
| 274 QueryForInput(text, string16(), false); | 274 QueryForInput(text, string16(), false); |
| 275 profile_.BlockUntilHistoryProcessesPendingRequests(); | 275 profile_.BlockUntilHistoryProcessesPendingRequests(); |
| 276 ASSERT_NO_FATAL_FAILURE(FinishDefaultSuggestQuery()); | 276 ASSERT_NO_FATAL_FAILURE(FinishDefaultSuggestQuery()); |
| 277 EXPECT_NE(chrome::BrowserInstantController::IsInstantEnabled(&profile_), | 277 EXPECT_NE(chrome::search::IsInstantEnabled(&profile_), provider_->done()); |
| 278 provider_->done()); | |
| 279 if (!wyt_match) | 278 if (!wyt_match) |
| 280 return; | 279 return; |
| 281 ASSERT_GE(provider_->matches().size(), 1u); | 280 ASSERT_GE(provider_->matches().size(), 1u); |
| 282 EXPECT_TRUE(FindMatchWithDestination(GURL( | 281 EXPECT_TRUE(FindMatchWithDestination(GURL( |
| 283 default_t_url_->url_ref().ReplaceSearchTerms( | 282 default_t_url_->url_ref().ReplaceSearchTerms( |
| 284 TemplateURLRef::SearchTermsArgs(text))), | 283 TemplateURLRef::SearchTermsArgs(text))), |
| 285 wyt_match)); | 284 wyt_match)); |
| 286 } | 285 } |
| 287 | 286 |
| 288 void SearchProviderTest::TearDown() { | 287 void SearchProviderTest::TearDown() { |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 } | 498 } |
| 500 | 499 |
| 501 // Make sure FinalizeInstantQuery works. | 500 // Make sure FinalizeInstantQuery works. |
| 502 TEST_F(SearchProviderTest, FinalizeInstantQuery) { | 501 TEST_F(SearchProviderTest, FinalizeInstantQuery) { |
| 503 PrefService* service = profile_.GetPrefs(); | 502 PrefService* service = profile_.GetPrefs(); |
| 504 service->SetBoolean(prefs::kInstantEnabled, true); | 503 service->SetBoolean(prefs::kInstantEnabled, true); |
| 505 | 504 |
| 506 ASSERT_NO_FATAL_FAILURE(QueryForInputAndSetWYTMatch(ASCIIToUTF16("foo"), | 505 ASSERT_NO_FATAL_FAILURE(QueryForInputAndSetWYTMatch(ASCIIToUTF16("foo"), |
| 507 NULL)); | 506 NULL)); |
| 508 | 507 |
| 509 // Tell the provider instant is done. | 508 // Tell the provider Instant is done. |
| 510 provider_->FinalizeInstantQuery(ASCIIToUTF16("foo"), | 509 provider_->FinalizeInstantQuery(ASCIIToUTF16("foo"), |
| 511 InstantSuggestion(ASCIIToUTF16("bar"), | 510 InstantSuggestion(ASCIIToUTF16("bar"), |
| 512 INSTANT_COMPLETE_NOW, | 511 INSTANT_COMPLETE_NOW, |
| 513 INSTANT_SUGGESTION_SEARCH)); | 512 false)); |
| 514 | 513 |
| 515 // The provider should now be done. | 514 // The provider should now be done. |
| 516 EXPECT_TRUE(provider_->done()); | 515 EXPECT_TRUE(provider_->done()); |
| 517 | 516 |
| 518 // There should be two matches, one for what you typed, the other for | 517 // There should be two matches, one for what you typed, the other for |
| 519 // 'foobar'. | 518 // 'foobar'. |
| 520 EXPECT_EQ(2u, provider_->matches().size()); | 519 EXPECT_EQ(2u, provider_->matches().size()); |
| 521 GURL instant_url(default_t_url_->url_ref().ReplaceSearchTerms( | 520 GURL instant_url(default_t_url_->url_ref().ReplaceSearchTerms( |
| 522 TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("foobar")))); | 521 TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("foobar")))); |
| 523 AutocompleteMatch instant_match; | 522 AutocompleteMatch instant_match; |
| 524 EXPECT_TRUE(FindMatchWithDestination(instant_url, &instant_match)); | 523 EXPECT_TRUE(FindMatchWithDestination(instant_url, &instant_match)); |
| 525 | 524 |
| 526 // And the 'foobar' match should not have a description, it'll be set later. | 525 // And the 'foobar' match should not have a description, it'll be set later. |
| 527 EXPECT_TRUE(instant_match.description.empty()); | 526 EXPECT_TRUE(instant_match.description.empty()); |
| 528 | 527 |
| 529 // Make sure the what you typed match has no description. | 528 // Make sure the what you typed match has no description. |
| 530 AutocompleteMatch wyt_match; | 529 AutocompleteMatch wyt_match; |
| 531 EXPECT_TRUE(FindMatchWithDestination( | 530 EXPECT_TRUE(FindMatchWithDestination( |
| 532 GURL(default_t_url_->url_ref().ReplaceSearchTerms( | 531 GURL(default_t_url_->url_ref().ReplaceSearchTerms( |
| 533 TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("foo")))), | 532 TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("foo")))), |
| 534 &wyt_match)); | 533 &wyt_match)); |
| 535 EXPECT_TRUE(wyt_match.description.empty()); | 534 EXPECT_TRUE(wyt_match.description.empty()); |
| 536 | 535 |
| 537 // The instant search should be more relevant. | 536 // The Instant search should be more relevant. |
| 538 EXPECT_GT(instant_match.relevance, wyt_match.relevance); | 537 EXPECT_GT(instant_match.relevance, wyt_match.relevance); |
| 539 } | 538 } |
| 540 | 539 |
| 541 // Make sure FinalizeInstantQuery works with URL suggestions. | 540 // Make sure FinalizeInstantQuery works with URL suggestions. |
| 542 TEST_F(SearchProviderTest, FinalizeInstantURL) { | 541 TEST_F(SearchProviderTest, FinalizeInstantURL) { |
| 543 PrefService* service = profile_.GetPrefs(); | 542 PrefService* service = profile_.GetPrefs(); |
| 544 service->SetBoolean(prefs::kInstantEnabled, true); | 543 service->SetBoolean(prefs::kInstantEnabled, true); |
| 545 | 544 |
| 546 ASSERT_NO_FATAL_FAILURE(QueryForInputAndSetWYTMatch(ASCIIToUTF16("ex"), | 545 ASSERT_NO_FATAL_FAILURE(QueryForInputAndSetWYTMatch(ASCIIToUTF16("ex"), |
| 547 NULL)); | 546 NULL)); |
| 548 | 547 |
| 549 // Tell the provider instant is done. | 548 // Tell the provider Instant is done. |
| 550 provider_->FinalizeInstantQuery(ASCIIToUTF16("ex"), | 549 provider_->FinalizeInstantQuery(ASCIIToUTF16("ex"), |
| 551 InstantSuggestion( | 550 InstantSuggestion( |
| 552 ASCIIToUTF16("http://example.com/"), | 551 ASCIIToUTF16("http://example.com/"), |
| 553 INSTANT_COMPLETE_NOW, | 552 INSTANT_COMPLETE_NOW, |
| 554 INSTANT_SUGGESTION_URL)); | 553 true)); |
| 555 | 554 |
| 556 // The provider should now be done. | 555 // The provider should now be done. |
| 557 EXPECT_TRUE(provider_->done()); | 556 EXPECT_TRUE(provider_->done()); |
| 558 | 557 |
| 559 // There should be two matches, one for what you typed, the other for | 558 // There should be two matches, one for what you typed, the other for |
| 560 // "http://example.com/". | 559 // "http://example.com/". |
| 561 EXPECT_EQ(2u, provider_->matches().size()); | 560 EXPECT_EQ(2u, provider_->matches().size()); |
| 562 GURL instant_url("http://example.com"); | 561 GURL instant_url("http://example.com"); |
| 563 AutocompleteMatch instant_match; | 562 AutocompleteMatch instant_match; |
| 564 EXPECT_TRUE(FindMatchWithDestination(instant_url, &instant_match)); | 563 EXPECT_TRUE(FindMatchWithDestination(instant_url, &instant_match)); |
| 565 | 564 |
| 566 // The instant match should not have a description, it'll be set later. | 565 // The Instant match should not have a description, it'll be set later. |
| 567 EXPECT_TRUE(instant_match.description.empty()); | 566 EXPECT_TRUE(instant_match.description.empty()); |
| 568 | 567 |
| 569 // Make sure the what you typed match has no description. | 568 // Make sure the what you typed match has no description. |
| 570 AutocompleteMatch wyt_match; | 569 AutocompleteMatch wyt_match; |
| 571 EXPECT_TRUE(FindMatchWithDestination( | 570 EXPECT_TRUE(FindMatchWithDestination( |
| 572 GURL(default_t_url_->url_ref().ReplaceSearchTerms( | 571 GURL(default_t_url_->url_ref().ReplaceSearchTerms( |
| 573 TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("ex")))), | 572 TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("ex")))), |
| 574 &wyt_match)); | 573 &wyt_match)); |
| 575 EXPECT_TRUE(wyt_match.description.empty()); | 574 EXPECT_TRUE(wyt_match.description.empty()); |
| 576 | 575 |
| 577 // The instant URL should be more relevant. | 576 // The Instant URL should be more relevant. |
| 578 EXPECT_GT(instant_match.relevance, wyt_match.relevance); | 577 EXPECT_GT(instant_match.relevance, wyt_match.relevance); |
| 579 } | 578 } |
| 580 | 579 |
| 581 // An Instant URL suggestion should behave the same way whether the input text | 580 // An Instant URL suggestion should behave the same way whether the input text |
| 582 // is classified as UNKNOWN or as an URL. Otherwise if the user types | 581 // is classified as UNKNOWN or as an URL. Otherwise if the user types |
| 583 // "example.co" url-what-you-typed will displace the Instant suggestion for | 582 // "example.co" url-what-you-typed will displace the Instant suggestion for |
| 584 // "example.com". | 583 // "example.com". |
| 585 TEST_F(SearchProviderTest, FinalizeInstantURLWithURLText) { | 584 TEST_F(SearchProviderTest, FinalizeInstantURLWithURLText) { |
| 586 PrefService* service = profile_.GetPrefs(); | 585 PrefService* service = profile_.GetPrefs(); |
| 587 service->SetBoolean(prefs::kInstantEnabled, true); | 586 service->SetBoolean(prefs::kInstantEnabled, true); |
| 588 | 587 |
| 589 ASSERT_NO_FATAL_FAILURE(QueryForInputAndSetWYTMatch( | 588 ASSERT_NO_FATAL_FAILURE(QueryForInputAndSetWYTMatch( |
| 590 ASCIIToUTF16("example.co"), NULL)); | 589 ASCIIToUTF16("example.co"), NULL)); |
| 591 | 590 |
| 592 // Tell the provider instant is done. | 591 // Tell the provider Instant is done. |
| 593 provider_->FinalizeInstantQuery(ASCIIToUTF16("example.co"), | 592 provider_->FinalizeInstantQuery(ASCIIToUTF16("example.co"), |
| 594 InstantSuggestion( | 593 InstantSuggestion( |
| 595 ASCIIToUTF16("http://example.com/"), | 594 ASCIIToUTF16("http://example.com/"), |
| 596 INSTANT_COMPLETE_NOW, | 595 INSTANT_COMPLETE_NOW, |
| 597 INSTANT_SUGGESTION_URL)); | 596 true)); |
| 598 | 597 |
| 599 // The provider should now be done. | 598 // The provider should now be done. |
| 600 EXPECT_TRUE(provider_->done()); | 599 EXPECT_TRUE(provider_->done()); |
| 601 | 600 |
| 602 // There should be two matches, one for what you typed, the other for | 601 // There should be two matches, one for what you typed, the other for |
| 603 // "http://example.com/". | 602 // "http://example.com/". |
| 604 EXPECT_EQ(2u, provider_->matches().size()); | 603 EXPECT_EQ(2u, provider_->matches().size()); |
| 605 GURL instant_url("http://example.com"); | 604 GURL instant_url("http://example.com"); |
| 606 AutocompleteMatch instant_match; | 605 AutocompleteMatch instant_match; |
| 607 EXPECT_TRUE(FindMatchWithDestination(instant_url, &instant_match)); | 606 EXPECT_TRUE(FindMatchWithDestination(instant_url, &instant_match)); |
| 608 | 607 |
| 609 // The instant match should not have a description, it'll be set later. | 608 // The Instant match should not have a description, it'll be set later. |
| 610 EXPECT_TRUE(instant_match.description.empty()); | 609 EXPECT_TRUE(instant_match.description.empty()); |
| 611 | 610 |
| 612 // The instant URL should be more relevant than a URL_WHAT_YOU_TYPED match. | 611 // The Instant URL should be more relevant than a URL_WHAT_YOU_TYPED match. |
| 613 EXPECT_GT(instant_match.relevance, | 612 EXPECT_GT(instant_match.relevance, |
| 614 HistoryURLProvider::kScoreForWhatYouTypedResult); | 613 HistoryURLProvider::kScoreForWhatYouTypedResult); |
| 615 } | 614 } |
| 616 | 615 |
| 617 // Make sure that if FinalizeInstantQuery is invoked before suggest results | 616 // Make sure that if FinalizeInstantQuery is invoked before suggest results |
| 618 // return, the suggest text from FinalizeInstantQuery is remembered. | 617 // return, the suggest text from FinalizeInstantQuery is remembered. |
| 619 TEST_F(SearchProviderTest, RememberInstantQuery) { | 618 TEST_F(SearchProviderTest, RememberInstantQuery) { |
| 620 PrefService* service = profile_.GetPrefs(); | 619 PrefService* service = profile_.GetPrefs(); |
| 621 service->SetBoolean(prefs::kInstantEnabled, true); | 620 service->SetBoolean(prefs::kInstantEnabled, true); |
| 622 | 621 |
| 623 QueryForInput(ASCIIToUTF16("foo"), string16(), false); | 622 QueryForInput(ASCIIToUTF16("foo"), string16(), false); |
| 624 | 623 |
| 625 // Finalize the instant query immediately. | 624 // Finalize the Instant query immediately. |
| 626 provider_->FinalizeInstantQuery(ASCIIToUTF16("foo"), | 625 provider_->FinalizeInstantQuery(ASCIIToUTF16("foo"), |
| 627 InstantSuggestion(ASCIIToUTF16("bar"), | 626 InstantSuggestion(ASCIIToUTF16("bar"), |
| 628 INSTANT_COMPLETE_NOW, | 627 INSTANT_COMPLETE_NOW, |
| 629 INSTANT_SUGGESTION_SEARCH)); | 628 false)); |
| 630 | 629 |
| 631 // There should be two matches, one for what you typed, the other for | 630 // There should be two matches, one for what you typed, the other for |
| 632 // 'foobar'. | 631 // 'foobar'. |
| 633 EXPECT_EQ(2u, provider_->matches().size()); | 632 EXPECT_EQ(2u, provider_->matches().size()); |
| 634 GURL instant_url(default_t_url_->url_ref().ReplaceSearchTerms( | 633 GURL instant_url(default_t_url_->url_ref().ReplaceSearchTerms( |
| 635 TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("foobar")))); | 634 TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("foobar")))); |
| 636 AutocompleteMatch instant_match; | 635 AutocompleteMatch instant_match; |
| 637 EXPECT_TRUE(FindMatchWithDestination(instant_url, &instant_match)); | 636 EXPECT_TRUE(FindMatchWithDestination(instant_url, &instant_match)); |
| 638 | 637 |
| 639 // Wait until history and the suggest query complete. | 638 // Wait until history and the suggest query complete. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 654 | 653 |
| 655 // Make sure that if trailing whitespace is added to the text supplied to | 654 // Make sure that if trailing whitespace is added to the text supplied to |
| 656 // AutocompleteInput the default suggest text is cleared. | 655 // AutocompleteInput the default suggest text is cleared. |
| 657 TEST_F(SearchProviderTest, DifferingText) { | 656 TEST_F(SearchProviderTest, DifferingText) { |
| 658 PrefService* service = profile_.GetPrefs(); | 657 PrefService* service = profile_.GetPrefs(); |
| 659 service->SetBoolean(prefs::kInstantEnabled, true); | 658 service->SetBoolean(prefs::kInstantEnabled, true); |
| 660 | 659 |
| 661 ASSERT_NO_FATAL_FAILURE(QueryForInputAndSetWYTMatch(ASCIIToUTF16("foo"), | 660 ASSERT_NO_FATAL_FAILURE(QueryForInputAndSetWYTMatch(ASCIIToUTF16("foo"), |
| 662 NULL)); | 661 NULL)); |
| 663 | 662 |
| 664 // Finalize the instant query immediately. | 663 // Finalize the Instant query immediately. |
| 665 provider_->FinalizeInstantQuery(ASCIIToUTF16("foo"), | 664 provider_->FinalizeInstantQuery(ASCIIToUTF16("foo"), |
| 666 InstantSuggestion(ASCIIToUTF16("bar"), | 665 InstantSuggestion(ASCIIToUTF16("bar"), |
| 667 INSTANT_COMPLETE_NOW, | 666 INSTANT_COMPLETE_NOW, |
| 668 INSTANT_SUGGESTION_SEARCH)); | 667 false)); |
| 669 | 668 |
| 670 // Query with the same input text, but trailing whitespace. | 669 // Query with the same input text, but trailing whitespace. |
| 671 AutocompleteMatch instant_match; | 670 AutocompleteMatch instant_match; |
| 672 ASSERT_NO_FATAL_FAILURE(QueryForInputAndSetWYTMatch(ASCIIToUTF16("foo "), | 671 ASSERT_NO_FATAL_FAILURE(QueryForInputAndSetWYTMatch(ASCIIToUTF16("foo "), |
| 673 &instant_match)); | 672 &instant_match)); |
| 674 | 673 |
| 675 // There should only one match, for what you typed. | 674 // There should only one match, for what you typed. |
| 676 EXPECT_EQ(1u, provider_->matches().size()); | 675 EXPECT_EQ(1u, provider_->matches().size()); |
| 677 EXPECT_FALSE(instant_match.destination_url.is_empty()); | 676 EXPECT_FALSE(instant_match.destination_url.is_empty()); |
| 678 } | 677 } |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 // chrome/browser/extensions/api/omnibox/omnibox_apitest.cc. | 953 // chrome/browser/extensions/api/omnibox/omnibox_apitest.cc. |
| 955 }; | 954 }; |
| 956 | 955 |
| 957 // Test not in keyword mode. | 956 // Test not in keyword mode. |
| 958 RunTest(cases, arraysize(cases), false); | 957 RunTest(cases, arraysize(cases), false); |
| 959 | 958 |
| 960 // Test in keyword mode. (Both modes should give the same result.) | 959 // Test in keyword mode. (Both modes should give the same result.) |
| 961 RunTest(cases, arraysize(cases), true); | 960 RunTest(cases, arraysize(cases), true); |
| 962 } | 961 } |
| 963 | 962 |
| 964 // Verifies Navsuggest results don't set a TemplateURL, which instant relies on. | 963 // Verifies Navsuggest results don't set a TemplateURL, which Instant relies on. |
| 965 // Also verifies that just the *first* navigational result is listed as a match | 964 // Also verifies that just the *first* navigational result is listed as a match |
| 966 // if suggested relevance scores were not sent. | 965 // if suggested relevance scores were not sent. |
| 967 TEST_F(SearchProviderTest, NavSuggestNoSuggestedRelevanceScores) { | 966 TEST_F(SearchProviderTest, NavSuggestNoSuggestedRelevanceScores) { |
| 968 QueryForInput(ASCIIToUTF16("a.c"), string16(), false); | 967 QueryForInput(ASCIIToUTF16("a.c"), string16(), false); |
| 969 | 968 |
| 970 // Make sure the default providers suggest service was queried. | 969 // Make sure the default providers suggest service was queried. |
| 971 net::TestURLFetcher* fetcher = test_factory_.GetFetcherByID( | 970 net::TestURLFetcher* fetcher = test_factory_.GetFetcherByID( |
| 972 SearchProvider::kDefaultProviderURLFetcherID); | 971 SearchProvider::kDefaultProviderURLFetcherID); |
| 973 ASSERT_TRUE(fetcher); | 972 ASSERT_TRUE(fetcher); |
| 974 | 973 |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, | 1565 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, |
| 1567 match.contents_class[0].style); | 1566 match.contents_class[0].style); |
| 1568 EXPECT_EQ(4U, match.contents_class[1].offset); | 1567 EXPECT_EQ(4U, match.contents_class[1].offset); |
| 1569 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL | | 1568 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL | |
| 1570 AutocompleteMatch::ACMatchClassification::MATCH, | 1569 AutocompleteMatch::ACMatchClassification::MATCH, |
| 1571 match.contents_class[1].style); | 1570 match.contents_class[1].style); |
| 1572 EXPECT_EQ(5U, match.contents_class[2].offset); | 1571 EXPECT_EQ(5U, match.contents_class[2].offset); |
| 1573 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, | 1572 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, |
| 1574 match.contents_class[2].style); | 1573 match.contents_class[2].style); |
| 1575 } | 1574 } |
| OLD | NEW |