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


Java RobolectricPackageManager.addPackage方法代码示例

本文整理汇总了Java中org.robolectric.res.builder.RobolectricPackageManager.addPackage方法的典型用法代码示例。如果您正苦于以下问题:Java RobolectricPackageManager.addPackage方法的具体用法?Java RobolectricPackageManager.addPackage怎么用?Java RobolectricPackageManager.addPackage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.robolectric.res.builder.RobolectricPackageManager的用法示例。


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

示例1: execute_whenUberAppInsalled_shouldPointToUberApp

import org.robolectric.res.builder.RobolectricPackageManager; //导入方法依赖的package包/类
@Test
public void execute_whenUberAppInsalled_shouldPointToUberApp() throws IOException {
    String expectedUri = readUriResourceWithUserAgentParam("src/test/resources/deeplinkuris/just_client_provided",
            USER_AGENT_DEEPLINK);

    Activity activity = Robolectric.setupActivity(Activity.class);
    ShadowActivity shadowActivity = shadowOf(activity);

    RobolectricPackageManager packageManager = RuntimeEnvironment.getRobolectricPackageManager();

    PackageInfo uberPackage = new PackageInfo();
    uberPackage.packageName = UBER_PACKAGE_NAME;
    packageManager.addPackage(uberPackage);

    RideParameters rideParameters = new RideParameters.Builder().build();

    RequestDeeplink requestDeeplink = new RequestDeeplink.Builder(activity)
            .setRideParameters(rideParameters)
            .setSessionConfiguration(new SessionConfiguration.Builder().setClientId("clientId").build())
            .build();

    requestDeeplink.execute();

    Intent startedIntent = shadowActivity.getNextStartedActivity();
    assertEquals(expectedUri, startedIntent.getData().toString());
}
 
开发者ID:uber,项目名称:rides-android-sdk,代码行数:27,代码来源:RequestDeeplinkTest.java

示例2: simulateAppUpdate

import org.robolectric.res.builder.RobolectricPackageManager; //导入方法依赖的package包/类
static void simulateAppUpdate() {
    RobolectricPackageManager rpm = RuntimeEnvironment.getRobolectricPackageManager();
    PackageInfo packageInfo = new PackageInfo();
    packageInfo.packageName = RuntimeEnvironment.application.getPackageName();
    packageInfo.lastUpdateTime = new Date().getTime();
    rpm.addPackage(packageInfo);
    Once.initialise(RuntimeEnvironment.application);
}
 
开发者ID:jonfinerty,项目名称:Once,代码行数:9,代码来源:TestUtils.java

示例3: createApplication

import org.robolectric.res.builder.RobolectricPackageManager; //导入方法依赖的package包/类
@Override
public Application createApplication(Method method, AndroidManifest appManifest, Config config) {
    // FIXME If a future version of Robolectric implements "setInstallerPackageName", remove this.
    RobolectricPackageManager oldManager = Robolectric.packageManager;
    RobolectricPackageManager newManager = new FullEnvPackageManager();
    for (PackageInfo pkg : oldManager.getInstalledPackages(0))
        newManager.addPackage(pkg);
    Robolectric.packageManager = newManager;
    return new PiwikTestApplication();
}
 
开发者ID:matomo-org,项目名称:piwik-sdk-android,代码行数:11,代码来源:FullEnvTestLifeCycle.java

示例4: addInstalledPackage

import org.robolectric.res.builder.RobolectricPackageManager; //导入方法依赖的package包/类
private void addInstalledPackage(String packageName) {
	RobolectricPackageManager pm = Robolectric.packageManager;
	PackageInfo packInfo = new PackageInfo();
	packInfo.packageName = packageName;
	pm.addPackage(packInfo);
}
 
开发者ID:naver,项目名称:android-utilset,代码行数:7,代码来源:ActivityUtilsTest.java


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