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 "base/string_util.h" | 5 #include "base/string_util.h" |
6 #include "base/time.h" | 6 #include "base/time.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/browser/autocomplete/autocomplete_match.h" | 9 #include "chrome/browser/autocomplete/autocomplete_match.h" |
10 #include "chrome/browser/autocomplete/search_provider.h" | 10 #include "chrome/browser/autocomplete/search_provider.h" |
11 #include "chrome/browser/history/history.h" | 11 #include "chrome/browser/history/history.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/search_engines/template_url.h" | 13 #include "chrome/browser/search_engines/template_url.h" |
14 #include "chrome/browser/search_engines/template_url_model.h" | 14 #include "chrome/browser/search_engines/template_url_model.h" |
15 #include "chrome/common/net/test_url_fetcher_factory.h" | |
16 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
17 #include "chrome/test/testing_browser_process.h" | 16 #include "chrome/test/testing_browser_process.h" |
18 #include "chrome/test/testing_browser_process_test.h" | 17 #include "chrome/test/testing_browser_process_test.h" |
19 #include "chrome/test/testing_profile.h" | 18 #include "chrome/test/testing_profile.h" |
20 #include "content/browser/browser_thread.h" | 19 #include "content/browser/browser_thread.h" |
| 20 #include "content/common/test_url_fetcher_factory.h" |
21 #include "net/url_request/url_request_status.h" | 21 #include "net/url_request/url_request_status.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 | 23 |
24 // The following environment is configured for these tests: | 24 // The following environment is configured for these tests: |
25 // . The TemplateURL default_t_url_ is set as the default provider. | 25 // . The TemplateURL default_t_url_ is set as the default provider. |
26 // . The TemplateURL keyword_t_url_ is added to the TemplateURLModel. This | 26 // . The TemplateURL keyword_t_url_ is added to the TemplateURLModel. This |
27 // TemplateURL has a valid suggest and search URL. | 27 // TemplateURL has a valid suggest and search URL. |
28 // . The URL created by using the search term term1_ with default_t_url_ is | 28 // . The URL created by using the search term term1_ with default_t_url_ is |
29 // added to history. | 29 // added to history. |
30 // . The URL created by using the search term keyword_term_ with keyword_t_url_ | 30 // . The URL created by using the search term keyword_term_ with keyword_t_url_ |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 GURL what_you_typed_url = GURL(default_t_url_->url()->ReplaceSearchTerms( | 524 GURL what_you_typed_url = GURL(default_t_url_->url()->ReplaceSearchTerms( |
525 *default_t_url_, ASCIIToUTF16("two "), 0, string16())); | 525 *default_t_url_, ASCIIToUTF16("two "), 0, string16())); |
526 AutocompleteMatch what_you_typed_match = | 526 AutocompleteMatch what_you_typed_match = |
527 FindMatchWithDestination(what_you_typed_url); | 527 FindMatchWithDestination(what_you_typed_url); |
528 EXPECT_FALSE(what_you_typed_match.destination_url.is_empty()); | 528 EXPECT_FALSE(what_you_typed_match.destination_url.is_empty()); |
529 // term_match should be autocompleted. | 529 // term_match should be autocompleted. |
530 EXPECT_GT(term_match.relevance, what_you_typed_match.relevance); | 530 EXPECT_GT(term_match.relevance, what_you_typed_match.relevance); |
531 // And the offset should be at 4. | 531 // And the offset should be at 4. |
532 EXPECT_EQ(4u, term_match.inline_autocomplete_offset); | 532 EXPECT_EQ(4u, term_match.inline_autocomplete_offset); |
533 } | 533 } |
OLD | NEW |