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 | |
Peter Kasting
2013/10/01 21:54:55
Nit: Remove this (since you don't have a similar b
Jered
2013/10/01 23:07:07
Done.
| |
2631 ASSERT_FALSE(provider_->matches().empty()); | |
2632 EXPECT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, | |
2633 provider_->matches()[0].type); | |
2634 ASSERT_TRUE(provider_->matches()[0].search_terms_args != NULL); | |
2635 EXPECT_FALSE(provider_->matches()[0].search_terms_args->bookmark_bar_pinned); | |
2636 | |
2637 profile_.GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, true); | |
2638 term = term1_.substr(0, term1_.length() - 1); | |
2639 QueryForInput(term, true, false); | |
2640 ASSERT_FALSE(provider_->matches().empty()); | |
2641 EXPECT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, | |
2642 provider_->matches()[0].type); | |
2643 ASSERT_TRUE(provider_->matches()[0].search_terms_args != NULL); | |
2644 EXPECT_TRUE(provider_->matches()[0].search_terms_args->bookmark_bar_pinned); | |
2645 } | |
OLD | NEW |