Chromium Code Reviews| 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" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 | 144 |
| 145 // Add a page and search term for keyword_t_url_. | 145 // Add a page and search term for keyword_t_url_. |
| 146 keyword_url_ = AddSearchToHistory(keyword_t_url_, keyword_term_, 1); | 146 keyword_url_ = AddSearchToHistory(keyword_t_url_, keyword_term_, 1); |
| 147 | 147 |
| 148 // Keywords are updated by the InMemoryHistoryBackend only after the message | 148 // Keywords are updated by the InMemoryHistoryBackend only after the message |
| 149 // has been processed on the history thread. Block until history processes all | 149 // has been processed on the history thread. Block until history processes all |
| 150 // requests to ensure the InMemoryDatabase is the state we expect it. | 150 // requests to ensure the InMemoryDatabase is the state we expect it. |
| 151 profile_.BlockUntilHistoryProcessesPendingRequests(); | 151 profile_.BlockUntilHistoryProcessesPendingRequests(); |
| 152 | 152 |
| 153 provider_ = new SearchProvider(this, &profile_); | 153 provider_ = new SearchProvider(this, &profile_); |
| 154 | |
| 155 // Prevent the Instant field trial from kicking in. | |
| 156 PrefService* service = profile_.GetPrefs(); | |
| 157 service->SetBoolean(prefs::kInstantEnabledOnce, true); | |
|
Peter Kasting
2011/08/15 21:46:49
Do other instances of this pref also need to be re
sreeram
2011/08/15 22:54:48
Nope, there are only two other places this pref is
| |
| 158 } | 154 } |
| 159 | 155 |
| 160 void SearchProviderTest::OnProviderUpdate(bool updated_matches) { | 156 void SearchProviderTest::OnProviderUpdate(bool updated_matches) { |
| 161 if (quit_when_done_ && provider_->done()) { | 157 if (quit_when_done_ && provider_->done()) { |
| 162 quit_when_done_ = false; | 158 quit_when_done_ = false; |
| 163 message_loop_.Quit(); | 159 message_loop_.Quit(); |
| 164 } | 160 } |
| 165 } | 161 } |
| 166 | 162 |
| 167 void SearchProviderTest::RunTillProviderDone() { | 163 void SearchProviderTest::RunTillProviderDone() { |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 662 fetcher = NULL; | 658 fetcher = NULL; |
| 663 | 659 |
| 664 // Run till the history results complete. | 660 // Run till the history results complete. |
| 665 RunTillProviderDone(); | 661 RunTillProviderDone(); |
| 666 | 662 |
| 667 // Make sure there is a match for 'a.com' and it doesn't have a template_url. | 663 // Make sure there is a match for 'a.com' and it doesn't have a template_url. |
| 668 AutocompleteMatch nav_match; | 664 AutocompleteMatch nav_match; |
| 669 EXPECT_TRUE(FindMatchWithDestination(GURL("http://a.com"), &nav_match)); | 665 EXPECT_TRUE(FindMatchWithDestination(GURL("http://a.com"), &nav_match)); |
| 670 EXPECT_FALSE(nav_match.template_url); | 666 EXPECT_FALSE(nav_match.template_url); |
| 671 } | 667 } |
| OLD | NEW |