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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/ModalDialogTest.java

Issue 1786243003: Rename pollForCriteria to pollForTestThreadCriteria. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and update MediaRouterIntegrationTest.java Created 4 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 package org.chromium.chrome.browser; 5 package org.chromium.chrome.browser;
6 6
7 import android.content.DialogInterface; 7 import android.content.DialogInterface;
8 import android.support.v7.app.AlertDialog; 8 import android.support.v7.app.AlertDialog;
9 import android.test.suitebuilder.annotation.MediumTest; 9 import android.test.suitebuilder.annotation.MediumTest;
10 import android.util.Log; 10 import android.util.Log;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 273
274 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 274 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
275 @Override 275 @Override
276 public void run() { 276 public void run() {
277 ChromeActivity activity = getActivity(); 277 ChromeActivity activity = getActivity();
278 activity.getCurrentTabModel().closeTab(activity.getActivityTab() ); 278 activity.getCurrentTabModel().closeTab(activity.getActivityTab() );
279 } 279 }
280 }); 280 });
281 281
282 // Closing the tab should have dismissed the dialog. 282 // Closing the tab should have dismissed the dialog.
283 CriteriaHelper.pollForCriteria(new JavascriptAppModalDialogShownCriteria ( 283 CriteriaHelper.pollInstrumentationThread(new JavascriptAppModalDialogSho wnCriteria(
284 "The dialog should have been dismissed when its tab was closed." , false)); 284 "The dialog should have been dismissed when its tab was closed." , false));
285 } 285 }
286 286
287 /** 287 /**
288 * Asynchronously executes the given code for spawning a dialog and waits 288 * Asynchronously executes the given code for spawning a dialog and waits
289 * for the dialog to be visible. 289 * for the dialog to be visible.
290 */ 290 */
291 private OnEvaluateJavaScriptResultHelper executeJavaScriptAndWaitForDialog(S tring script) 291 private OnEvaluateJavaScriptResultHelper executeJavaScriptAndWaitForDialog(S tring script)
292 throws InterruptedException { 292 throws InterruptedException {
293 return executeJavaScriptAndWaitForDialog(new OnEvaluateJavaScriptResultH elper(), script); 293 return executeJavaScriptAndWaitForDialog(new OnEvaluateJavaScriptResultH elper(), script);
294 } 294 }
295 295
296 /** 296 /**
297 * Given a JavaScript evaluation helper, asynchronously executes the given 297 * Given a JavaScript evaluation helper, asynchronously executes the given
298 * code for spawning a dialog and waits for the dialog to be visible. 298 * code for spawning a dialog and waits for the dialog to be visible.
299 */ 299 */
300 private OnEvaluateJavaScriptResultHelper executeJavaScriptAndWaitForDialog( 300 private OnEvaluateJavaScriptResultHelper executeJavaScriptAndWaitForDialog(
301 final OnEvaluateJavaScriptResultHelper helper, String script) 301 final OnEvaluateJavaScriptResultHelper helper, String script)
302 throws InterruptedException { 302 throws InterruptedException {
303 helper.evaluateJavaScriptForTests( 303 helper.evaluateJavaScriptForTests(
304 getActivity().getCurrentContentViewCore().getWebContents(), 304 getActivity().getCurrentContentViewCore().getWebContents(),
305 script); 305 script);
306 CriteriaHelper.pollForCriteria(new JavascriptAppModalDialogShownCriteria ( 306 CriteriaHelper.pollInstrumentationThread(new JavascriptAppModalDialogSho wnCriteria(
307 "Could not spawn or locate a modal dialog.", true)); 307 "Could not spawn or locate a modal dialog.", true));
308 return helper; 308 return helper;
309 } 309 }
310 310
311 /** 311 /**
312 * Returns an array of the 3 buttons for this dialog, in the order 312 * Returns an array of the 3 buttons for this dialog, in the order
313 * BUTTON_NEGATIVE, BUTTON_NEUTRAL and BUTTON_POSITIVE. Any of these values 313 * BUTTON_NEGATIVE, BUTTON_NEUTRAL and BUTTON_POSITIVE. Any of these values
314 * can be null. 314 * can be null.
315 */ 315 */
316 private Button[] getAlertDialogButtons(final AlertDialog dialog) throws Exec utionException { 316 private Button[] getAlertDialogButtons(final AlertDialog dialog) throws Exec utionException {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 button.getVisibility()); 399 button.getVisibility());
400 assertEquals("'" + readableName + "' button has wrong text", 400 assertEquals("'" + readableName + "' button has wrong text",
401 getActivity().getResources().getString(expectedTextResourceId), 401 getActivity().getResources().getString(expectedTextResourceId),
402 button.getText().toString()); 402 button.getText().toString());
403 } 403 }
404 404
405 private TestCallbackHelperContainer getActiveTabTestCallbackHelperContainer( ) { 405 private TestCallbackHelperContainer getActiveTabTestCallbackHelperContainer( ) {
406 return new TestCallbackHelperContainer(getActivity().getCurrentContentVi ewCore()); 406 return new TestCallbackHelperContainer(getActivity().getCurrentContentVi ewCore());
407 } 407 }
408 } 408 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698