| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 2604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2615 SCOPED_TRACE(description); | 2615 SCOPED_TRACE(description); |
| 2616 EXPECT_EQ(cases[i].matches[j].contents, UTF16ToUTF8(matches[j].contents)); | 2616 EXPECT_EQ(cases[i].matches[j].contents, UTF16ToUTF8(matches[j].contents)); |
| 2617 EXPECT_EQ(cases[i].matches[j].allowed_to_be_prefetched, | 2617 EXPECT_EQ(cases[i].matches[j].allowed_to_be_prefetched, |
| 2618 SearchProvider::ShouldPrefetch(matches[j])); | 2618 SearchProvider::ShouldPrefetch(matches[j])); |
| 2619 EXPECT_EQ(cases[i].matches[j].type, matches[j].type); | 2619 EXPECT_EQ(cases[i].matches[j].type, matches[j].type); |
| 2620 EXPECT_EQ(cases[i].matches[j].from_keyword, | 2620 EXPECT_EQ(cases[i].matches[j].from_keyword, |
| 2621 matches[j].keyword == ASCIIToUTF16("k")); | 2621 matches[j].keyword == ASCIIToUTF16("k")); |
| 2622 } | 2622 } |
| 2623 } | 2623 } |
| 2624 } | 2624 } |
| 2625 |
| 2626 TEST_F(SearchProviderTest, ReflectsBookmarkBarState) { |
| 2627 profile_.GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, false); |
| 2628 string16 term = term1_.substr(0, term1_.length() - 1); |
| 2629 QueryForInput(term, true, false); |
| 2630 ASSERT_FALSE(provider_->matches().empty()); |
| 2631 EXPECT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, |
| 2632 provider_->matches()[0].type); |
| 2633 ASSERT_TRUE(provider_->matches()[0].search_terms_args != NULL); |
| 2634 EXPECT_FALSE(provider_->matches()[0].search_terms_args->bookmark_bar_pinned); |
| 2635 |
| 2636 profile_.GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, true); |
| 2637 term = term1_.substr(0, term1_.length() - 1); |
| 2638 QueryForInput(term, true, false); |
| 2639 ASSERT_FALSE(provider_->matches().empty()); |
| 2640 EXPECT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, |
| 2641 provider_->matches()[0].type); |
| 2642 ASSERT_TRUE(provider_->matches()[0].search_terms_args != NULL); |
| 2643 EXPECT_TRUE(provider_->matches()[0].search_terms_args->bookmark_bar_pinned); |
| 2644 } |
| OLD | NEW |