| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/omnibox/browser/keyword_provider.h" | 5 #include "components/omnibox/browser/keyword_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 const base::string16 input; | 56 const base::string16 input; |
| 57 const size_t num_results; | 57 const size_t num_results; |
| 58 const MatchType<ResultType> output[3]; | 58 const MatchType<ResultType> output[3]; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 KeywordProviderTest() : kw_provider_(NULL) { | 61 KeywordProviderTest() : kw_provider_(NULL) { |
| 62 // Destroy the existing FieldTrialList before creating a new one to avoid | 62 // Destroy the existing FieldTrialList before creating a new one to avoid |
| 63 // a DCHECK. | 63 // a DCHECK. |
| 64 field_trial_list_.reset(); | 64 field_trial_list_.reset(); |
| 65 field_trial_list_.reset(new base::FieldTrialList( | 65 field_trial_list_.reset(new base::FieldTrialList( |
| 66 new metrics::SHA1EntropyProvider("foo"))); | 66 base::MakeUnique<metrics::SHA1EntropyProvider>("foo"))); |
| 67 variations::testing::ClearAllVariationParams(); | 67 variations::testing::ClearAllVariationParams(); |
| 68 } | 68 } |
| 69 ~KeywordProviderTest() override {} | 69 ~KeywordProviderTest() override {} |
| 70 | 70 |
| 71 // Should be called at least once during a test case. This is a separate | 71 // Should be called at least once during a test case. This is a separate |
| 72 // function from SetUp() because the client may want to set parameters | 72 // function from SetUp() because the client may want to set parameters |
| 73 // (e.g., field trials) before initializing TemplateURLService and the | 73 // (e.g., field trials) before initializing TemplateURLService and the |
| 74 // related internal variables here. | 74 // related internal variables here. |
| 75 void SetUpClientAndKeywordProvider(); | 75 void SetUpClientAndKeywordProvider(); |
| 76 | 76 |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 | 536 |
| 537 TEST_F(KeywordProviderTest, DoesNotProvideMatchesOnFocus) { | 537 TEST_F(KeywordProviderTest, DoesNotProvideMatchesOnFocus) { |
| 538 SetUpClientAndKeywordProvider(); | 538 SetUpClientAndKeywordProvider(); |
| 539 AutocompleteInput input(ASCIIToUTF16("aaa"), base::string16::npos, | 539 AutocompleteInput input(ASCIIToUTF16("aaa"), base::string16::npos, |
| 540 std::string(), GURL(), | 540 std::string(), GURL(), |
| 541 metrics::OmniboxEventProto::INVALID_SPEC, true, false, | 541 metrics::OmniboxEventProto::INVALID_SPEC, true, false, |
| 542 true, true, true, TestingSchemeClassifier()); | 542 true, true, true, TestingSchemeClassifier()); |
| 543 kw_provider_->Start(input, false); | 543 kw_provider_->Start(input, false); |
| 544 ASSERT_TRUE(kw_provider_->matches().empty()); | 544 ASSERT_TRUE(kw_provider_->matches().empty()); |
| 545 } | 545 } |
| OLD | NEW |