| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 data.SetURL("http://defaultturl/{searchTerms}"); | 296 data.SetURL("http://defaultturl/{searchTerms}"); |
| 297 TemplateURL* default_t_url = new TemplateURL(&profile_, data); | 297 TemplateURL* default_t_url = new TemplateURL(&profile_, data); |
| 298 TemplateURLService* turl_model = | 298 TemplateURLService* turl_model = |
| 299 TemplateURLServiceFactory::GetForProfile(&profile_); | 299 TemplateURLServiceFactory::GetForProfile(&profile_); |
| 300 turl_model->Add(default_t_url); | 300 turl_model->Add(default_t_url); |
| 301 turl_model->SetUserSelectedDefaultSearchProvider(default_t_url); | 301 turl_model->SetUserSelectedDefaultSearchProvider(default_t_url); |
| 302 TemplateURLID default_provider_id = default_t_url->id(); | 302 TemplateURLID default_provider_id = default_t_url->id(); |
| 303 ASSERT_NE(0, default_provider_id); | 303 ASSERT_NE(0, default_provider_id); |
| 304 | 304 |
| 305 // Create another TemplateURL for KeywordProvider. | 305 // Create another TemplateURL for KeywordProvider. |
| 306 data.short_name = base::ASCIIToUTF16("k"); | 306 TemplateURLData data2; |
| 307 data.SetKeyword(base::ASCIIToUTF16("k")); | 307 data2.short_name = base::ASCIIToUTF16("k"); |
| 308 data.SetURL("http://keyword/{searchTerms}"); | 308 data2.SetKeyword(base::ASCIIToUTF16("k")); |
| 309 TemplateURL* keyword_t_url = new TemplateURL(&profile_, data); | 309 data2.SetURL("http://keyword/{searchTerms}"); |
| 310 TemplateURL* keyword_t_url = new TemplateURL(&profile_, data2); |
| 310 turl_model->Add(keyword_t_url); | 311 turl_model->Add(keyword_t_url); |
| 311 ASSERT_NE(0, keyword_t_url->id()); | 312 ASSERT_NE(0, keyword_t_url->id()); |
| 312 | 313 |
| 313 controller_.reset(new AutocompleteController( | 314 controller_.reset(new AutocompleteController( |
| 314 &profile_, NULL, | 315 &profile_, NULL, |
| 315 AutocompleteProvider::TYPE_KEYWORD | AutocompleteProvider::TYPE_SEARCH)); | 316 AutocompleteProvider::TYPE_KEYWORD | AutocompleteProvider::TYPE_SEARCH)); |
| 316 } | 317 } |
| 317 | 318 |
| 318 void AutocompleteProviderTest::ResetControllerWithKeywordProvider() { | 319 void AutocompleteProviderTest::ResetControllerWithKeywordProvider() { |
| 319 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 320 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456)); | 655 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456)); |
| 655 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j0j4&", url.path()); | 656 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j0j4&", url.path()); |
| 656 | 657 |
| 657 // Test page classification and field trial triggered set. | 658 // Test page classification and field trial triggered set. |
| 658 controller_->search_provider_->field_trial_triggered_in_session_ = true; | 659 controller_->search_provider_->field_trial_triggered_in_session_ = true; |
| 659 EXPECT_TRUE( | 660 EXPECT_TRUE( |
| 660 controller_->search_provider_->field_trial_triggered_in_session()); | 661 controller_->search_provider_->field_trial_triggered_in_session()); |
| 661 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456)); | 662 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456)); |
| 662 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j1j4&", url.path()); | 663 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j1j4&", url.path()); |
| 663 } | 664 } |
| OLD | NEW |