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

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

Issue 1868763002: Remove URLRequest::IsHandledProtocol and IsHandledURL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: finish removing URLRequest::IsHandledProtocol() Created 4 years, 8 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" 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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "components/metrics/proto/omnibox_event.pb.h" 15 #include "components/metrics/proto/omnibox_event.pb.h"
16 #include "components/omnibox/browser/autocomplete_match.h" 16 #include "components/omnibox/browser/autocomplete_match.h"
17 #include "components/omnibox/browser/autocomplete_scheme_classifier.h" 17 #include "components/omnibox/browser/autocomplete_scheme_classifier.h"
18 #include "components/omnibox/browser/mock_autocomplete_provider_client.h" 18 #include "components/omnibox/browser/mock_autocomplete_provider_client.h"
19 #include "components/omnibox/browser/omnibox_field_trial.h" 19 #include "components/omnibox/browser/omnibox_field_trial.h"
20 #include "components/search_engines/search_engines_switches.h" 20 #include "components/search_engines/search_engines_switches.h"
21 #include "components/search_engines/template_url.h" 21 #include "components/search_engines/template_url.h"
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/gmock/include/gmock/gmock.h" 25 #include "testing/gmock/include/gmock/gmock.h"
26 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
27 #include "url/gurl.h" 27 #include "url/gurl.h"
28 #include "url/url_constants.h"
28 29
29 using base::ASCIIToUTF16; 30 using base::ASCIIToUTF16;
30 31
31 namespace { 32 namespace {
32 33
33 class TestingSchemeClassifier : public AutocompleteSchemeClassifier { 34 class TestingSchemeClassifier : public AutocompleteSchemeClassifier {
34 public: 35 public:
35 metrics::OmniboxInputType::Type GetInputTypeForScheme( 36 metrics::OmniboxInputType::Type GetInputTypeForScheme(
36 const std::string& scheme) const override { 37 const std::string& scheme) const override {
37 if (net::URLRequest::IsHandledProtocol(scheme)) 38 if (scheme == url::kHttpScheme || scheme == url::kHttpsScheme ||
39 scheme == url::kWsScheme || scheme == url::kWssScheme) {
38 return metrics::OmniboxInputType::URL; 40 return metrics::OmniboxInputType::URL;
41 }
39 return metrics::OmniboxInputType::INVALID; 42 return metrics::OmniboxInputType::INVALID;
40 } 43 }
41 }; 44 };
42 45
43 } // namespace 46 } // namespace
44 47
45 class KeywordProviderTest : public testing::Test { 48 class KeywordProviderTest : public testing::Test {
46 protected: 49 protected:
47 template<class ResultType> 50 template<class ResultType>
48 struct MatchType { 51 struct MatchType {
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 538
536 TEST_F(KeywordProviderTest, DoesNotProvideMatchesOnFocus) { 539 TEST_F(KeywordProviderTest, DoesNotProvideMatchesOnFocus) {
537 SetUpClientAndKeywordProvider(); 540 SetUpClientAndKeywordProvider();
538 AutocompleteInput input(ASCIIToUTF16("aaa"), base::string16::npos, 541 AutocompleteInput input(ASCIIToUTF16("aaa"), base::string16::npos,
539 std::string(), GURL(), 542 std::string(), GURL(),
540 metrics::OmniboxEventProto::INVALID_SPEC, true, false, 543 metrics::OmniboxEventProto::INVALID_SPEC, true, false,
541 true, true, true, TestingSchemeClassifier()); 544 true, true, true, TestingSchemeClassifier());
542 kw_provider_->Start(input, false); 545 kw_provider_->Start(input, false);
543 ASSERT_TRUE(kw_provider_->matches().empty()); 546 ASSERT_TRUE(kw_provider_->matches().empty());
544 } 547 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698