当前位置: 首页>>代码示例>>Java>>正文


Java InstrumentationRegistry类代码示例

本文整理汇总了Java中android.support.test.InstrumentationRegistry的典型用法代码示例。如果您正苦于以下问题:Java InstrumentationRegistry类的具体用法?Java InstrumentationRegistry怎么用?Java InstrumentationRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InstrumentationRegistry类属于android.support.test包,在下文中一共展示了InstrumentationRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareEnvironmentForTest

import android.support.test.InstrumentationRegistry; //导入依赖的package包/类
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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:BaseIntegrationTest.java

示例2: testNullToken

import android.support.test.InstrumentationRegistry; //导入依赖的package包/类
@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);
}
 
开发者ID:Wangsu-Cloud-Storage,项目名称:wcs-android-sdk,代码行数:26,代码来源:UploadFileTest.java

示例3: useAppContext

import android.support.test.InstrumentationRegistry; //导入依赖的package包/类
@Test
public void useAppContext() throws Exception {
	// Context of the app under test.
	Context appContext = InstrumentationRegistry.getTargetContext();

	assertEquals("com.fengshihao.webpager", appContext.getPackageName());
}
 
开发者ID:fengshihao,项目名称:WebPager,代码行数:8,代码来源:ExampleInstrumentedTest.java

示例4: setUp

import android.support.test.InstrumentationRegistry; //导入依赖的package包/类
@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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:SortTest.java

示例5: useAppContext

import android.support.test.InstrumentationRegistry; //导入依赖的package包/类
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.rednineteen.android.adn", appContext.getPackageName());
}
 
开发者ID:rednineteen,项目名称:AndroidDeviceName,代码行数:8,代码来源:ExampleInstrumentedTest.java

示例6: useAppContext

import android.support.test.InstrumentationRegistry; //导入依赖的package包/类
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("wanjian.renderingperformance.test", appContext.getPackageName());
}
 
开发者ID:android-notes,项目名称:renderingPerformance,代码行数:8,代码来源:ExampleInstrumentedTest.java

示例7: updateAvailable_Basic_XML

import android.support.test.InstrumentationRegistry; //导入依赖的package包/类
@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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:UpdateAvailableTest.java

示例8: useAppContext

import android.support.test.InstrumentationRegistry; //导入依赖的package包/类
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.highbryds.tracker", appContext.getPackageName());
}
 
开发者ID:smtrz,项目名称:GPSTracker-Android,代码行数:8,代码来源:ExampleInstrumentedTest.java

示例9: useAppContext

import android.support.test.InstrumentationRegistry; //导入依赖的package包/类
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.zhangyf.reward", appContext.getPackageName());
}
 
开发者ID:Yuphee,项目名称:RewardLayout,代码行数:8,代码来源:ExampleInstrumentedTest.java

示例10: useAppContext

import android.support.test.InstrumentationRegistry; //导入依赖的package包/类
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.example.ajaykumar.drawer", appContext.getPackageName());
}
 
开发者ID:ayushghd,项目名称:iSPY,代码行数:8,代码来源:ExampleInstrumentedTest.java

示例11: useAppContext

import android.support.test.InstrumentationRegistry; //导入依赖的package包/类
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.harpz.androidvalidator.test", appContext.getPackageName());
}
 
开发者ID:harpzzz,项目名称:Android-Validator,代码行数:8,代码来源:ExampleInstrumentedTest.java

示例12: useAppContext

import android.support.test.InstrumentationRegistry; //导入依赖的package包/类
@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());
}
 
开发者ID:Lars3n95,项目名称:AppRater-Dialog,代码行数:8,代码来源:ExampleInstrumentedTest.java

示例13: useAppContext

import android.support.test.InstrumentationRegistry; //导入依赖的package包/类
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("de.lucasscheuvens.qtk", appContext.getPackageName());
}
 
开发者ID:kingblaubart,项目名称:quidditchtimekeeper,代码行数:8,代码来源:ExampleInstrumentedTest.java

示例14: useAppContext

import android.support.test.InstrumentationRegistry; //导入依赖的package包/类
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("moe.shizuku.bridge", appContext.getPackageName());
}
 
开发者ID:RikkaW,项目名称:Bridge,代码行数:8,代码来源:ExampleInstrumentedTest.java

示例15: useAppContext

import android.support.test.InstrumentationRegistry; //导入依赖的package包/类
@Test
public void useAppContext() throws Exception {
    // Context of the app under test.
    Context appContext = InstrumentationRegistry.getTargetContext();

    assertEquals("com.suyashsrijan.autoscrollr", appContext.getPackageName());
}
 
开发者ID:theblixguy,项目名称:AutoScrollr,代码行数:8,代码来源:ExampleInstrumentedTest.java


注:本文中的android.support.test.InstrumentationRegistry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。