Robolectric.java revision b8898598e493d4df40038a501ff77f2aa437e9ef
1345fb6b77303f0d3c98cf748fefa0136183bdc79Christian Williamspackage com.xtremelabs.robolectric; 20b378afcde0200166e546c46a7642015accfce49Christian Williams & Ian Fisher 3ca8b4e7c96507b66cb816a3383c93b02d79a7685Tyler Schultzimport android.app.*; 41fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williamsimport android.appwidget.AppWidgetManager; 5b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williamsimport android.bluetooth.BluetoothAdapter; 6b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williamsimport android.bluetooth.BluetoothDevice; 79893f7266e7dcc1332743887045bd69991441421Christian Williamsimport android.content.ContentValues; 81fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williamsimport android.content.Context; 91fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williamsimport android.content.ContextWrapper; 101fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williamsimport android.content.Intent; 1170a3ec81f0bda52d8388facf562a80e2d16ac96fGonçalo Silvaimport android.content.res.AssetManager; 12cf37f66c9bcbf0b25b879fbb78c9442c9101c7acRich Humphreyimport android.content.res.Configuration; 131fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williamsimport android.content.res.Resources; 14b574da97569d2d098d0aaebbb947bffa8514a4f7Michael Portuesiimport android.database.sqlite.SQLiteCursor; 159893f7266e7dcc1332743887045bd69991441421Christian Williamsimport android.database.sqlite.SQLiteDatabase; 1628dd1fc86f58b35b79e2fedc13f5b26f600a9a6aMichael Portuesiimport android.database.sqlite.SQLiteOpenHelper; 173a99d4817b65b7eb0a9f44486072dbf43fdb2144Michael Portuesiimport android.database.sqlite.SQLiteQueryBuilder; 18ca8b4e7c96507b66cb816a3383c93b02d79a7685Tyler Schultzimport android.graphics.*; 191fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williamsimport android.graphics.drawable.BitmapDrawable; 20a075f94a84c6dd3493700d0c752fc545642e44d5Mike Grafton & Tyler Schultzimport android.graphics.drawable.ColorDrawable; 211fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williamsimport android.graphics.drawable.Drawable; 2231af8607e2c7da6ba8708f57c4b67b6b4aaad921Michael Portuesiimport android.hardware.Camera; 2306abdc35948a13a609c6e6c972d6fa19603b7fe9Joe Moore & Ryan Richardimport android.location.Geocoder; 241fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williamsimport android.location.LocationManager; 2536a56b1b82e6409c81ccc87ab7148cef105b4517Michael Portuesiimport android.media.AudioManager; 265480630a30500f34f6e03ed218d80f5ad843ed87Rich Humphreyimport android.media.MediaPlayer; 2731af8607e2c7da6ba8708f57c4b67b6b4aaad921Michael Portuesiimport android.media.MediaRecorder; 287581f8ab1d3fb2950ae13fc09a9b1862d1ec3af1Macarseimport android.net.ConnectivityManager; 297581f8ab1d3fb2950ae13fc09a9b1862d1ec3af1Macarseimport android.net.NetworkInfo; 30523401082f8da71727f102003baf023e6c356386adriancowhamimport android.net.wifi.WifiManager; 31c97f858ddc2222e96a6492c5fba30775cfeac4e4Zoodlesimport android.os.CountDownTimer; 321fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williamsimport android.os.Handler; 331fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williamsimport android.os.Looper; 3494c593173ef0ac64cca724199d6228057e1c8fd8Rich Humphreyimport android.preference.DialogPreference; 35079a071612e45353e46bde2f29eff7e6fc762f01Rich Humphreyimport android.preference.Preference; 36c59af8991708feeca9cdfb028101113a79ef73f4Glenn Jahnke & Lenny Turetskyimport android.telephony.TelephonyManager; 37ca8b4e7c96507b66cb816a3383c93b02d79a7685Tyler Schultzimport android.view.*; 3886b7c8791d1e5bff8403ec7fe6b8bdf7b5e05bf9Zoodlesimport android.view.animation.AnimationUtils; 390189062c055157592d5aa6ef59b26fae6f91dea4Rich Humphreyimport android.webkit.WebSettings; 406cf9d6f657e61d727afc221dd157ae6ca41714baTyler Schultzimport android.webkit.WebView; 41ca8b4e7c96507b66cb816a3383c93b02d79a7685Tyler Schultzimport android.widget.*; 42b5d56e95f27d484ad3098ac18867262e7c8826c1Christian Williams & Phil Goodwinimport com.xtremelabs.robolectric.bytecode.RobolectricInternals; 43b5d56e95f27d484ad3098ac18867262e7c8826c1Christian Williams & Phil Goodwinimport com.xtremelabs.robolectric.bytecode.ShadowWrangler; 4407a3254138fdfe62b70c194b458879c51bea72b4Phil Goodwinimport com.xtremelabs.robolectric.shadows.*; 452cdde11355e7c249e83a8b7aaabae5977bbc3e49Phil Goodwinimport com.xtremelabs.robolectric.tester.org.apache.http.FakeHttpLayer; 462cdde11355e7c249e83a8b7aaabae5977bbc3e49Phil Goodwinimport com.xtremelabs.robolectric.tester.org.apache.http.HttpRequestInfo; 472cdde11355e7c249e83a8b7aaabae5977bbc3e49Phil Goodwinimport com.xtremelabs.robolectric.tester.org.apache.http.RequestMatcher; 4871d7c3bcf0400e4b81109dd785187e1a93da3cabChristian Williamsimport com.xtremelabs.robolectric.util.Scheduler; 496f34840c49a26f54f62ead83509e3f64bed7e0cfNeal Sancheimport org.apache.http.Header; 50cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultzimport org.apache.http.HttpRequest; 51cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultzimport org.apache.http.HttpResponse; 52b2fea8dc6ecf427c1e620148946b6fd83a0bd210Phil Goodwin & Tyler Schultzimport org.apache.http.impl.client.DefaultRequestDirector; 530b378afcde0200166e546c46a7642015accfce49Christian Williams & Ian Fisher 540b378afcde0200166e546c46a7642015accfce49Christian Williams & Ian Fisherimport java.util.Arrays; 550b378afcde0200166e546c46a7642015accfce49Christian Williams & Ian Fisherimport java.util.List; 560b378afcde0200166e546c46a7642015accfce49Christian Williams & Ian Fisher 57bd9537bd36434865d4d25ef332bd388d39a51e34Christian Williams & Phil Goodwin@SuppressWarnings({"UnusedDeclaration"}) 58345fb6b77303f0d3c98cf748fefa0136183bdc79Christian Williamspublic class Robolectric { 598baea4cbf332f0e0acf559dfab4aa59dd7c71003Christian Williams & Ryan Richard public static Application application; 608baea4cbf332f0e0acf559dfab4aa59dd7c71003Christian Williams & Ryan Richard 610b378afcde0200166e546c46a7642015accfce49Christian Williams & Ian Fisher public static <T> T newInstanceOf(Class<T> clazz) { 62111e2299b5157f072d9e62406bd3c6fea9036cd4Christian Williams & Phil Goodwin return RobolectricInternals.newInstanceOf(clazz); 630b378afcde0200166e546c46a7642015accfce49Christian Williams & Ian Fisher } 640b378afcde0200166e546c46a7642015accfce49Christian Williams & Ian Fisher 651741463ed4618ec2b72cbd7764649fd0cca10a40Phil Goodwin public static Object newInstanceOf(String className) { 661741463ed4618ec2b72cbd7764649fd0cca10a40Phil Goodwin try { 671741463ed4618ec2b72cbd7764649fd0cca10a40Phil Goodwin Class<?> clazz = Class.forName(className); 681741463ed4618ec2b72cbd7764649fd0cca10a40Phil Goodwin if (clazz != null) { 691741463ed4618ec2b72cbd7764649fd0cca10a40Phil Goodwin return newInstanceOf(clazz); 701741463ed4618ec2b72cbd7764649fd0cca10a40Phil Goodwin } 711741463ed4618ec2b72cbd7764649fd0cca10a40Phil Goodwin } catch (ClassNotFoundException e) { 721741463ed4618ec2b72cbd7764649fd0cca10a40Phil Goodwin } 731741463ed4618ec2b72cbd7764649fd0cca10a40Phil Goodwin return null; 741741463ed4618ec2b72cbd7764649fd0cca10a40Phil Goodwin } 751741463ed4618ec2b72cbd7764649fd0cca10a40Phil Goodwin 76e7a41c9b39233781c97dd599ff61024f0510e308Christian Williams public static void bindShadowClass(Class<?> shadowClass) { 77111e2299b5157f072d9e62406bd3c6fea9036cd4Christian Williams & Phil Goodwin RobolectricInternals.bindShadowClass(shadowClass); 78e7a41c9b39233781c97dd599ff61024f0510e308Christian Williams } 79e7a41c9b39233781c97dd599ff61024f0510e308Christian Williams 80e7a41c9b39233781c97dd599ff61024f0510e308Christian Williams public static void bindDefaultShadowClasses() { 81638a930898ff7ff4d62b8a3028439142af65e4b4Christian Williams bindShadowClasses(getDefaultShadowClasses()); 82638a930898ff7ff4d62b8a3028439142af65e4b4Christian Williams } 83638a930898ff7ff4d62b8a3028439142af65e4b4Christian Williams 84638a930898ff7ff4d62b8a3028439142af65e4b4Christian Williams public static void bindShadowClasses(List<Class<?>> shadowClasses) { 85638a930898ff7ff4d62b8a3028439142af65e4b4Christian Williams for (Class<?> shadowClass : shadowClasses) { 86638a930898ff7ff4d62b8a3028439142af65e4b4Christian Williams bindShadowClass(shadowClass); 87e7a41c9b39233781c97dd599ff61024f0510e308Christian Williams } 88e7a41c9b39233781c97dd599ff61024f0510e308Christian Williams } 89e7a41c9b39233781c97dd599ff61024f0510e308Christian Williams 90cedd6ea60db4bf5744077021f20092005bb3d461Tyler Schultz /** 91cedd6ea60db4bf5744077021f20092005bb3d461Tyler Schultz * Invoke this utility method in tests to reveal which Android api classes and methods are being invoked 92cedd6ea60db4bf5744077021f20092005bb3d461Tyler Schultz * for which there are no shadows or shadow methods. This helps expose which methods are being invoked 93cedd6ea60db4bf5744077021f20092005bb3d461Tyler Schultz * either by a third party library or application code which need new shadow methods to be written. Generates 94cedd6ea60db4bf5744077021f20092005bb3d461Tyler Schultz * output for the current test only. 95cedd6ea60db4bf5744077021f20092005bb3d461Tyler Schultz */ 96cedd6ea60db4bf5744077021f20092005bb3d461Tyler Schultz public static void logMissingInvokedShadowMethods() { 97cedd6ea60db4bf5744077021f20092005bb3d461Tyler Schultz ShadowWrangler.getInstance().logMissingInvokedShadowMethods(); 98cedd6ea60db4bf5744077021f20092005bb3d461Tyler Schultz } 99cedd6ea60db4bf5744077021f20092005bb3d461Tyler Schultz 100e7a41c9b39233781c97dd599ff61024f0510e308Christian Williams public static List<Class<?>> getDefaultShadowClasses() { 1010b378afcde0200166e546c46a7642015accfce49Christian Williams & Ian Fisher return Arrays.asList( 102c146ad8871a32bbf62aca259ede77d3f9cd07773Tyler Schultz ShadowAbsoluteLayout.class, 1036bdff425fce6705103662f20370c9b371ccf23adRich Humphrey ShadowAbsSeekBar.class, 104c5e7ea096261d2e0220a763119aeb58fab47de2eMike Grafton & Tyler Schultz ShadowActivityGroup.class, 105afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowAbsSpinner.class, 1069893f7266e7dcc1332743887045bd69991441421Christian Williams ShadowAbstractCursor.class, 107afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowActivity.class, 108afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowAdapterView.class, 109afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowAddress.class, 110cf37f66c9bcbf0b25b879fbb78c9442c9101c7acRich Humphrey ShadowAlarmManager.class, 111afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowAlertDialog.class, 112afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowAlertDialog.ShadowBuilder.class, 11386b7c8791d1e5bff8403ec7fe6b8bdf7b5e05bf9Zoodles ShadowAnimationUtils.class, 114afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowApplication.class, 115afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowAppWidgetManager.class, 116e9c420439254fc0c893e44987db10e1418fff338mylacc ShadowArrayAdapter.class, 117114296321cba71f8133713306049ce3b411e8563Gonçalo Silva ShadowAssetManager.class, 11871d7c3bcf0400e4b81109dd785187e1a93da3cabChristian Williams ShadowAsyncTask.class, 11936a56b1b82e6409c81ccc87ab7148cef105b4517Michael Portuesi ShadowAudioManager.class, 120afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowBaseAdapter.class, 121ae26238c7d01caef84ceddd8ffb42c32306918d6Josh Lauer & Christian Williams ShadowBitmap.class, 122afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowBitmapDrawable.class, 123b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williams ShadowBitmapFactory.class, 124b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williams ShadowBluetoothAdapter.class, 125b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williams ShadowBluetoothDevice.class, 12675d564ab2b02cbe8a0d8cb33779530f72ea813abChristian Williams & Ryan Richard ShadowBundle.class, 12731af8607e2c7da6ba8708f57c4b67b6b4aaad921Michael Portuesi ShadowCamera.class, 12831af8607e2c7da6ba8708f57c4b67b6b4aaad921Michael Portuesi ShadowCameraParameters.class, 129cf37f66c9bcbf0b25b879fbb78c9442c9101c7acRich Humphrey ShadowCameraSize.class, 130afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowCanvas.class, 131a075f94a84c6dd3493700d0c752fc545642e44d5Mike Grafton & Tyler Schultz ShadowColorDrawable.class, 132e3bf0c0e84dd3464de0a508f9c03512d23c11bd8Josh Lauer & Christian Williams ShadowColorMatrix.class, 133e3bf0c0e84dd3464de0a508f9c03512d23c11bd8Josh Lauer & Christian Williams ShadowColorMatrixColorFilter.class, 134b613c76c40bffb15fbde84df32365bde3ffdb4c5Christian Williams ShadowColorStateList.class, 135afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowComponentName.class, 136cf37f66c9bcbf0b25b879fbb78c9442c9101c7acRich Humphrey ShadowCompoundButton.class, 137cf37f66c9bcbf0b25b879fbb78c9442c9101c7acRich Humphrey ShadowConfiguration.class, 1387581f8ab1d3fb2950ae13fc09a9b1862d1ec3af1Macarse ShadowConnectivityManager.class, 13920b94927aff24d7bd975d6ee717f1b65da9ee7c1Josh Lauer & Christian Williams ShadowContentResolver.class, 1409893f7266e7dcc1332743887045bd69991441421Christian Williams ShadowContentValues.class, 141afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowContext.class, 142afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowContextWrapper.class, 1431dcccba609fb2036994803ca6d71f9c76e1fe8e9Chee Wong ShadowContextThemeWrapper.class, 144b613c76c40bffb15fbde84df32365bde3ffdb4c5Christian Williams ShadowCookieManager.class, 145c97f858ddc2222e96a6492c5fba30775cfeac4e4Zoodles ShadowCountDownTimer.class, 1460dabe713bf2d78df246d9cff18ed11363491a2acAdam Cohen-Rose ShadowCursorAdapter.class, 147cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz ShadowDefaultRequestDirector.class, 148d1eee6c4ec28a6c17455ce5c29efb833f30dd5d0Michael Portuesi ShadowDisplay.class, 149afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowDrawable.class, 150afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowDialog.class, 15194c593173ef0ac64cca724199d6228057e1c8fd8Rich Humphrey ShadowDialogPreference.class, 152afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowEditText.class, 1539044c45523b0b9da7cfc8e0cc8c5ecf5d3085ee0Cristian ShadowExpandableListView.class, 154d4e5d32b81cae2114f66739beaac6fe1ceeead0dJosh Lauer & Christian Williams ShadowFloatMath.class, 155b8898598e493d4df40038a501ff77f2aa437e9efMike Grafton & Tyler Schultz ShadowFrameLayout.class, 15606abdc35948a13a609c6e6c972d6fa19603b7fe9Joe Moore & Ryan Richard ShadowGeocoder.class, 157afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowGeoPoint.class, 1585be5c864634de9072b89911eab6d0c8d772c9ad3Rich Humphrey ShadowGridView.class, 159afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowHandler.class, 160afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowImageView.class, 161afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowIntent.class, 162270250ac4b8bdaa50c8a44998229eb260f5c075cGlenn Jahnke & Phil Goodwin ShadowIntent.class, 163afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowIntentFilter.class, 164afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowItemizedOverlay.class, 165afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowLayoutInflater.class, 166afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowLayoutParams.class, 167afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowListActivity.class, 168afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowListView.class, 169afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowLocation.class, 170afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowLocationManager.class, 171afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowLooper.class, 172afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowMapController.class, 173afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowMapActivity.class, 174afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowMapView.class, 1750d21afe8a769457a7c6691bd8418a73aafb46beaJosh Lauer & Christian Williams ShadowMatrix.class, 1765480630a30500f34f6e03ed218d80f5ad843ed87Rich Humphrey ShadowMediaPlayer.class, 17776209fe88929d880ac6e008d5a3e6e1e1dd4939aPhil Goodwin ShadowMediaRecorder.class, 178d3f9a56dffcdd129355351019aef9652cce0d6b2Josh Lauer & Christian Williams ShadowMediaStore.ShadowImages.ShadowMedia.class, 17976209fe88929d880ac6e008d5a3e6e1e1dd4939aPhil Goodwin ShadowMenuInflater.class, 180afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowMotionEvent.class, 18107a3254138fdfe62b70c194b458879c51bea72b4Phil Goodwin ShadowNotification.class, 18207a3254138fdfe62b70c194b458879c51bea72b4Phil Goodwin ShadowNotificationManager.class, 1837581f8ab1d3fb2950ae13fc09a9b1862d1ec3af1Macarse ShadowNetworkInfo.class, 184afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowOverlayItem.class, 185afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowPaint.class, 1862ed797adb849f96d26ffaae31d68a2a67f56f27bJan Berkel ShadowPair.class, 187afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowPath.class, 188afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowPendingIntent.class, 189afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowPoint.class, 190d4e5d32b81cae2114f66739beaac6fe1ceeead0dJosh Lauer & Christian Williams ShadowPointF.class, 191b613c76c40bffb15fbde84df32365bde3ffdb4c5Christian Williams ShadowPowerManager.class, 192079a071612e45353e46bde2f29eff7e6fc762f01Rich Humphrey ShadowPreference.class, 193e8637c922e4f8e681769d63689accb89e6108056Michael Portuesi ShadowPreferenceManager.class, 194079a071612e45353e46bde2f29eff7e6fc762f01Rich Humphrey ShadowProgressBar.class, 195c5e7ea096261d2e0220a763119aeb58fab47de2eMike Grafton & Tyler Schultz ShadowRatingBar.class, 196afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowRect.class, 197afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowRemoteViews.class, 1980dabe713bf2d78df246d9cff18ed11363491a2acAdam Cohen-Rose ShadowResourceCursorAdapter.class, 199afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowResources.class, 200b613c76c40bffb15fbde84df32365bde3ffdb4c5Christian Williams ShadowResources.ShadowTheme.class, 201b82ccb9a3ef511d607ca5c4238a50d78a6aeaebaRich Humphrey ShadowSeekBar.class, 202afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowService.class, 203afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowSettings.class, 204afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowSettings.ShadowSecure.class, 205afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowSettings.ShadowSystem.class, 2060dabe713bf2d78df246d9cff18ed11363491a2acAdam Cohen-Rose ShadowSimpleCursorAdapter.class, 207afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowSpannableStringBuilder.class, 2089893f7266e7dcc1332743887045bd69991441421Christian Williams ShadowSQLiteDatabase.class, 209b574da97569d2d098d0aaebbb947bffa8514a4f7Michael Portuesi ShadowSQLiteCursor.class, 21028dd1fc86f58b35b79e2fedc13f5b26f600a9a6aMichael Portuesi ShadowSQLiteOpenHelper.class, 2113a99d4817b65b7eb0a9f44486072dbf43fdb2144Michael Portuesi ShadowSQLiteQueryBuilder.class, 2127dc1a70de2b28bdf70d887accfb5805f3497bda8Josh Lauer & Christian Williams ShadowSurfaceView.class, 213b8898598e493d4df40038a501ff77f2aa437e9efMike Grafton & Tyler Schultz ShadowTabHost.class, 214b8898598e493d4df40038a501ff77f2aa437e9efMike Grafton & Tyler Schultz ShadowTabSpec.class, 215c59af8991708feeca9cdfb028101113a79ef73f4Glenn Jahnke & Lenny Turetsky ShadowTelephonyManager.class, 216afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowTextUtils.class, 217afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowTextView.class, 218afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowToast.class, 219b613c76c40bffb15fbde84df32365bde3ffdb4c5Christian Williams ShadowTypedArray.class, 220afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowTypedValue.class, 221237888bb1e926aea523388de5d511a35f38506efPhil Goodwin & Tyler Schultz ShadowURLSpan.class, 222afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowView.class, 223afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowViewGroup.class, 2240e1c92ca35030e2c173b141c41341636bbb7a258Christian Williams ShadowViewStub.class, 2250189062c055157592d5aa6ef59b26fae6f91dea4Rich Humphrey ShadowWebSettings.class, 2269ef88bf39bff29cb39dee4d84542c8f5a6178748Tyler Schultz ShadowWebView.class, 227afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowWifiManager.class, 228e2f97afa26ab916fbc36ca1bbf18ba507023ab50Christian Williams ShadowWindow.class, 229afe0a89d904a7fe2f5980b9deb26cc3240192459Christian Williams ShadowZoomButtonsController.class 230adfaceabbda4c8c51f24a0def8926075bd7306adChristian Williams ); 2310b378afcde0200166e546c46a7642015accfce49Christian Williams & Ian Fisher } 23290008046fcb6aac20be2df7a0aa07129f6f0d62bIan Fisher 233345fb6b77303f0d3c98cf748fefa0136183bdc79Christian Williams public static void resetStaticState() { 234e6dfaf271dbaf3ac1bb82d953669a56a02fc71d6Phil Goodwin & Tyler Schultz ShadowWrangler.getInstance().silence(); 235345fb6b77303f0d3c98cf748fefa0136183bdc79Christian Williams Robolectric.application = new Application(); 236d092cebc8c9179d3a138827fd65961b867e2c53fJosh Lauer & Christian Williams ShadowBitmapFactory.reset(); 23790008046fcb6aac20be2df7a0aa07129f6f0d62bIan Fisher } 2381fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 2399122a05312e767618ba0545a951df9cab86c8716Christian Williams public static <T> T directlyOn(T shadowedObject) { 2409122a05312e767618ba0545a951df9cab86c8716Christian Williams return RobolectricInternals.directlyOn(shadowedObject); 2419122a05312e767618ba0545a951df9cab86c8716Christian Williams } 2429122a05312e767618ba0545a951df9cab86c8716Christian Williams 243433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowDrawable shadowOf(Drawable instance) { 244433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowDrawable) shadowOf_(instance); 2451fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 2461fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 247433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowToast shadowOf(Toast instance) { 248433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowToast) shadowOf_(instance); 2491fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 2501fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 2517581f8ab1d3fb2950ae13fc09a9b1862d1ec3af1Macarse public static ShadowNetworkInfo shadowOf(NetworkInfo instance) { 2527581f8ab1d3fb2950ae13fc09a9b1862d1ec3af1Macarse return (ShadowNetworkInfo) shadowOf_(instance); 2537581f8ab1d3fb2950ae13fc09a9b1862d1ec3af1Macarse } 2547581f8ab1d3fb2950ae13fc09a9b1862d1ec3af1Macarse 2557581f8ab1d3fb2950ae13fc09a9b1862d1ec3af1Macarse public static ShadowConnectivityManager shadowOf(ConnectivityManager instance) { 2567581f8ab1d3fb2950ae13fc09a9b1862d1ec3af1Macarse return (ShadowConnectivityManager) shadowOf_(instance); 2577581f8ab1d3fb2950ae13fc09a9b1862d1ec3af1Macarse } 2587581f8ab1d3fb2950ae13fc09a9b1862d1ec3af1Macarse 259523401082f8da71727f102003baf023e6c356386adriancowham public static ShadowWifiManager shadowOf(WifiManager instance){ 260523401082f8da71727f102003baf023e6c356386adriancowham return (ShadowWifiManager) shadowOf_(instance); 261523401082f8da71727f102003baf023e6c356386adriancowham } 262523401082f8da71727f102003baf023e6c356386adriancowham 263433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowBitmapDrawable shadowOf(BitmapDrawable instance) { 264433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowBitmapDrawable) shadowOf_(instance); 2651fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 2661fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 267433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowZoomButtonsController shadowOf(ZoomButtonsController instance) { 268433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowZoomButtonsController) shadowOf_(instance); 2691fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 2701fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 271433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowListView shadowOf(ListView instance) { 272433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowListView) shadowOf_(instance); 2731fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 2741fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 275cb122d30b23483c2cec905e74c747e6bc448cfbaPhil Goodwin public static ShadowExpandableListView shadowOf(ExpandableListView instance) { 276cb122d30b23483c2cec905e74c747e6bc448cfbaPhil Goodwin return (ShadowExpandableListView) shadowOf_(instance); 2779044c45523b0b9da7cfc8e0cc8c5ecf5d3085ee0Cristian } 2789044c45523b0b9da7cfc8e0cc8c5ecf5d3085ee0Cristian 279433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowActivity shadowOf(Activity instance) { 280433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowActivity) shadowOf_(instance); 2811fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 2821fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 283433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowContextWrapper shadowOf(ContextWrapper instance) { 284433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowContextWrapper) shadowOf_(instance); 2851fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 2861fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 287f91a118112ae13d39251dd3c09f1d85d33283ba1Christian Williams & Phil Goodwin public static ShadowApplication shadowOf(Application instance) { 288f91a118112ae13d39251dd3c09f1d85d33283ba1Christian Williams & Phil Goodwin return (ShadowApplication) shadowOf_(instance); 289f91a118112ae13d39251dd3c09f1d85d33283ba1Christian Williams & Phil Goodwin } 29008f79939304d82b7cfbb80d20b88fbe26eeab7a9Joe Moore and Tyler Schultz 291f91a118112ae13d39251dd3c09f1d85d33283ba1Christian Williams & Phil Goodwin public static ShadowContext shadowOf(Context instance) { 292f91a118112ae13d39251dd3c09f1d85d33283ba1Christian Williams & Phil Goodwin return (ShadowContext) shadowOf_(instance); 2931fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 2941fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 295433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowPaint shadowOf(Paint instance) { 296433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowPaint) shadowOf_(instance); 2971fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 2981fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 299433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowPath shadowOf(Path instance) { 300433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowPath) shadowOf_(instance); 3011fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 3021fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 303079a071612e45353e46bde2f29eff7e6fc762f01Rich Humphrey public static ShadowPreference shadowOf(Preference instance) { 304079a071612e45353e46bde2f29eff7e6fc762f01Rich Humphrey return (ShadowPreference) shadowOf_(instance); 305079a071612e45353e46bde2f29eff7e6fc762f01Rich Humphrey } 306079a071612e45353e46bde2f29eff7e6fc762f01Rich Humphrey 307079a071612e45353e46bde2f29eff7e6fc762f01Rich Humphrey public static ShadowProgressBar shadowOf(ProgressBar instance) { 308079a071612e45353e46bde2f29eff7e6fc762f01Rich Humphrey return (ShadowProgressBar) shadowOf_(instance); 309079a071612e45353e46bde2f29eff7e6fc762f01Rich Humphrey } 310079a071612e45353e46bde2f29eff7e6fc762f01Rich Humphrey 311433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowListActivity shadowOf(ListActivity instance) { 312433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowListActivity) shadowOf_(instance); 3131fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 3141fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 315c5e7ea096261d2e0220a763119aeb58fab47de2eMike Grafton & Tyler Schultz public static ShadowActivityGroup shadowOf(ActivityGroup instance) { 316c5e7ea096261d2e0220a763119aeb58fab47de2eMike Grafton & Tyler Schultz return (ShadowActivityGroup) shadowOf_(instance); 317c5e7ea096261d2e0220a763119aeb58fab47de2eMike Grafton & Tyler Schultz } 318c5e7ea096261d2e0220a763119aeb58fab47de2eMike Grafton & Tyler Schultz 319433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowHandler shadowOf(Handler instance) { 320433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowHandler) shadowOf_(instance); 3211fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 3221fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 323e3bf0c0e84dd3464de0a508f9c03512d23c11bd8Josh Lauer & Christian Williams public static ShadowColorMatrix shadowOf(ColorMatrix instance) { 324e3bf0c0e84dd3464de0a508f9c03512d23c11bd8Josh Lauer & Christian Williams return (ShadowColorMatrix) shadowOf_(instance); 325e3bf0c0e84dd3464de0a508f9c03512d23c11bd8Josh Lauer & Christian Williams } 326e3bf0c0e84dd3464de0a508f9c03512d23c11bd8Josh Lauer & Christian Williams 327433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowIntent shadowOf(Intent instance) { 328433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowIntent) shadowOf_(instance); 3291fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 3301fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 331433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowView shadowOf(View instance) { 332433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowView) shadowOf_(instance); 3331fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 3341fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 335a075f94a84c6dd3493700d0c752fc545642e44d5Mike Grafton & Tyler Schultz public static ShadowColorDrawable shadowOf(ColorDrawable instance) { 336a075f94a84c6dd3493700d0c752fc545642e44d5Mike Grafton & Tyler Schultz return (ShadowColorDrawable) shadowOf_(instance); 337a075f94a84c6dd3493700d0c752fc545642e44d5Mike Grafton & Tyler Schultz } 338a075f94a84c6dd3493700d0c752fc545642e44d5Mike Grafton & Tyler Schultz 339433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowViewGroup shadowOf(ViewGroup instance) { 340433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowViewGroup) shadowOf_(instance); 3411fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 3421fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 3430189062c055157592d5aa6ef59b26fae6f91dea4Rich Humphrey public static ShadowWebSettings shadowOf(WebSettings instance) { 3440189062c055157592d5aa6ef59b26fae6f91dea4Rich Humphrey return (ShadowWebSettings) shadowOf_(instance); 3450189062c055157592d5aa6ef59b26fae6f91dea4Rich Humphrey } 3460189062c055157592d5aa6ef59b26fae6f91dea4Rich Humphrey 3476cf9d6f657e61d727afc221dd157ae6ca41714baTyler Schultz public static ShadowWebView shadowOf(WebView instance) { 3486cf9d6f657e61d727afc221dd157ae6ca41714baTyler Schultz return (ShadowWebView) shadowOf_(instance); 3496cf9d6f657e61d727afc221dd157ae6ca41714baTyler Schultz } 3506cf9d6f657e61d727afc221dd157ae6ca41714baTyler Schultz 351433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowAdapterView shadowOf(AdapterView instance) { 352433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowAdapterView) shadowOf_(instance); 3531fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 3541fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 355433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowTextView shadowOf(TextView instance) { 356433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowTextView) shadowOf_(instance); 3571fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 3581fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 359433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowImageView shadowOf(ImageView instance) { 360433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowImageView) shadowOf_(instance); 3611fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 3621fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 363433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowRemoteViews shadowOf(RemoteViews instance) { 364433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowRemoteViews) shadowOf_(instance); 3651fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 3661fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 367433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowDialog shadowOf(Dialog instance) { 368433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowDialog) shadowOf_(instance); 3691fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 37094c593173ef0ac64cca724199d6228057e1c8fd8Rich Humphrey 37194c593173ef0ac64cca724199d6228057e1c8fd8Rich Humphrey public static ShadowDialogPreference shadowOf(DialogPreference instance) { 37294c593173ef0ac64cca724199d6228057e1c8fd8Rich Humphrey return (ShadowDialogPreference) shadowOf_(instance); 37394c593173ef0ac64cca724199d6228057e1c8fd8Rich Humphrey } 3741fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 375b2fea8dc6ecf427c1e620148946b6fd83a0bd210Phil Goodwin & Tyler Schultz public static ShadowDefaultRequestDirector shadowOf(DefaultRequestDirector instance) { 376cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz return (ShadowDefaultRequestDirector) shadowOf_(instance); 377c95377d49257364984344908f301574ebe8d4d9cPhil Goodwin & Tyler Schultz } 378c95377d49257364984344908f301574ebe8d4d9cPhil Goodwin & Tyler Schultz 379433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowAlertDialog shadowOf(AlertDialog instance) { 380433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowAlertDialog) shadowOf_(instance); 3811fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 3821fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 383433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowLooper shadowOf(Looper instance) { 384433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowLooper) shadowOf_(instance); 3851fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 3861fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 387433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowCanvas shadowOf(Canvas instance) { 388433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowCanvas) shadowOf_(instance); 3891fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 3901fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 391433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowLocationManager shadowOf(LocationManager instance) { 392433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowLocationManager) shadowOf_(instance); 3931fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 3941fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 395433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowAppWidgetManager shadowOf(AppWidgetManager instance) { 396433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowAppWidgetManager) shadowOf_(instance); 3971fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 3981fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 399433b46be67768332f764eab6879e0649993d79e3Christian Williams public static ShadowResources shadowOf(Resources instance) { 400433b46be67768332f764eab6879e0649993d79e3Christian Williams return (ShadowResources) shadowOf_(instance); 4011fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 4021fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams 403e7a41c9b39233781c97dd599ff61024f0510e308Christian Williams public static ShadowLayoutInflater shadowOf(LayoutInflater instance) { 40406abdc35948a13a609c6e6c972d6fa19603b7fe9Joe Moore & Ryan Richard return (ShadowLayoutInflater) shadowOf_(instance); 405e7a41c9b39233781c97dd599ff61024f0510e308Christian Williams } 406adfaceabbda4c8c51f24a0def8926075bd7306adChristian Williams 407b539366073ccb47433de7191dbbf519ed4ab2d8fPhil Goodwin public static ShadowMenuInflater shadowOf(MenuInflater instance) { 408b539366073ccb47433de7191dbbf519ed4ab2d8fPhil Goodwin return (ShadowMenuInflater) shadowOf_(instance); 409b539366073ccb47433de7191dbbf519ed4ab2d8fPhil Goodwin } 410b539366073ccb47433de7191dbbf519ed4ab2d8fPhil Goodwin 411adfaceabbda4c8c51f24a0def8926075bd7306adChristian Williams public static ShadowDisplay shadowOf(Display instance) { 4124a9aa604410e3c8f91158a4caa5700f45a22eb47Christian Williams return (ShadowDisplay) shadowOf_(instance); 413adfaceabbda4c8c51f24a0def8926075bd7306adChristian Williams } 414adfaceabbda4c8c51f24a0def8926075bd7306adChristian Williams 415adfaceabbda4c8c51f24a0def8926075bd7306adChristian Williams public static ShadowAudioManager shadowOf(AudioManager instance) { 4164a9aa604410e3c8f91158a4caa5700f45a22eb47Christian Williams return (ShadowAudioManager) shadowOf_(instance); 4174a9aa604410e3c8f91158a4caa5700f45a22eb47Christian Williams } 418e7a41c9b39233781c97dd599ff61024f0510e308Christian Williams 41906abdc35948a13a609c6e6c972d6fa19603b7fe9Joe Moore & Ryan Richard public static ShadowGeocoder shadowOf(Geocoder instance) { 42006abdc35948a13a609c6e6c972d6fa19603b7fe9Joe Moore & Ryan Richard return (ShadowGeocoder) shadowOf_(instance); 421adfaceabbda4c8c51f24a0def8926075bd7306adChristian Williams } 422e7a41c9b39233781c97dd599ff61024f0510e308Christian Williams 4239893f7266e7dcc1332743887045bd69991441421Christian Williams public static ShadowSQLiteDatabase shadowOf(SQLiteDatabase other) { 4249893f7266e7dcc1332743887045bd69991441421Christian Williams return (ShadowSQLiteDatabase) Robolectric.shadowOf_(other); 4259893f7266e7dcc1332743887045bd69991441421Christian Williams } 426f96b9a1f17d47e48d1f5f8e29b4ed7ffccc739abPhil Goodwin & Tyler Schultz 427b574da97569d2d098d0aaebbb947bffa8514a4f7Michael Portuesi public static ShadowSQLiteCursor shadowOf(SQLiteCursor other) { 428b574da97569d2d098d0aaebbb947bffa8514a4f7Michael Portuesi return (ShadowSQLiteCursor) Robolectric.shadowOf_(other); 429b574da97569d2d098d0aaebbb947bffa8514a4f7Michael Portuesi } 4309893f7266e7dcc1332743887045bd69991441421Christian Williams 43128dd1fc86f58b35b79e2fedc13f5b26f600a9a6aMichael Portuesi public static ShadowSQLiteOpenHelper shadowOf(SQLiteOpenHelper other) { 43228dd1fc86f58b35b79e2fedc13f5b26f600a9a6aMichael Portuesi return (ShadowSQLiteOpenHelper) Robolectric.shadowOf_(other); 43328dd1fc86f58b35b79e2fedc13f5b26f600a9a6aMichael Portuesi } 434f96b9a1f17d47e48d1f5f8e29b4ed7ffccc739abPhil Goodwin & Tyler Schultz 4353a99d4817b65b7eb0a9f44486072dbf43fdb2144Michael Portuesi public static ShadowSQLiteQueryBuilder shadowOf(SQLiteQueryBuilder other) { 4363a99d4817b65b7eb0a9f44486072dbf43fdb2144Michael Portuesi return (ShadowSQLiteQueryBuilder) Robolectric.shadowOf_(other); 4373a99d4817b65b7eb0a9f44486072dbf43fdb2144Michael Portuesi } 438f96b9a1f17d47e48d1f5f8e29b4ed7ffccc739abPhil Goodwin & Tyler Schultz 4399893f7266e7dcc1332743887045bd69991441421Christian Williams public static ShadowContentValues shadowOf(ContentValues other) { 4409893f7266e7dcc1332743887045bd69991441421Christian Williams return (ShadowContentValues) Robolectric.shadowOf_(other); 4419893f7266e7dcc1332743887045bd69991441421Christian Williams } 4429893f7266e7dcc1332743887045bd69991441421Christian Williams 44331af8607e2c7da6ba8708f57c4b67b6b4aaad921Michael Portuesi public static ShadowCamera shadowOf(Camera instance) { 44431af8607e2c7da6ba8708f57c4b67b6b4aaad921Michael Portuesi return (ShadowCamera) shadowOf_(instance); 44531af8607e2c7da6ba8708f57c4b67b6b4aaad921Michael Portuesi } 446f96b9a1f17d47e48d1f5f8e29b4ed7ffccc739abPhil Goodwin & Tyler Schultz 44731af8607e2c7da6ba8708f57c4b67b6b4aaad921Michael Portuesi public static ShadowCameraParameters shadowOf(Camera.Parameters instance) { 44831af8607e2c7da6ba8708f57c4b67b6b4aaad921Michael Portuesi return (ShadowCameraParameters) shadowOf_(instance); 44931af8607e2c7da6ba8708f57c4b67b6b4aaad921Michael Portuesi } 4509893f7266e7dcc1332743887045bd69991441421Christian Williams 451cf37f66c9bcbf0b25b879fbb78c9442c9101c7acRich Humphrey public static ShadowCameraSize shadowOf(Camera.Size instance) { 452cf37f66c9bcbf0b25b879fbb78c9442c9101c7acRich Humphrey return (ShadowCameraSize) shadowOf_(instance); 453cf37f66c9bcbf0b25b879fbb78c9442c9101c7acRich Humphrey } 45440c6251719cccc0a84ae99c976d2836b14374ce6Christian Williams 4555480630a30500f34f6e03ed218d80f5ad843ed87Rich Humphrey public static ShadowMediaPlayer shadowOf(MediaPlayer instance) { 4565480630a30500f34f6e03ed218d80f5ad843ed87Rich Humphrey return (ShadowMediaPlayer) shadowOf_(instance); 4575480630a30500f34f6e03ed218d80f5ad843ed87Rich Humphrey } 4585480630a30500f34f6e03ed218d80f5ad843ed87Rich Humphrey 45931af8607e2c7da6ba8708f57c4b67b6b4aaad921Michael Portuesi public static ShadowMediaRecorder shadowOf(MediaRecorder instance) { 46031af8607e2c7da6ba8708f57c4b67b6b4aaad921Michael Portuesi return (ShadowMediaRecorder) shadowOf_(instance); 46131af8607e2c7da6ba8708f57c4b67b6b4aaad921Michael Portuesi } 462f96b9a1f17d47e48d1f5f8e29b4ed7ffccc739abPhil Goodwin & Tyler Schultz 46324f155944b10583afd970905e5dbe0acdfc9e0efPhil Goodwin & Tyler Schultz public static ShadowAssetManager shadowOf(AssetManager instance) { 46424f155944b10583afd970905e5dbe0acdfc9e0efPhil Goodwin & Tyler Schultz return (ShadowAssetManager) Robolectric.shadowOf_(instance); 46524f155944b10583afd970905e5dbe0acdfc9e0efPhil Goodwin & Tyler Schultz } 46624f155944b10583afd970905e5dbe0acdfc9e0efPhil Goodwin & Tyler Schultz 467cf37f66c9bcbf0b25b879fbb78c9442c9101c7acRich Humphrey public static ShadowAlarmManager shadowOf(AlarmManager instance) { 468cf37f66c9bcbf0b25b879fbb78c9442c9101c7acRich Humphrey return (ShadowAlarmManager) Robolectric.shadowOf_(instance); 469cf37f66c9bcbf0b25b879fbb78c9442c9101c7acRich Humphrey } 470cf37f66c9bcbf0b25b879fbb78c9442c9101c7acRich Humphrey 47140c6251719cccc0a84ae99c976d2836b14374ce6Christian Williams public static ShadowConfiguration shadowOf(Configuration instance) { 47240c6251719cccc0a84ae99c976d2836b14374ce6Christian Williams return (ShadowConfiguration) Robolectric.shadowOf_(instance); 473cf37f66c9bcbf0b25b879fbb78c9442c9101c7acRich Humphrey } 474cf37f66c9bcbf0b25b879fbb78c9442c9101c7acRich Humphrey 475c97f858ddc2222e96a6492c5fba30775cfeac4e4Zoodles public static ShadowCountDownTimer shadowOf(CountDownTimer instance) { 476c97f858ddc2222e96a6492c5fba30775cfeac4e4Zoodles return (ShadowCountDownTimer) Robolectric.shadowOf_(instance); 477c97f858ddc2222e96a6492c5fba30775cfeac4e4Zoodles } 478c97f858ddc2222e96a6492c5fba30775cfeac4e4Zoodles 479b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williams public static ShadowBitmap shadowOf(Bitmap other) { 480b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williams return (ShadowBitmap) Robolectric.shadowOf_(other); 481b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williams } 482b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williams 483b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williams public static ShadowBluetoothAdapter shadowOf(BluetoothAdapter other) { 484b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williams return (ShadowBluetoothAdapter) Robolectric.shadowOf_(other); 485b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williams } 486b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williams 487b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williams public static ShadowBluetoothDevice shadowOf(BluetoothDevice other) { 488b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williams return (ShadowBluetoothDevice) Robolectric.shadowOf_(other); 489b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williams } 490b01474a3329222965d31068f5c33e59c6e6aa6a4Josh Lauer & Christian Williams 4910d21afe8a769457a7c6691bd8418a73aafb46beaJosh Lauer & Christian Williams public static ShadowMatrix shadowOf(Matrix other) { 4920d21afe8a769457a7c6691bd8418a73aafb46beaJosh Lauer & Christian Williams return (ShadowMatrix) Robolectric.shadowOf_(other); 4930d21afe8a769457a7c6691bd8418a73aafb46beaJosh Lauer & Christian Williams } 4940d21afe8a769457a7c6691bd8418a73aafb46beaJosh Lauer & Christian Williams 495d4e5d32b81cae2114f66739beaac6fe1ceeead0dJosh Lauer & Christian Williams public static ShadowMotionEvent shadowOf(MotionEvent other) { 496d4e5d32b81cae2114f66739beaac6fe1ceeead0dJosh Lauer & Christian Williams return (ShadowMotionEvent) Robolectric.shadowOf_(other); 497d4e5d32b81cae2114f66739beaac6fe1ceeead0dJosh Lauer & Christian Williams } 498d4e5d32b81cae2114f66739beaac6fe1ceeead0dJosh Lauer & Christian Williams 49907a3254138fdfe62b70c194b458879c51bea72b4Phil Goodwin public static ShadowNotificationManager shadowOf(NotificationManager other) { 50007a3254138fdfe62b70c194b458879c51bea72b4Phil Goodwin return (ShadowNotificationManager) Robolectric.shadowOf_(other); 50107a3254138fdfe62b70c194b458879c51bea72b4Phil Goodwin } 50207a3254138fdfe62b70c194b458879c51bea72b4Phil Goodwin 50307a3254138fdfe62b70c194b458879c51bea72b4Phil Goodwin public static ShadowNotification shadowOf(Notification other) { 50407a3254138fdfe62b70c194b458879c51bea72b4Phil Goodwin return (ShadowNotification) Robolectric.shadowOf_(other); 50507a3254138fdfe62b70c194b458879c51bea72b4Phil Goodwin } 50607a3254138fdfe62b70c194b458879c51bea72b4Phil Goodwin 5076bdff425fce6705103662f20370c9b371ccf23adRich Humphrey public static ShadowAbsSeekBar shadowOf(AbsSeekBar instance) { 5086bdff425fce6705103662f20370c9b371ccf23adRich Humphrey return (ShadowAbsSeekBar) shadowOf_(instance); 5096bdff425fce6705103662f20370c9b371ccf23adRich Humphrey } 5106bdff425fce6705103662f20370c9b371ccf23adRich Humphrey 511f87e94db052e8cf78eed7b08de5baa2551f4a134sorack public static ShadowRatingBar shadowOf(RatingBar instance) { 512f87e94db052e8cf78eed7b08de5baa2551f4a134sorack return (ShadowRatingBar) shadowOf_(instance); 513f87e94db052e8cf78eed7b08de5baa2551f4a134sorack } 514f87e94db052e8cf78eed7b08de5baa2551f4a134sorack 515b82ccb9a3ef511d607ca5c4238a50d78a6aeaebaRich Humphrey public static ShadowSeekBar shadowOf(SeekBar instance) { 516b82ccb9a3ef511d607ca5c4238a50d78a6aeaebaRich Humphrey return (ShadowSeekBar) shadowOf_(instance); 517b82ccb9a3ef511d607ca5c4238a50d78a6aeaebaRich Humphrey } 518b82ccb9a3ef511d607ca5c4238a50d78a6aeaebaRich Humphrey 51986b7c8791d1e5bff8403ec7fe6b8bdf7b5e05bf9Zoodles public static ShadowAnimationUtils shadowOf(AnimationUtils instance) { 52086b7c8791d1e5bff8403ec7fe6b8bdf7b5e05bf9Zoodles return (ShadowAnimationUtils) shadowOf_(instance); 52186b7c8791d1e5bff8403ec7fe6b8bdf7b5e05bf9Zoodles } 52286b7c8791d1e5bff8403ec7fe6b8bdf7b5e05bf9Zoodles 52386b7c8791d1e5bff8403ec7fe6b8bdf7b5e05bf9Zoodles public static ShadowGridView shadowOf(GridView instance) { 52486b7c8791d1e5bff8403ec7fe6b8bdf7b5e05bf9Zoodles return (ShadowGridView) shadowOf_(instance); 52586b7c8791d1e5bff8403ec7fe6b8bdf7b5e05bf9Zoodles } 5264aaebe6f156648e1074f10aadc89f485175c3043Felix H. Dahlke 527b8898598e493d4df40038a501ff77f2aa437e9efMike Grafton & Tyler Schultz public static ShadowTabHost shadowOf(TabHost instance) { 528b8898598e493d4df40038a501ff77f2aa437e9efMike Grafton & Tyler Schultz return (ShadowTabHost) shadowOf_(instance); 529b8898598e493d4df40038a501ff77f2aa437e9efMike Grafton & Tyler Schultz } 530b8898598e493d4df40038a501ff77f2aa437e9efMike Grafton & Tyler Schultz 531b8898598e493d4df40038a501ff77f2aa437e9efMike Grafton & Tyler Schultz public static ShadowTabSpec shadowOf(TabHost.TabSpec instance) { 532b8898598e493d4df40038a501ff77f2aa437e9efMike Grafton & Tyler Schultz return (ShadowTabSpec) shadowOf_(instance); 533b8898598e493d4df40038a501ff77f2aa437e9efMike Grafton & Tyler Schultz } 534b8898598e493d4df40038a501ff77f2aa437e9efMike Grafton & Tyler Schultz 535b8898598e493d4df40038a501ff77f2aa437e9efMike Grafton & Tyler Schultz public static ShadowFrameLayout shadowOf(FrameLayout instance) { 536b8898598e493d4df40038a501ff77f2aa437e9efMike Grafton & Tyler Schultz return (ShadowFrameLayout) shadowOf_(instance); 537b8898598e493d4df40038a501ff77f2aa437e9efMike Grafton & Tyler Schultz } 538b8898598e493d4df40038a501ff77f2aa437e9efMike Grafton & Tyler Schultz 5394aaebe6f156648e1074f10aadc89f485175c3043Felix H. Dahlke public static ShadowRect shadowOf(Rect instance) { 5404aaebe6f156648e1074f10aadc89f485175c3043Felix H. Dahlke return (ShadowRect) shadowOf_(instance); 5414aaebe6f156648e1074f10aadc89f485175c3043Felix H. Dahlke } 54286b7c8791d1e5bff8403ec7fe6b8bdf7b5e05bf9Zoodles 5430dabe713bf2d78df246d9cff18ed11363491a2acAdam Cohen-Rose public static ShadowCursorAdapter shadowOf(CursorAdapter instance) { 5440dabe713bf2d78df246d9cff18ed11363491a2acAdam Cohen-Rose return (ShadowCursorAdapter) shadowOf_(instance); 5450dabe713bf2d78df246d9cff18ed11363491a2acAdam Cohen-Rose } 5460dabe713bf2d78df246d9cff18ed11363491a2acAdam Cohen-Rose 5470dabe713bf2d78df246d9cff18ed11363491a2acAdam Cohen-Rose public static ShadowResourceCursorAdapter shadowOf(ResourceCursorAdapter instance) { 5480dabe713bf2d78df246d9cff18ed11363491a2acAdam Cohen-Rose return (ShadowResourceCursorAdapter) shadowOf_(instance); 5490dabe713bf2d78df246d9cff18ed11363491a2acAdam Cohen-Rose } 5500dabe713bf2d78df246d9cff18ed11363491a2acAdam Cohen-Rose 5510dabe713bf2d78df246d9cff18ed11363491a2acAdam Cohen-Rose public static ShadowSimpleCursorAdapter shadowOf(SimpleCursorAdapter instance) { 5520dabe713bf2d78df246d9cff18ed11363491a2acAdam Cohen-Rose return (ShadowSimpleCursorAdapter) shadowOf_(instance); 5530dabe713bf2d78df246d9cff18ed11363491a2acAdam Cohen-Rose } 5540dabe713bf2d78df246d9cff18ed11363491a2acAdam Cohen-Rose 555c59af8991708feeca9cdfb028101113a79ef73f4Glenn Jahnke & Lenny Turetsky public static ShadowTelephonyManager shadowOf(TelephonyManager instance) { 556c59af8991708feeca9cdfb028101113a79ef73f4Glenn Jahnke & Lenny Turetsky return (ShadowTelephonyManager) shadowOf_(instance); 557c59af8991708feeca9cdfb028101113a79ef73f4Glenn Jahnke & Lenny Turetsky } 558c59af8991708feeca9cdfb028101113a79ef73f4Glenn Jahnke & Lenny Turetsky 5591fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams @SuppressWarnings({"unchecked"}) 560433b46be67768332f764eab6879e0649993d79e3Christian Williams public static <P, R> P shadowOf_(R instance) { 561cee7ff89bfcb83d6cd65e6de9b7cafe2c1caf40aChristian Williams return (P) ShadowWrangler.getInstance().shadowOf(instance); 5621fbcf7680e415c7b15a08376835385a9226e8d2bChristian Williams } 56371d7c3bcf0400e4b81109dd785187e1a93da3cabChristian Williams 5640fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin /** 5650fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin * Runs any background tasks previously queued by {@link android.os.AsyncTask#execute(Object[])}. 566b539366073ccb47433de7191dbbf519ed4ab2d8fPhil Goodwin * <p/> 5670fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin * <p/> 5680fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin * Note: calling this method does not pause or un-pause the scheduler. 5690fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin */ 57071d7c3bcf0400e4b81109dd785187e1a93da3cabChristian Williams public static void runBackgroundTasks() { 5710fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin getBackgroundScheduler().advanceBy(0); 57271d7c3bcf0400e4b81109dd785187e1a93da3cabChristian Williams } 57371d7c3bcf0400e4b81109dd785187e1a93da3cabChristian Williams 5740fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin /** 5750fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin * Runs any immediately runnable tasks previously queued on the UI thread, 5760fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin * e.g. by {@link Activity#runOnUiThread(Runnable)} or {@link android.os.AsyncTask#onPostExecute(Object)}. 577b539366073ccb47433de7191dbbf519ed4ab2d8fPhil Goodwin * <p/> 5780fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin * <p/> 5790fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin * Note: calling this method does not pause or un-pause the scheduler. 5800fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin */ 58171d7c3bcf0400e4b81109dd785187e1a93da3cabChristian Williams public static void runUiThreadTasks() { 582a4f7d50f8e6f12d541421383544fe16c185e4bbcPhil Goodwin & Tyler Schultz getUiThreadScheduler().advanceBy(0); 58371d7c3bcf0400e4b81109dd785187e1a93da3cabChristian Williams } 584cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz 585cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz /** 586bd9537bd36434865d4d25ef332bd388d39a51e34Christian Williams & Phil Goodwin * Sets up an HTTP response to be returned by calls to Apache's {@code HttpClient} implementers. 587cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz * 588b539366073ccb47433de7191dbbf519ed4ab2d8fPhil Goodwin * @param statusCode the status code of the response 589cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz * @param responseBody the body of the response 590cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz */ 591b2fea8dc6ecf427c1e620148946b6fd83a0bd210Phil Goodwin & Tyler Schultz public static void addPendingHttpResponse(int statusCode, String responseBody) { 592f91a118112ae13d39251dd3c09f1d85d33283ba1Christian Williams & Phil Goodwin getFakeHttpLayer().addPendingHttpResponse(statusCode, responseBody); 593cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz } 594cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz 595cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz /** 596bd9537bd36434865d4d25ef332bd388d39a51e34Christian Williams & Phil Goodwin * Sets up an HTTP response to be returned by calls to Apache's {@code HttpClient} implementers. 597cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz * 5986f34840c49a26f54f62ead83509e3f64bed7e0cfNeal Sanche * @param statusCode the status code of the response 5996f34840c49a26f54f62ead83509e3f64bed7e0cfNeal Sanche * @param responseBody the body of the response 6006f34840c49a26f54f62ead83509e3f64bed7e0cfNeal Sanche * @param contentType the contentType of the response 6016f34840c49a26f54f62ead83509e3f64bed7e0cfNeal Sanche */ 60239a416145e85c7008805ef493b2d61f66d669158Tyler Schultz public static void addPendingHttpResponseWithContentType(int statusCode, String responseBody, Header contentType) { 60339a416145e85c7008805ef493b2d61f66d669158Tyler Schultz getFakeHttpLayer().addPendingHttpResponseWithContentType(statusCode, responseBody, contentType); 6046f34840c49a26f54f62ead83509e3f64bed7e0cfNeal Sanche } 6056f34840c49a26f54f62ead83509e3f64bed7e0cfNeal Sanche 6066f34840c49a26f54f62ead83509e3f64bed7e0cfNeal Sanche /** 6076f34840c49a26f54f62ead83509e3f64bed7e0cfNeal Sanche * Sets up an HTTP response to be returned by calls to Apache's {@code HttpClient} implementers. 6086f34840c49a26f54f62ead83509e3f64bed7e0cfNeal Sanche * 609cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz * @param httpResponse the response 610cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz */ 611b2fea8dc6ecf427c1e620148946b6fd83a0bd210Phil Goodwin & Tyler Schultz public static void addPendingHttpResponse(HttpResponse httpResponse) { 612f91a118112ae13d39251dd3c09f1d85d33283ba1Christian Williams & Phil Goodwin getFakeHttpLayer().addPendingHttpResponse(httpResponse); 613cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz } 614cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz 615cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz /** 6167cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * Accessor to obtain HTTP requests made during the current test in the order in which they were made. 617cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz * 618cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz * @param index index of the request to retrieve. 619cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz * @return the requested request. 620cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz */ 621b2fea8dc6ecf427c1e620148946b6fd83a0bd210Phil Goodwin & Tyler Schultz public static HttpRequest getSentHttpRequest(int index) { 622b2fea8dc6ecf427c1e620148946b6fd83a0bd210Phil Goodwin & Tyler Schultz return ShadowDefaultRequestDirector.getSentHttpRequest(index); 623cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz } 624cf8438f6160ad20fcd8afc57485b35166bec4a2bPhil Goodwin & Tyler Schultz 6257cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin /** 6262399fd1c2f5ff65d329717361082957d309f7314Alexander Murmann & Jesse Toth * Accessor to find out if HTTP requests were made during the current test. 6272399fd1c2f5ff65d329717361082957d309f7314Alexander Murmann & Jesse Toth * 6282399fd1c2f5ff65d329717361082957d309f7314Alexander Murmann & Jesse Toth * @return whether a request was made. 6292399fd1c2f5ff65d329717361082957d309f7314Alexander Murmann & Jesse Toth */ 6302399fd1c2f5ff65d329717361082957d309f7314Alexander Murmann & Jesse Toth public static boolean httpRequestWasMade() { 6312399fd1c2f5ff65d329717361082957d309f7314Alexander Murmann & Jesse Toth return getShadowApplication().getFakeHttpLayer().hasRequestInfos(); 6322399fd1c2f5ff65d329717361082957d309f7314Alexander Murmann & Jesse Toth } 6332399fd1c2f5ff65d329717361082957d309f7314Alexander Murmann & Jesse Toth 6342399fd1c2f5ff65d329717361082957d309f7314Alexander Murmann & Jesse Toth /** 6357cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * Accessor to obtain metadata for an HTTP request made during the current test in the order in which they were made. 6367cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * 6377cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * @param index index of the request to retrieve. 6387cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * @return the requested request metadata. 6397cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin */ 6407cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin public static HttpRequestInfo getSentHttpRequestInfo(int index) { 6417cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin return ShadowDefaultRequestDirector.getSentHttpRequestInfo(index); 6427cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin } 6437cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin 6447cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin /** 6457cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * Adds an HTTP response rule. The response will be returned when the rule is matched. 6467cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * 647b539366073ccb47433de7191dbbf519ed4ab2d8fPhil Goodwin * @param method method to match. 648b539366073ccb47433de7191dbbf519ed4ab2d8fPhil Goodwin * @param uri uri to match. 6497cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * @param response response to return when a match is found. 6507cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin */ 6517cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin public static void addHttpResponseRule(String method, String uri, HttpResponse response) { 652f91a118112ae13d39251dd3c09f1d85d33283ba1Christian Williams & Phil Goodwin getFakeHttpLayer().addHttpResponseRule(method, uri, response); 6537cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin } 6547cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin 6557cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin /** 6567cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * Adds an HTTP response rule with a default method of GET. The response will be returned when the rule is matched. 6577cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * 658b539366073ccb47433de7191dbbf519ed4ab2d8fPhil Goodwin * @param uri uri to match. 6597cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * @param response response to return when a match is found. 6607cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin */ 6617cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin public static void addHttpResponseRule(String uri, HttpResponse response) { 662f91a118112ae13d39251dd3c09f1d85d33283ba1Christian Williams & Phil Goodwin getFakeHttpLayer().addHttpResponseRule(uri, response); 6637cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin } 6647cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin 6657cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin /** 6667cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * Adds an HTTP response rule. The response will be returned when the rule is matched. 6677cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * 668b539366073ccb47433de7191dbbf519ed4ab2d8fPhil Goodwin * @param uri uri to match. 6697cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * @param response response to return when a match is found. 6707cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin */ 6717cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin public static void addHttpResponseRule(String uri, String response) { 672f91a118112ae13d39251dd3c09f1d85d33283ba1Christian Williams & Phil Goodwin getFakeHttpLayer().addHttpResponseRule(uri, response); 6737cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin } 6747cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin 6757cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin /** 6767cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * Adds an HTTP response rule. The response will be returned when the rule is matched. 6777cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * 6787cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin * @param requestMatcher custom {@code RequestMatcher}. 679b539366073ccb47433de7191dbbf519ed4ab2d8fPhil Goodwin * @param response response to return when a match is found. 6807cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin */ 6814105051dc6b4e1d67766d1ad886bd3b191f8a68fChristian Williams public static void addHttpResponseRule(RequestMatcher requestMatcher, HttpResponse response) { 682f91a118112ae13d39251dd3c09f1d85d33283ba1Christian Williams & Phil Goodwin getFakeHttpLayer().addHttpResponseRule(requestMatcher, response); 683f91a118112ae13d39251dd3c09f1d85d33283ba1Christian Williams & Phil Goodwin } 684f91a118112ae13d39251dd3c09f1d85d33283ba1Christian Williams & Phil Goodwin 685f91a118112ae13d39251dd3c09f1d85d33283ba1Christian Williams & Phil Goodwin public static FakeHttpLayer getFakeHttpLayer() { 6867d446513cda09628ec24023cfdebeca847700b52Christian Williams & Phil Goodwin return getShadowApplication().getFakeHttpLayer(); 6877cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin } 6887cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin 689d76cb3959b31f5def82d0476cc114cc5da06a7a1Phil Goodwin public static void setDefaultHttpResponse(int statusCode, String responseBody) { 690d76cb3959b31f5def82d0476cc114cc5da06a7a1Phil Goodwin getFakeHttpLayer().setDefaultHttpResponse(statusCode, responseBody); 691d76cb3959b31f5def82d0476cc114cc5da06a7a1Phil Goodwin } 692d76cb3959b31f5def82d0476cc114cc5da06a7a1Phil Goodwin 6937cf93e04b5b478b64f757a4b86ed75e28ae612c1Christian Williams & Phil Goodwin public static void setDefaultHttpResponse(HttpResponse defaultHttpResponse) { 694f91a118112ae13d39251dd3c09f1d85d33283ba1Christian Williams & Phil Goodwin getFakeHttpLayer().setDefaultHttpResponse(defaultHttpResponse); 695b2fea8dc6ecf427c1e620148946b6fd83a0bd210Phil Goodwin & Tyler Schultz } 6965dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz 697b539795cdd8f6be1b0b01527905a31faea03242cRob Dickerson public static void clearHttpResponseRules() { 698b539795cdd8f6be1b0b01527905a31faea03242cRob Dickerson getFakeHttpLayer().clearHttpResponseRules(); 699b539795cdd8f6be1b0b01527905a31faea03242cRob Dickerson } 700b539795cdd8f6be1b0b01527905a31faea03242cRob Dickerson 7015dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz public static void pauseLooper(Looper looper) { 7025dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz ShadowLooper.pauseLooper(looper); 7035dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz } 7045dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz 7055dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz public static void unPauseLooper(Looper looper) { 7065dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz ShadowLooper.unPauseLooper(looper); 7075dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz } 7085dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz 7095dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz public static void pauseMainLooper() { 7105dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz ShadowLooper.pauseMainLooper(); 7115dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz } 7125dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz 7135dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz public static void unPauseMainLooper() { 7145dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz ShadowLooper.unPauseMainLooper(); 7155dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz } 7165dab156481a91717311fa47ff7e27a54865abfa3Phil Goodwin & Tyler Schultz 717a4f7d50f8e6f12d541421383544fe16c185e4bbcPhil Goodwin & Tyler Schultz public static Scheduler getUiThreadScheduler() { 718a4f7d50f8e6f12d541421383544fe16c185e4bbcPhil Goodwin & Tyler Schultz return shadowOf(Looper.getMainLooper()).getScheduler(); 719a4f7d50f8e6f12d541421383544fe16c185e4bbcPhil Goodwin & Tyler Schultz } 7207d446513cda09628ec24023cfdebeca847700b52Christian Williams & Phil Goodwin 7210fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin public static Scheduler getBackgroundScheduler() { 7220fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin return getShadowApplication().getBackgroundScheduler(); 7230fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin } 7240fe1965a36c508fb5b9fa4c8d0caa2d30540f2ccChristian Williams & Phil Goodwin 7257d446513cda09628ec24023cfdebeca847700b52Christian Williams & Phil Goodwin public static ShadowApplication getShadowApplication() { 7267d446513cda09628ec24023cfdebeca847700b52Christian Williams & Phil Goodwin return shadowOf(Robolectric.application); 7277d446513cda09628ec24023cfdebeca847700b52Christian Williams & Phil Goodwin } 728c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams 729c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams /** 730c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams * Calls {@code performClick()} on a {@code View} after ensuring that it and its ancestors are visible and that it 731c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams * is enabled. 732c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams * 733c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams * @param view the view to click on 734c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams * @return true if {@code View.OnClickListener}s were found and fired, false otherwise. 735c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams * @throws RuntimeException if the preconditions are not met. 736c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams */ 737c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams public static boolean clickOn(View view) { 738c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams return shadowOf(view).checkedPerformClick(); 739c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams } 740c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams 741c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams public static String visualize(View view) { 742c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams Canvas canvas = new Canvas(); 743c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams view.draw(canvas); 744c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams return shadowOf(canvas).getDescription(); 745c0ff00024bd89540c9a5bac5c88b4da4b38f0456Josh Lauer & Christian Williams } 746c80983d2a778c62de05423980ba943217e2275bcChristian Williams & Phil Goodwin 747c80983d2a778c62de05423980ba943217e2275bcChristian Williams & Phil Goodwin public static String visualize(Canvas canvas) { 748c80983d2a778c62de05423980ba943217e2275bcChristian Williams & Phil Goodwin return shadowOf(canvas).getDescription(); 749c80983d2a778c62de05423980ba943217e2275bcChristian Williams & Phil Goodwin } 750c80983d2a778c62de05423980ba943217e2275bcChristian Williams & Phil Goodwin 751c80983d2a778c62de05423980ba943217e2275bcChristian Williams & Phil Goodwin public static String visualize(Bitmap bitmap) { 752c80983d2a778c62de05423980ba943217e2275bcChristian Williams & Phil Goodwin return shadowOf(bitmap).getDescription(); 753c80983d2a778c62de05423980ba943217e2275bcChristian Williams & Phil Goodwin } 7540b378afcde0200166e546c46a7642015accfce49Christian Williams & Ian Fisher} 755