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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialogHelperTest.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.webapps; 5 package org.chromium.chrome.browser.webapps;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.Intent; 8 import android.content.Intent;
9 import android.graphics.Bitmap; 9 import android.graphics.Bitmap;
10 import android.os.Environment; 10 import android.os.Environment;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartFileSer ver( 196 EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartFileSer ver(
197 getInstrumentation().getContext(), Environment.getExternalStorag eDirectory()); 197 getInstrumentation().getContext(), Environment.getExternalStorag eDirectory());
198 try { 198 try {
199 // Sets the overriden factory to observer splash screen update. 199 // Sets the overriden factory to observer splash screen update.
200 final TestDataStorageFactory dataStorageFactory = new TestDataStorag eFactory(); 200 final TestDataStorageFactory dataStorageFactory = new TestDataStorag eFactory();
201 WebappDataStorage.setFactoryForTests(dataStorageFactory); 201 WebappDataStorage.setFactoryForTests(dataStorageFactory);
202 202
203 addShortcutToURL(testServer.getURL(MANIFEST_PATH), MANIFEST_TITLE, " "); 203 addShortcutToURL(testServer.getURL(MANIFEST_PATH), MANIFEST_TITLE, " ");
204 204
205 // Make sure that the splash screen image was downloaded. 205 // Make sure that the splash screen image was downloaded.
206 CriteriaHelper.pollForUIThreadCriteria(new Criteria() { 206 CriteriaHelper.pollUiThread(new Criteria() {
207 @Override 207 @Override
208 public boolean isSatisfied() { 208 public boolean isSatisfied() {
209 return dataStorageFactory.mSplashImage != null; 209 return dataStorageFactory.mSplashImage != null;
210 } 210 }
211 }); 211 });
212 212
213 // Test that bitmap sizes match expectations. 213 // Test that bitmap sizes match expectations.
214 int idealSize = mActivity.getResources().getDimensionPixelSize( 214 int idealSize = mActivity.getResources().getDimensionPixelSize(
215 R.dimen.webapp_splash_image_size_ideal); 215 R.dimen.webapp_splash_image_size_ideal);
216 assertEquals(idealSize, dataStorageFactory.mSplashImage.getWidth()); 216 assertEquals(idealSize, dataStorageFactory.mSplashImage.getWidth());
(...skipping 25 matching lines...) Expand all
242 helper.addShortcut(title); 242 helper.addShortcut(title);
243 } 243 }
244 }); 244 });
245 return helper; 245 return helper;
246 } 246 }
247 }; 247 };
248 final AddToHomescreenDialogHelper helper = 248 final AddToHomescreenDialogHelper helper =
249 ThreadUtils.runOnUiThreadBlockingNoException(callable); 249 ThreadUtils.runOnUiThreadBlockingNoException(callable);
250 250
251 // Make sure that the shortcut was added. 251 // Make sure that the shortcut was added.
252 CriteriaHelper.pollForUIThreadCriteria(new Criteria() { 252 CriteriaHelper.pollUiThread(new Criteria() {
253 @Override 253 @Override
254 public boolean isSatisfied() { 254 public boolean isSatisfied() {
255 return mShortcutHelperDelegate.mBroadcastedIntent != null; 255 return mShortcutHelperDelegate.mBroadcastedIntent != null;
256 } 256 }
257 }); 257 });
258 258
259 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 259 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
260 @Override 260 @Override
261 public void run() { 261 public void run() {
262 helper.destroy(); 262 helper.destroy();
263 } 263 }
264 }); 264 });
265 } 265 }
266 } 266 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698