Java 类android.support.test.InstrumentationRegistry 实例源码
项目:GitHub
文件:BaseIntegrationTest.java
protected void prepareEnvironmentForTest() throws IOException {
// FIXME Trying to reset the device environment is crashing tests somehow
deleteRosFiles();
if (BaseRealm.applicationContext != null) {
// Realm was already initialized. Reset all internal state
// in order to be able fully re-initialize.
// This will set the 'm_metadata_manager' in 'sync_manager.cpp' to be 'null'
// causing the SyncUser to remain in memory.
// They're actually not persisted into disk.
// move this call to 'tearDown' to clean in-memory & on-disk users
// once https://github.com/realm/realm-object-store/issues/207 is resolved
SyncManager.reset();
BaseRealm.applicationContext = null; // Required for Realm.init() to work
}
Realm.init(InstrumentationRegistry.getContext());
originalLogLevel = RealmLog.getLevel();
RealmLog.setLevel(LogLevel.DEBUG);
}
项目:wcs-android-sdk
文件:UploadFileTest.java
@Test
public void testNullToken() throws Exception {
Log.d(TAG, "uploadNullToken");
final String token = null;
final String filePath = getPath();
final CountDownLatch signal = new CountDownLatch(1);
FileUploader.upload(InstrumentationRegistry.getTargetContext(),
token, filePath, null, new FileUploaderListener() {
@Override
public void onFailure(OperationMessage operationMessage) {
Log.d(TAG, "onFailure: " + operationMessage.getMessage());
signal.countDown();
Assert.assertTrue(operationMessage.getMessage().contains("token invalidate"));
}
@Override
public void onSuccess(int status, JSONObject responseJson) {
Log.d(TAG, "onSuccess: " + responseJson);
signal.countDown();
Assert.assertNull(responseJson);
}
});
signal.await(WAIT_TIME, TimeUnit.MILLISECONDS);
}
项目:WebPager
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.fengshihao.webpager", appContext.getPackageName());
}
项目:GitHub
文件:SortTest.java
@Before
public void setUp() {
// Creates a Realm with the following objects:
// 0: (5, "Adam")
// 1: (4, "Brian")
// 2: (4, "Adam")
// 3: (5, "Adam")
// Injecting the Instrumentation instance is required
// for your test to run with AndroidJUnitRunner.
context = InstrumentationRegistry.getInstrumentation().getContext();
realmConfig = configFactory.createConfiguration();
realm = Realm.getInstance(realmConfig);
populateRealm(realm);
}
项目:AndroidDeviceName
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.rednineteen.android.adn", appContext.getPackageName());
}
项目:renderingPerformance
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("wanjian.renderingperformance.test", appContext.getPackageName());
}
项目:GitHub
文件:UpdateAvailableTest.java
@Test
public void updateAvailable_Basic_XML() throws Throwable {
final CountDownLatch signal = new CountDownLatch(1);
uiThreadTestRule.runOnUiThread(new Runnable() {
@Override
public void run() {
new AppUpdaterUtils(InstrumentationRegistry.getTargetContext())
.setUpdateFrom(UpdateFrom.XML)
.setUpdateJSON("https://raw.githubusercontent.com/javiersantos/AppUpdater/master/app/src/androidTest/java/com/github/javiersantos/appupdater/files/update-available-basic.xml")
.withListener(new AppUpdaterUtils.UpdateListener() {
@Override
public void onSuccess(Update update, Boolean isUpdateAvailable) {
assertTrue(isUpdateAvailable);
signal.countDown();
}
@Override
public void onFailed(AppUpdaterError error) {
assertNotNull(error);
signal.countDown();
}
})
.start();
}
});
signal.await(30, TimeUnit.SECONDS);
}
项目:GPSTracker-Android
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.highbryds.tracker", appContext.getPackageName());
}
项目:RewardLayout
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.zhangyf.reward", appContext.getPackageName());
}
项目:iSPY
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.ajaykumar.drawer", appContext.getPackageName());
}
项目:Android-Validator
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.harpz.androidvalidator.test", appContext.getPackageName());
}
项目:AppRater-Dialog
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.kila.apprater_dialog.lars.test", appContext.getPackageName());
}
项目:quidditchtimekeeper
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("de.lucasscheuvens.qtk", appContext.getPackageName());
}
项目:Bridge
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("moe.shizuku.bridge", appContext.getPackageName());
}
项目:AutoScrollr
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.suyashsrijan.autoscrollr", appContext.getPackageName());
}
项目:CameraSample
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.akexorcist.cameraapi", appContext.getPackageName());
}
项目:Discover
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.discover", appContext.getPackageName());
}
项目:Khonsu
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.a.vinpal", appContext.getPackageName());
}
项目:DateTimeUtils
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.github.thunder413.datetimeutilssample", appContext.getPackageName());
}
项目:AnimationTextView
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.totcy.animationtextview.test", appContext.getPackageName());
}
项目:ToDay
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("mn.pomodoro", appContext.getPackageName());
}
项目:Kawaii_LoadingView
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("scut.carson_ho.view_testdemo", appContext.getPackageName());
}
项目:Typesetter
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.bignerdranch.android.typesetter", appContext.getPackageName());
}
项目:AFRouter
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.tubb.afrouter.test", appContext.getPackageName());
}
项目:OkayCamera-Android
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.databindingdemo", appContext.getPackageName());
}
项目:GifEmoji
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.hoanganhtuan95ptit.gifemoji.test", appContext.getPackageName());
}
项目:WalkGraph
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.ahmed.walkgraph", appContext.getPackageName());
}
项目:FestaFimDeAno
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.devmasterteam.festafimdeano", appContext.getPackageName());
}
项目:AndroidThemeChange
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("test.fadai.com.test", appContext.getPackageName());
}
项目:Aardvark
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.ekanugrahapratama.aardvark_project", appContext.getPackageName());
}
项目:Samantha
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.junnanhao.samanthaviews.test", appContext.getPackageName());
}
项目:Android-Practice
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.jjuiddong.myapplication", appContext.getPackageName());
}
项目:SafeMediaPlayer
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.hss01248.safemedia", appContext.getPackageName());
}
项目:ModesoActionOverlay-Android
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("ch.modeso.profilemenuanimation", appContext.getPackageName());
}
项目:Google-Developer-Challenge-Scholarship-Android-Basics
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.android.courtcounter", appContext.getPackageName());
}
项目:FlexibleRichTextView
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.daquexian.flexiblerichtextview.test", appContext.getPackageName());
}
项目:MyCleanArchitecture
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("herry.architec", appContext.getPackageName());
}
项目:ZhidaoDaily-android
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.shenhua.zhidaodaily", appContext.getPackageName());
}
项目:RecyclerViewTutorial2017
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("forgettery.wiseass.com.recyclerviewprebuilt", appContext.getPackageName());
}
项目:TensorFlowAndroidDynamic
文件:ExampleInstrumentedTest.java
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.hss01248.tensorflowdynamic.test", appContext.getPackageName());
}