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

Side by Side Diff: components/omnibox/browser/keyword_provider_unittest.cc

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 12 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/browser/keyword_provider.h"
6
5 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility>
6 9
7 #include "base/command_line.h" 10 #include "base/command_line.h"
8 #include "base/macros.h" 11 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
11 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
12 #include "components/metrics/proto/omnibox_event.pb.h" 15 #include "components/metrics/proto/omnibox_event.pb.h"
13 #include "components/omnibox/browser/autocomplete_match.h" 16 #include "components/omnibox/browser/autocomplete_match.h"
14 #include "components/omnibox/browser/autocomplete_scheme_classifier.h" 17 #include "components/omnibox/browser/autocomplete_scheme_classifier.h"
15 #include "components/omnibox/browser/keyword_provider.h"
16 #include "components/omnibox/browser/mock_autocomplete_provider_client.h" 18 #include "components/omnibox/browser/mock_autocomplete_provider_client.h"
17 #include "components/omnibox/browser/omnibox_field_trial.h" 19 #include "components/omnibox/browser/omnibox_field_trial.h"
18 #include "components/search_engines/search_engines_switches.h" 20 #include "components/search_engines/search_engines_switches.h"
19 #include "components/search_engines/template_url.h" 21 #include "components/search_engines/template_url.h"
20 #include "components/search_engines/template_url_service.h" 22 #include "components/search_engines/template_url_service.h"
21 #include "components/variations/entropy_provider.h" 23 #include "components/variations/entropy_provider.h"
22 #include "components/variations/variations_associated_data.h" 24 #include "components/variations/variations_associated_data.h"
23 #include "testing/gmock/include/gmock/gmock.h" 25 #include "testing/gmock/include/gmock/gmock.h"
24 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
25 #include "url/gurl.h" 27 #include "url/gurl.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 "http://ignoreme.domain2.com/?q={searchTerms}", 106 "http://ignoreme.domain2.com/?q={searchTerms}",
105 "ignoreme.domain2.com" }, 107 "ignoreme.domain2.com" },
106 { "fooshort.com", "http://fooshort.com/?q={searchTerms}", "fooshort.com" }, 108 { "fooshort.com", "http://fooshort.com/?q={searchTerms}", "fooshort.com" },
107 { "foolong.co.uk", "http://foolong.co.uk/?q={searchTerms}", "foolong.co.uk" }, 109 { "foolong.co.uk", "http://foolong.co.uk/?q={searchTerms}", "foolong.co.uk" },
108 }; 110 };
109 111
110 void KeywordProviderTest::SetUpClientAndKeywordProvider() { 112 void KeywordProviderTest::SetUpClientAndKeywordProvider() {
111 scoped_ptr<TemplateURLService> template_url_service( 113 scoped_ptr<TemplateURLService> template_url_service(
112 new TemplateURLService(kTestData, arraysize(kTestData))); 114 new TemplateURLService(kTestData, arraysize(kTestData)));
113 client_.reset(new MockAutocompleteProviderClient()); 115 client_.reset(new MockAutocompleteProviderClient());
114 client_->set_template_url_service(template_url_service.Pass()); 116 client_->set_template_url_service(std::move(template_url_service));
115 kw_provider_ = new KeywordProvider(client_.get(), nullptr); 117 kw_provider_ = new KeywordProvider(client_.get(), nullptr);
116 } 118 }
117 119
118 void KeywordProviderTest::TearDown() { 120 void KeywordProviderTest::TearDown() {
119 client_.reset(); 121 client_.reset();
120 kw_provider_ = NULL; 122 kw_provider_ = NULL;
121 } 123 }
122 124
123 template<class ResultType> 125 template<class ResultType>
124 void KeywordProviderTest::RunTest(TestData<ResultType>* keyword_cases, 126 void KeywordProviderTest::RunTest(TestData<ResultType>* keyword_cases,
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 531
530 TEST_F(KeywordProviderTest, DoesNotProvideMatchesOnFocus) { 532 TEST_F(KeywordProviderTest, DoesNotProvideMatchesOnFocus) {
531 SetUpClientAndKeywordProvider(); 533 SetUpClientAndKeywordProvider();
532 AutocompleteInput input(ASCIIToUTF16("aaa"), base::string16::npos, 534 AutocompleteInput input(ASCIIToUTF16("aaa"), base::string16::npos,
533 std::string(), GURL(), 535 std::string(), GURL(),
534 metrics::OmniboxEventProto::INVALID_SPEC, true, false, 536 metrics::OmniboxEventProto::INVALID_SPEC, true, false,
535 true, true, true, TestingSchemeClassifier()); 537 true, true, true, TestingSchemeClassifier());
536 kw_provider_->Start(input, false); 538 kw_provider_->Start(input, false);
537 ASSERT_TRUE(kw_provider_->matches().empty()); 539 ASSERT_TRUE(kw_provider_->matches().empty());
538 } 540 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698