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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "components/metrics/proto/omnibox_event.pb.h" | 8 #include "components/metrics/proto/omnibox_event.pb.h" |
9 #include "components/omnibox/autocomplete_match.h" | 9 #include "components/omnibox/autocomplete_match.h" |
10 #include "components/omnibox/autocomplete_scheme_classifier.h" | 10 #include "components/omnibox/autocomplete_scheme_classifier.h" |
11 #include "components/omnibox/keyword_provider.h" | 11 #include "components/omnibox/keyword_provider.h" |
12 #include "components/search_engines/search_engines_switches.h" | 12 #include "components/search_engines/search_engines_switches.h" |
13 #include "components/search_engines/template_url.h" | 13 #include "components/search_engines/template_url.h" |
14 #include "components/search_engines/template_url_service.h" | 14 #include "components/search_engines/template_url_service.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 using base::ASCIIToUTF16; | 18 using base::ASCIIToUTF16; |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 class TestingSchemeClassifier : public AutocompleteSchemeClassifier { | 22 class TestingSchemeClassifier : public AutocompleteSchemeClassifier { |
23 public: | 23 public: |
24 virtual metrics::OmniboxInputType::Type GetInputTypeForScheme( | 24 virtual metrics::OmniboxInputType::Type GetInputTypeForScheme( |
25 const std::string& scheme) const OVERRIDE { | 25 const std::string& scheme) const override { |
26 if (net::URLRequest::IsHandledProtocol(scheme)) | 26 if (net::URLRequest::IsHandledProtocol(scheme)) |
27 return metrics::OmniboxInputType::URL; | 27 return metrics::OmniboxInputType::URL; |
28 return metrics::OmniboxInputType::INVALID; | 28 return metrics::OmniboxInputType::INVALID; |
29 } | 29 } |
30 }; | 30 }; |
31 | 31 |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 class KeywordProviderTest : public testing::Test { | 34 class KeywordProviderTest : public testing::Test { |
35 protected: | 35 protected: |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 TestData<GURL> url_cases[] = { | 360 TestData<GURL> url_cases[] = { |
361 { ASCIIToUTF16("a 1 2 3"), 3, | 361 { ASCIIToUTF16("a 1 2 3"), 3, |
362 { { GURL("aa.com?a=b&foo=1+2+3"), false }, | 362 { { GURL("aa.com?a=b&foo=1+2+3"), false }, |
363 { GURL("bogus URL 1+2+3"), false }, | 363 { GURL("bogus URL 1+2+3"), false }, |
364 { GURL("http://aaaa/?aaaa=1&b=1+2+3&c"), false } } }, | 364 { GURL("http://aaaa/?aaaa=1&b=1+2+3&c"), false } } }, |
365 }; | 365 }; |
366 | 366 |
367 RunTest<GURL>(url_cases, arraysize(url_cases), | 367 RunTest<GURL>(url_cases, arraysize(url_cases), |
368 &AutocompleteMatch::destination_url); | 368 &AutocompleteMatch::destination_url); |
369 } | 369 } |
OLD | NEW |