Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: components/omnibox/autocomplete_result_unittest.cc

Issue 628263004: [Android] Simplify logic for grabbing initial country-code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/autocomplete_result.h" 5 #include "components/omnibox/autocomplete_result.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "components/metrics/proto/omnibox_event.pb.h" 14 #include "components/metrics/proto/omnibox_event.pb.h"
15 #include "components/omnibox/autocomplete_input.h" 15 #include "components/omnibox/autocomplete_input.h"
16 #include "components/omnibox/autocomplete_match.h" 16 #include "components/omnibox/autocomplete_match.h"
17 #include "components/omnibox/autocomplete_match_type.h" 17 #include "components/omnibox/autocomplete_match_type.h"
18 #include "components/omnibox/autocomplete_provider.h" 18 #include "components/omnibox/autocomplete_provider.h"
19 #include "components/omnibox/omnibox_field_trial.h" 19 #include "components/omnibox/omnibox_field_trial.h"
20 #include "components/omnibox/test_scheme_classifier.h" 20 #include "components/omnibox/test_scheme_classifier.h"
21 #include "components/search_engines/template_url_prepopulate_data.h" 21 #include "components/search_engines/template_url_prepopulate_data.h"
Peter Kasting 2014/10/06 20:28:27 This #include can probably be removed.
Yaron 2014/10/08 00:08:54 Done.
22 #include "components/search_engines/template_url_service.h" 22 #include "components/search_engines/template_url_service.h"
23 #include "components/variations/entropy_provider.h" 23 #include "components/variations/entropy_provider.h"
24 #include "components/variations/variations_associated_data.h" 24 #include "components/variations/variations_associated_data.h"
25 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
26 26
27 using metrics::OmniboxEventProto; 27 using metrics::OmniboxEventProto;
28 28
29 namespace { 29 namespace {
30 30
31 struct AutocompleteMatchTestData { 31 struct AutocompleteMatchTestData {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 AutocompleteResultTest() { 83 AutocompleteResultTest() {
84 // Destroy the existing FieldTrialList before creating a new one to avoid 84 // Destroy the existing FieldTrialList before creating a new one to avoid
85 // a DCHECK. 85 // a DCHECK.
86 field_trial_list_.reset(); 86 field_trial_list_.reset();
87 field_trial_list_.reset(new base::FieldTrialList( 87 field_trial_list_.reset(new base::FieldTrialList(
88 new metrics::SHA1EntropyProvider("foo"))); 88 new metrics::SHA1EntropyProvider("foo")));
89 variations::testing::ClearAllVariationParams(); 89 variations::testing::ClearAllVariationParams();
90 } 90 }
91 91
92 virtual void SetUp() override { 92 virtual void SetUp() override {
93 #if defined(OS_ANDROID)
94 TemplateURLPrepopulateData::InitCountryCode(
95 std::string() /* unknown country code */);
96 #endif
97 template_url_service_.reset(new TemplateURLService(NULL, 0)); 93 template_url_service_.reset(new TemplateURLService(NULL, 0));
98 template_url_service_->Load(); 94 template_url_service_->Load();
99 } 95 }
100 96
101 // Configures |match| from |data|. 97 // Configures |match| from |data|.
102 static void PopulateAutocompleteMatch(const TestData& data, 98 static void PopulateAutocompleteMatch(const TestData& data,
103 AutocompleteMatch* match); 99 AutocompleteMatch* match);
104 100
105 // Adds |count| AutocompleteMatches to |matches|. 101 // Adds |count| AutocompleteMatches to |matches|.
106 static void PopulateAutocompleteMatches(const TestData* data, 102 static void PopulateAutocompleteMatches(const TestData* data,
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 result.Reset(); 830 result.Reset();
835 matches.clear(); 831 matches.clear();
836 832
837 // Case 5: Multiple verbatim matches found in AutocompleteResult. 833 // Case 5: Multiple verbatim matches found in AutocompleteResult.
838 PopulateAutocompleteMatchesFromTestData(kVerbatimMatches, 834 PopulateAutocompleteMatchesFromTestData(kVerbatimMatches,
839 arraysize(kVerbatimMatches), 835 arraysize(kVerbatimMatches),
840 &matches); 836 &matches);
841 result.AppendMatches(matches); 837 result.AppendMatches(matches);
842 EXPECT_FALSE(result.ShouldHideTopMatch()); 838 EXPECT_FALSE(result.ShouldHideTopMatch());
843 } 839 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698