OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/autocomplete_provider.h" | 5 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 match.contents = match.fill_into_edit; | 135 match.contents = match.fill_into_edit; |
136 match.contents_class.push_back( | 136 match.contents_class.push_back( |
137 ACMatchClassification(0, ACMatchClassification::NONE)); | 137 ACMatchClassification(0, ACMatchClassification::NONE)); |
138 match.description = match.fill_into_edit; | 138 match.description = match.fill_into_edit; |
139 match.description_class.push_back( | 139 match.description_class.push_back( |
140 ACMatchClassification(0, ACMatchClassification::NONE)); | 140 ACMatchClassification(0, ACMatchClassification::NONE)); |
141 match.search_terms_args.reset( | 141 match.search_terms_args.reset( |
142 new TemplateURLRef::SearchTermsArgs(search_terms_args)); | 142 new TemplateURLRef::SearchTermsArgs(search_terms_args)); |
143 if (!match_keyword_.empty()) { | 143 if (!match_keyword_.empty()) { |
144 match.keyword = match_keyword_; | 144 match.keyword = match_keyword_; |
145 ASSERT_TRUE(match.GetTemplateURL(profile_, false) != NULL); | 145 TemplateURLService* service = |
| 146 TemplateURLServiceFactory::GetForProfile(profile_); |
| 147 ASSERT_TRUE(match.GetTemplateURL(service, false) != NULL); |
146 } | 148 } |
147 | 149 |
148 matches_.push_back(match); | 150 matches_.push_back(match); |
149 } | 151 } |
150 } | 152 } |
151 | 153 |
152 class AutocompleteProviderTest : public testing::Test, | 154 class AutocompleteProviderTest : public testing::Test, |
153 public content::NotificationObserver { | 155 public content::NotificationObserver { |
154 protected: | 156 protected: |
155 struct KeywordTestData { | 157 struct KeywordTestData { |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456)); | 660 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456)); |
659 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j0j4&", url.path()); | 661 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j0j4&", url.path()); |
660 | 662 |
661 // Test page classification and field trial triggered set. | 663 // Test page classification and field trial triggered set. |
662 controller_->search_provider_->field_trial_triggered_in_session_ = true; | 664 controller_->search_provider_->field_trial_triggered_in_session_ = true; |
663 EXPECT_TRUE( | 665 EXPECT_TRUE( |
664 controller_->search_provider_->field_trial_triggered_in_session()); | 666 controller_->search_provider_->field_trial_triggered_in_session()); |
665 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456)); | 667 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456)); |
666 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j1j4&", url.path()); | 668 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j1j4&", url.path()); |
667 } | 669 } |
OLD | NEW |