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

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: phajdan feedback 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
« no previous file with comments | « base/test/test_support_android.cc ('k') | chrome/browser/automation/automation_provider_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/autocomplete/autocomplete_provider.h" 15 #include "chrome/browser/autocomplete/autocomplete_provider.h"
15 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" 16 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h"
16 #include "chrome/browser/history/history.h" 17 #include "chrome/browser/history/history.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 quit_when_done_ = false; 172 quit_when_done_ = false;
172 message_loop_.Quit(); 173 message_loop_.Quit();
173 } 174 }
174 } 175 }
175 176
176 void SearchProviderTest::RunTillProviderDone() { 177 void SearchProviderTest::RunTillProviderDone() {
177 if (provider_->done()) 178 if (provider_->done())
178 return; 179 return;
179 180
180 quit_when_done_ = true; 181 quit_when_done_ = true;
181 #if defined(OS_MACOSX) 182 #if defined(OS_ANDROID)
182 message_loop_.Run();
183 #elif defined(OS_ANDROID)
184 // Android doesn't have Run(), only Start(). 183 // Android doesn't have Run(), only Start().
185 message_loop_.Start(); 184 message_loop_.Start();
186 #else 185 #else
187 message_loop_.RunWithDispatcher(NULL); 186 base::RunLoop run_loop;
187 run_loop.Run();
188 #endif 188 #endif
189 } 189 }
190 190
191 void SearchProviderTest::QueryForInput(const string16& text, 191 void SearchProviderTest::QueryForInput(const string16& text,
192 const string16& desired_tld, 192 const string16& desired_tld,
193 bool prevent_inline_autocomplete) { 193 bool prevent_inline_autocomplete) {
194 // Start a query. 194 // Start a query.
195 AutocompleteInput input(text, desired_tld, prevent_inline_autocomplete, 195 AutocompleteInput input(text, desired_tld, prevent_inline_autocomplete,
196 false, true, AutocompleteInput::ALL_MATCHES); 196 false, true, AutocompleteInput::ALL_MATCHES);
197 provider_->Start(input, false); 197 provider_->Start(input, false);
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, 1229 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL,
1230 match.contents_class[0].style); 1230 match.contents_class[0].style);
1231 EXPECT_EQ(4U, match.contents_class[1].offset); 1231 EXPECT_EQ(4U, match.contents_class[1].offset);
1232 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL | 1232 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL |
1233 AutocompleteMatch::ACMatchClassification::MATCH, 1233 AutocompleteMatch::ACMatchClassification::MATCH,
1234 match.contents_class[1].style); 1234 match.contents_class[1].style);
1235 EXPECT_EQ(5U, match.contents_class[2].offset); 1235 EXPECT_EQ(5U, match.contents_class[2].offset);
1236 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, 1236 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL,
1237 match.contents_class[2].style); 1237 match.contents_class[2].style);
1238 } 1238 }
OLDNEW
« no previous file with comments | « base/test/test_support_android.cc ('k') | chrome/browser/automation/automation_provider_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698