OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "chrome/browser/autocomplete/search_provider.h" | 5 #include "chrome/browser/autocomplete/search_provider.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 15 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
16 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 16 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
17 #include "chrome/browser/autocomplete/autocomplete_input.h" | 17 #include "chrome/browser/autocomplete/autocomplete_input.h" |
18 #include "chrome/browser/autocomplete/autocomplete_match.h" | 18 #include "chrome/browser/autocomplete/autocomplete_match.h" |
19 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 19 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
20 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" | 20 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" |
21 #include "chrome/browser/autocomplete/history_url_provider.h" | 21 #include "chrome/browser/autocomplete/history_url_provider.h" |
22 #include "chrome/browser/history/history_service.h" | 22 #include "chrome/browser/history/history_service.h" |
23 #include "chrome/browser/history/history_service_factory.h" | 23 #include "chrome/browser/history/history_service_factory.h" |
24 #include "chrome/browser/omnibox/omnibox_field_trial.h" | 24 #include "chrome/browser/omnibox/omnibox_field_trial.h" |
25 #include "chrome/browser/search/search.h" | 25 #include "chrome/browser/search/search.h" |
26 #include "chrome/browser/search_engines/template_url.h" | 26 #include "chrome/browser/search_engines/template_url.h" |
27 #include "chrome/browser/search_engines/template_url_service.h" | 27 #include "chrome/browser/search_engines/template_url_service.h" |
28 #include "chrome/browser/search_engines/template_url_service_factory.h" | 28 #include "chrome/browser/search_engines/template_url_service_factory.h" |
29 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
30 #include "chrome/common/metrics/entropy_provider.h" | |
31 #include "chrome/common/metrics/variations/variations_util.h" | 30 #include "chrome/common/metrics/variations/variations_util.h" |
32 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
33 #include "chrome/test/base/testing_browser_process.h" | 32 #include "chrome/test/base/testing_browser_process.h" |
34 #include "chrome/test/base/testing_profile.h" | 33 #include "chrome/test/base/testing_profile.h" |
| 34 #include "components/variations/entropy_provider.h" |
35 #include "content/public/test/test_browser_thread_bundle.h" | 35 #include "content/public/test/test_browser_thread_bundle.h" |
36 #include "net/url_request/test_url_fetcher_factory.h" | 36 #include "net/url_request/test_url_fetcher_factory.h" |
37 #include "net/url_request/url_request_status.h" | 37 #include "net/url_request/url_request_status.h" |
38 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
39 | 39 |
40 | |
41 // SearchProviderTest --------------------------------------------------------- | 40 // SearchProviderTest --------------------------------------------------------- |
42 | 41 |
43 // The following environment is configured for these tests: | 42 // The following environment is configured for these tests: |
44 // . The TemplateURL default_t_url_ is set as the default provider. | 43 // . The TemplateURL default_t_url_ is set as the default provider. |
45 // . The TemplateURL keyword_t_url_ is added to the TemplateURLService. This | 44 // . The TemplateURL keyword_t_url_ is added to the TemplateURLService. This |
46 // TemplateURL has a valid suggest and search URL. | 45 // TemplateURL has a valid suggest and search URL. |
47 // . The URL created by using the search term term1_ with default_t_url_ is | 46 // . The URL created by using the search term term1_ with default_t_url_ is |
48 // added to history. | 47 // added to history. |
49 // . The URL created by using the search term keyword_term_ with keyword_t_url_ | 48 // . The URL created by using the search term keyword_term_ with keyword_t_url_ |
50 // is added to history. | 49 // is added to history. |
(...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2595 SCOPED_TRACE(description); | 2594 SCOPED_TRACE(description); |
2596 EXPECT_EQ(cases[i].matches[j].contents, UTF16ToUTF8(matches[j].contents)); | 2595 EXPECT_EQ(cases[i].matches[j].contents, UTF16ToUTF8(matches[j].contents)); |
2597 EXPECT_EQ(cases[i].matches[j].allowed_to_be_prefetched, | 2596 EXPECT_EQ(cases[i].matches[j].allowed_to_be_prefetched, |
2598 SearchProvider::ShouldPrefetch(matches[j])); | 2597 SearchProvider::ShouldPrefetch(matches[j])); |
2599 EXPECT_EQ(cases[i].matches[j].type, matches[j].type); | 2598 EXPECT_EQ(cases[i].matches[j].type, matches[j].type); |
2600 EXPECT_EQ(cases[i].matches[j].from_keyword, | 2599 EXPECT_EQ(cases[i].matches[j].from_keyword, |
2601 matches[j].keyword == ASCIIToUTF16("k")); | 2600 matches[j].keyword == ASCIIToUTF16("k")); |
2602 } | 2601 } |
2603 } | 2602 } |
2604 } | 2603 } |
OLD | NEW |