Chromium Code Reviews| 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, SetsBookmarkBarNotPinned) { | |
| 2627 profile_.GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, false); | |
| 2628 string16 term = term1_.substr(0, term1_.length() - 1); | |
| 2629 QueryForInput(term, true, false); | |
| 2630 | |
| 2631 ASSERT_FALSE(provider_->matches().empty()); | |
| 2632 ASSERT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, | |
|
Peter Kasting
2013/10/01 01:03:31
Nit: Can be EXPECT_EQ
Jered
2013/10/01 18:46:15
Done.
| |
| 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 | |
| 2638 TEST_F(SearchProviderTest, SetsBookmarkBarPinned) { | |
|
Peter Kasting
2013/10/01 01:03:31
Nit: I'd combine these two tests into one, Bookmar
Jered
2013/10/01 18:46:15
Done.
| |
| 2639 profile_.GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, true); | |
| 2640 string16 term = term1_.substr(0, term1_.length() - 1); | |
| 2641 QueryForInput(term, true, false); | |
| 2642 | |
| 2643 ASSERT_FALSE(provider_->matches().empty()); | |
| 2644 ASSERT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, | |
| 2645 provider_->matches()[0].type); | |
| 2646 ASSERT_TRUE(provider_->matches()[0].search_terms_args != NULL); | |
| 2647 EXPECT_TRUE(provider_->matches()[0].search_terms_args->bookmark_bar_pinned); | |
| 2648 } | |
| OLD | NEW |