Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(451)

Side by Side Diff: chrome/browser/autocomplete/search_provider_unittest.cc

Issue 10479018: Add base::RunLoop and update ui_test_utils to use it to reduce flakiness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jar feedback, compile errors Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/search_provider.h" 5 #include "chrome/browser/autocomplete/search_provider.h"
6 6
7 #include "base/run_loop.h"
7 #include "base/string_util.h" 8 #include "base/string_util.h"
8 #include "base/time.h" 9 #include "base/time.h"
9 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
10 #include "build/build_config.h" 11 #include "build/build_config.h"
11 #include "chrome/browser/autocomplete/autocomplete.h" 12 #include "chrome/browser/autocomplete/autocomplete.h"
12 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 13 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
13 #include "chrome/browser/autocomplete/autocomplete_match.h" 14 #include "chrome/browser/autocomplete/autocomplete_match.h"
14 #include "chrome/browser/history/history.h" 15 #include "chrome/browser/history/history.h"
15 #include "chrome/browser/history/history_service_factory.h" 16 #include "chrome/browser/history/history_service_factory.h"
16 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 quit_when_done_ = false; 170 quit_when_done_ = false;
170 message_loop_.Quit(); 171 message_loop_.Quit();
171 } 172 }
172 } 173 }
173 174
174 void SearchProviderTest::RunTillProviderDone() { 175 void SearchProviderTest::RunTillProviderDone() {
175 if (provider_->done()) 176 if (provider_->done())
176 return; 177 return;
177 178
178 quit_when_done_ = true; 179 quit_when_done_ = true;
179 #if defined(OS_MACOSX) 180 #if defined(OS_ANDROID)
180 message_loop_.Run();
181 #elif defined(OS_ANDROID)
182 // Android doesn't have Run(), only Start(). 181 // Android doesn't have Run(), only Start().
183 message_loop_.Start(); 182 message_loop_.Start();
184 #else 183 #else
185 message_loop_.RunWithDispatcher(NULL); 184 base::RunLoop run_loop;
185 run_loop.Run();
186 #endif 186 #endif
187 } 187 }
188 188
189 void SearchProviderTest::QueryForInput(const string16& text, 189 void SearchProviderTest::QueryForInput(const string16& text,
190 const string16& desired_tld, 190 const string16& desired_tld,
191 bool prevent_inline_autocomplete) { 191 bool prevent_inline_autocomplete) {
192 // Start a query. 192 // Start a query.
193 AutocompleteInput input(text, desired_tld, prevent_inline_autocomplete, 193 AutocompleteInput input(text, desired_tld, prevent_inline_autocomplete,
194 false, true, AutocompleteInput::ALL_MATCHES); 194 false, true, AutocompleteInput::ALL_MATCHES);
195 provider_->Start(input, false); 195 provider_->Start(input, false);
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, 1227 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL,
1228 match.contents_class[0].style); 1228 match.contents_class[0].style);
1229 EXPECT_EQ(4U, match.contents_class[1].offset); 1229 EXPECT_EQ(4U, match.contents_class[1].offset);
1230 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL | 1230 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL |
1231 AutocompleteMatch::ACMatchClassification::MATCH, 1231 AutocompleteMatch::ACMatchClassification::MATCH,
1232 match.contents_class[1].style); 1232 match.contents_class[1].style);
1233 EXPECT_EQ(5U, match.contents_class[2].offset); 1233 EXPECT_EQ(5U, match.contents_class[2].offset);
1234 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, 1234 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL,
1235 match.contents_class[2].style); 1235 match.contents_class[2].style);
1236 } 1236 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698