OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/browser/autocomplete/autocomplete.h" | 11 #include "chrome/browser/autocomplete/autocomplete.h" |
12 #include "chrome/browser/autocomplete/autocomplete_match.h" | 12 #include "chrome/browser/autocomplete/autocomplete_match.h" |
13 #include "chrome/browser/history/history.h" | 13 #include "chrome/browser/history/history.h" |
14 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
15 #include "chrome/browser/search_engines/template_url.h" | 15 #include "chrome/browser/search_engines/template_url.h" |
16 #include "chrome/browser/search_engines/template_url_service.h" | 16 #include "chrome/browser/search_engines/template_url_service.h" |
17 #include "chrome/browser/search_engines/template_url_service_factory.h" | 17 #include "chrome/browser/search_engines/template_url_service_factory.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 #include "chrome/test/base/testing_browser_process.h" | 19 #include "chrome/test/base/testing_browser_process.h" |
20 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
21 #include "content/test/test_browser_thread.h" | 21 #include "content/test/test_browser_thread.h" |
22 #include "content/test/test_url_fetcher_factory.h" | 22 #include "content/test/test_url_fetcher_factory.h" |
23 #include "net/url_request/url_request_status.h" | 23 #include "net/url_request/url_request_status.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 | 25 |
| 26 using content::BrowserThread; |
| 27 |
26 // The following environment is configured for these tests: | 28 // The following environment is configured for these tests: |
27 // . The TemplateURL default_t_url_ is set as the default provider. | 29 // . The TemplateURL default_t_url_ is set as the default provider. |
28 // . The TemplateURL keyword_t_url_ is added to the TemplateURLService. This | 30 // . The TemplateURL keyword_t_url_ is added to the TemplateURLService. This |
29 // TemplateURL has a valid suggest and search URL. | 31 // TemplateURL has a valid suggest and search URL. |
30 // . The URL created by using the search term term1_ with default_t_url_ is | 32 // . The URL created by using the search term term1_ with default_t_url_ is |
31 // added to history. | 33 // added to history. |
32 // . The URL created by using the search term keyword_term_ with keyword_t_url_ | 34 // . The URL created by using the search term keyword_term_ with keyword_t_url_ |
33 // is added to history. | 35 // is added to history. |
34 // . test_factory_ is set as the URLFetcherFactory. | 36 // . test_factory_ is set as the URLFetcherFactory. |
35 class SearchProviderTest : public testing::Test, | 37 class SearchProviderTest : public testing::Test, |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 fetcher = NULL; | 656 fetcher = NULL; |
655 | 657 |
656 // Run till the history results complete. | 658 // Run till the history results complete. |
657 RunTillProviderDone(); | 659 RunTillProviderDone(); |
658 | 660 |
659 // Make sure there is a match for 'a.com' and it doesn't have a template_url. | 661 // Make sure there is a match for 'a.com' and it doesn't have a template_url. |
660 AutocompleteMatch nav_match; | 662 AutocompleteMatch nav_match; |
661 EXPECT_TRUE(FindMatchWithDestination(GURL("http://a.com"), &nav_match)); | 663 EXPECT_TRUE(FindMatchWithDestination(GURL("http://a.com"), &nav_match)); |
662 EXPECT_FALSE(nav_match.template_url); | 664 EXPECT_FALSE(nav_match.template_url); |
663 } | 665 } |
OLD | NEW |