| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/time.h" | 5 #include "base/time.h" |
| 6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
| 7 #include "chrome/browser/autocomplete/search_provider.h" | 7 #include "chrome/browser/autocomplete/search_provider.h" |
| 8 #include "chrome/browser/history/history.h" | 8 #include "chrome/browser/history/history.h" |
| 9 #include "chrome/browser/net/test_url_fetcher_factory.h" | 9 #include "chrome/browser/net/test_url_fetcher_factory.h" |
| 10 #include "chrome/browser/search_engines/template_url.h" | 10 #include "chrome/browser/search_engines/template_url.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 quit_when_done_ = false; | 134 quit_when_done_ = false; |
| 135 message_loop_.Quit(); | 135 message_loop_.Quit(); |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 void SearchProviderTest::RunTillProviderDone() { | 139 void SearchProviderTest::RunTillProviderDone() { |
| 140 if (provider_->done()) | 140 if (provider_->done()) |
| 141 return; | 141 return; |
| 142 | 142 |
| 143 quit_when_done_ = true; | 143 quit_when_done_ = true; |
| 144 #if defined(OS_WIN) | 144 #if defined(OS_WIN) || defined(OS_LINUX) |
| 145 message_loop_.Run(NULL); | 145 message_loop_.Run(NULL); |
| 146 #elif defined(OS_POSIX) | 146 #else |
| 147 message_loop_.Run(); | 147 message_loop_.Run(); |
| 148 #endif | 148 #endif |
| 149 } | 149 } |
| 150 | 150 |
| 151 void SearchProviderTest::QueryForInput(const std::wstring& text) { | 151 void SearchProviderTest::QueryForInput(const std::wstring& text) { |
| 152 // Start a query. | 152 // Start a query. |
| 153 AutocompleteInput input(text, std::wstring(), false, false, false); | 153 AutocompleteInput input(text, std::wstring(), false, false, false); |
| 154 provider_->Start(input, false); | 154 provider_->Start(input, false); |
| 155 | 155 |
| 156 // RunAllPending so that the task scheduled by SearchProvider to create the | 156 // RunAllPending so that the task scheduled by SearchProvider to create the |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 AutocompleteMatch match = FindMatchWithDestination(keyword_url_); | 250 AutocompleteMatch match = FindMatchWithDestination(keyword_url_); |
| 251 ASSERT_TRUE(!match.destination_url.is_empty()); | 251 ASSERT_TRUE(!match.destination_url.is_empty()); |
| 252 | 252 |
| 253 // The match should have a TemplateURL. | 253 // The match should have a TemplateURL. |
| 254 EXPECT_TRUE(match.template_url); | 254 EXPECT_TRUE(match.template_url); |
| 255 | 255 |
| 256 // The fill into edit should contain the keyword. | 256 // The fill into edit should contain the keyword. |
| 257 EXPECT_EQ(keyword_t_url_->keyword() + L" " + keyword_term_, | 257 EXPECT_EQ(keyword_t_url_->keyword() + L" " + keyword_term_, |
| 258 match.fill_into_edit); | 258 match.fill_into_edit); |
| 259 } | 259 } |
| OLD | NEW |