本文整理汇总了Java中android.test.mock.MockPackageManager类的典型用法代码示例。如果您正苦于以下问题:Java MockPackageManager类的具体用法?Java MockPackageManager怎么用?Java MockPackageManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MockPackageManager类属于android.test.mock包,在下文中一共展示了MockPackageManager类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getPackageManager
import android.test.mock.MockPackageManager; //导入依赖的package包/类
@Override
public PackageManager getPackageManager() {
return new MockPackageManager() {
@Override
public List<ProviderInfo> queryContentProviders(final String processName,
final int uid, final int flags) {
return mProviderInfos;
}
};
}
开发者ID:grandcentrix,项目名称:tray,代码行数:11,代码来源:TrayProviderTestCase.java
示例2: testConfiguration
import android.test.mock.MockPackageManager; //导入依赖的package包/类
public void testConfiguration() {
final ApplicationInfo appInfo = new ApplicationInfo();
appInfo.metaData = new Bundle();
appInfo.metaData.putInt("com.mixpanel.android.MPConfig.BulkUploadLimit", 1);
appInfo.metaData.putInt("com.mixpanel.android.MPConfig.FlushInterval", 2);
appInfo.metaData.putInt("com.mixpanel.android.MPConfig.DataExpiration", 3);
appInfo.metaData.putBoolean("com.mixpanel.android.MPConfig.DisableFallback", true);
appInfo.metaData.putBoolean("com.mixpanel.android.MPConfig.AutoShowMixpanelUpdates", false);
appInfo.metaData.putBoolean("com.mixpanel.android.MPConfig.DisableGestureBindingUI", true);
appInfo.metaData.putBoolean("com.mixpanel.android.MPConfig.DisableEmulatorBindingUI", true);
appInfo.metaData.putBoolean("com.mixpanel.android.MPConfig.DisableAppOpenEvent", true);
appInfo.metaData.putString("com.mixpanel.android.MPConfig.EventsEndpoint", "EVENTS ENDPOINT");
appInfo.metaData.putString("com.mixpanel.android.MPConfig.EventsFallbackEndpoint", "EVENTS FALLBACK ENDPOINT");
appInfo.metaData.putString("com.mixpanel.android.MPConfig.PeopleEndpoint", "PEOPLE ENDPOINT");
appInfo.metaData.putString("com.mixpanel.android.MPConfig.PeopleFallbackEndpoint", "PEOPLE FALLBACK ENDPOINT");
appInfo.metaData.putString("com.mixpanel.android.MPConfig.DecideEndpoint", "DECIDE ENDPOINT");
appInfo.metaData.putString("com.mixpanel.android.MPConfig.DecideFallbackEndpoint", "DECIDE FALLBACK ENDPOINT");
final PackageManager packageManager = new MockPackageManager() {
@Override
public ApplicationInfo getApplicationInfo(String packageName, int flags) {
assertEquals(packageName, "TEST PACKAGE NAME");
assertTrue((flags & PackageManager.GET_META_DATA) == PackageManager.GET_META_DATA);
return appInfo;
}
};
final Context context = new MockContext() {
@Override
public String getPackageName() {
return "TEST PACKAGE NAME";
}
@Override
public PackageManager getPackageManager() {
return packageManager;
}
};
final MPConfig testConfig = MPConfig.readConfig(context);
assertEquals(1, testConfig.getBulkUploadLimit());
assertEquals(2, testConfig.getFlushInterval());
assertEquals(3, testConfig.getDataExpiration());
assertEquals(true, testConfig.getDisableFallback());
assertEquals(true, testConfig.getDisableEmulatorBindingUI());
assertEquals(true, testConfig.getDisableGestureBindingUI());
assertEquals(true, testConfig.getDisableAppOpenEvent());
assertEquals(false, testConfig.getAutoShowMixpanelUpdates());
assertEquals("EVENTS ENDPOINT", testConfig.getEventsEndpoint());
assertEquals("EVENTS FALLBACK ENDPOINT", testConfig.getEventsFallbackEndpoint());
assertEquals("PEOPLE ENDPOINT", testConfig.getPeopleEndpoint());
assertEquals("PEOPLE FALLBACK ENDPOINT", testConfig.getPeopleFallbackEndpoint());
assertEquals("DECIDE ENDPOINT", testConfig.getDecideEndpoint());
assertEquals("DECIDE FALLBACK ENDPOINT", testConfig.getDecideFallbackEndpoint());
}
开发者ID:perludem,项目名称:DPR-KITA,代码行数:57,代码来源:MixpanelBasicTest.java
示例3: testConfiguration
import android.test.mock.MockPackageManager; //导入依赖的package包/类
public void testConfiguration() {
final ApplicationInfo appInfo = new ApplicationInfo();
appInfo.metaData = new Bundle();
appInfo.metaData.putInt("com.mixpanel.android.MPConfig.BulkUploadLimit", 1);
appInfo.metaData.putInt("com.mixpanel.android.MPConfig.FlushInterval", 2);
appInfo.metaData.putInt("com.mixpanel.android.MPConfig.DataExpiration", 3);
appInfo.metaData.putBoolean("com.mixpanel.android.MPConfig.DisableFallback", true);
appInfo.metaData.putBoolean("com.mixpanel.android.MPConfig.AutoShowMixpanelUpdates", false);
appInfo.metaData.putString("com.mixpanel.android.MPConfig.EventsEndpoint", "EVENTS ENDPOINT");
appInfo.metaData.putString("com.mixpanel.android.MPConfig.EventsFallbackEndpoint", "EVENTS FALLBACK ENDPOINT");
appInfo.metaData.putString("com.mixpanel.android.MPConfig.PeopleEndpoint", "PEOPLE ENDPOINT");
appInfo.metaData.putString("com.mixpanel.android.MPConfig.PeopleFallbackEndpoint", "PEOPLE FALLBACK ENDPOINT");
appInfo.metaData.putString("com.mixpanel.android.MPConfig.DecideEndpoint", "DECIDE ENDPOINT");
appInfo.metaData.putString("com.mixpanel.android.MPConfig.DecideFallbackEndpoint", "DECIDE FALLBACK ENDPOINT");
final PackageManager packageManager = new MockPackageManager() {
@Override
public ApplicationInfo getApplicationInfo(String packageName, int flags) {
assertEquals(packageName, "TEST PACKAGE NAME");
assertTrue((flags & PackageManager.GET_META_DATA) == PackageManager.GET_META_DATA);
return appInfo;
}
};
final Context context = new MockContext() {
@Override
public String getPackageName() {
return "TEST PACKAGE NAME";
}
@Override
public PackageManager getPackageManager() {
return packageManager;
}
};
final MPConfig testConfig = MPConfig.readConfig(context);
assertEquals(1, testConfig.getBulkUploadLimit());
assertEquals(2, testConfig.getFlushInterval());
assertEquals(3, testConfig.getDataExpiration());
assertEquals(true, testConfig.getDisableFallback());
assertEquals(false, testConfig.getAutoShowMixpanelUpdates());
assertEquals("EVENTS ENDPOINT", testConfig.getEventsEndpoint());
assertEquals("EVENTS FALLBACK ENDPOINT", testConfig.getEventsFallbackEndpoint());
assertEquals("PEOPLE ENDPOINT", testConfig.getPeopleEndpoint());
assertEquals("PEOPLE FALLBACK ENDPOINT", testConfig.getPeopleFallbackEndpoint());
assertEquals("DECIDE ENDPOINT", testConfig.getDecideEndpoint());
assertEquals("DECIDE FALLBACK ENDPOINT", testConfig.getDecideFallbackEndpoint());
}
开发者ID:benbek,项目名称:HereAStory-Android,代码行数:51,代码来源:MixpanelBasicTest.java
注:本文中的android.test.mock.MockPackageManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论