未验证 提交 b2f24fcc 编写于 作者: O openharmony_ci 提交者: Gitee

!9384 解决security测试套tokenid跨平台问题

Merge pull request !9384 from huyanqiang/master
...@@ -17,6 +17,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl' ...@@ -17,6 +17,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle' import bundle from '@ohos.bundle'
import bundleManager from '@ohos.bundle.bundleManager'; import bundleManager from '@ohos.bundle.bundleManager';
import osAccount from '@ohos.account.osAccount' import osAccount from '@ohos.account.osAccount'
import deviceInfo from '@ohos.deviceInfo'
const GrantStatus = abilityAccessCtrl.GrantStatus; const GrantStatus = abilityAccessCtrl.GrantStatus;
...@@ -25,7 +26,7 @@ const ERR_PARAM_INVALID = 12100001; ...@@ -25,7 +26,7 @@ const ERR_PARAM_INVALID = 12100001;
var permissionNameUser = "ohos.permission.DISTRIBUTED_DATASYNC"; var permissionNameUser = "ohos.permission.DISTRIBUTED_DATASYNC";
var permissionNameSystem = "ohos.permission.GET_BUNDLE_INFO"; var permissionNameSystem = "ohos.permission.GET_BUNDLE_INFO";
var tokenID = undefined; var tokenID = 11;
export default function AccessTokenTest() { export default function AccessTokenTest() {
describe('AccessTokenTest', function () { describe('AccessTokenTest', function () {
...@@ -33,20 +34,25 @@ export default function AccessTokenTest() { ...@@ -33,20 +34,25 @@ export default function AccessTokenTest() {
var accountManager = osAccount.getAccountManager(); var accountManager = osAccount.getAccountManager();
var userId = await accountManager.getOsAccountLocalIdFromProcess(); var userId = await accountManager.getOsAccountLocalIdFromProcess();
try { try {
let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION; let productModelInfo = deviceInfo.productModel;
var buddleInfo = await bundleManager.getBundleInfoForSelf(bundleFlags); if (productModelInfo == "ohos") {
console.log('getBundleInfoForSelf ok') let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION;
var appInfo = buddleInfo.appInfo; var buddleInfo = await bundleManager.getBundleInfoForSelf(bundleFlags);
console.log('getBundleInfoForSelf ok2') console.log('getBundleInfoForSelf ok')
tokenID = appInfo.accessTokenId; var appInfo = buddleInfo.appInfo;
console.log('getBundleInfoForSelf ok3'+tokenID) console.log('getBundleInfoForSelf ok2')
console.info("AccessTokenTest accessTokenId:" + appInfo.accessTokenId + ", name:" + appInfo.name tokenID = appInfo.accessTokenId;
+ ", bundleName:" + 'com.example.myapplication') console.log('getBundleInfoForSelf ok3'+tokenID)
console.info("AccessTokenTest accessTokenId:" + appInfo.accessTokenId + ", name:" + appInfo.name
+ ", bundleName:" + 'com.example.myapplication')
console.info("sleep begin"); console.info("sleep begin");
sleep(TIMEOUT); sleep(TIMEOUT);
console.info("sleep end"); console.info("sleep end");
done(); done();
}else{
tokenID = 11;
}
} catch (err) { } catch (err) {
console.log('beforeAll error' + JSON.stringify(err)); console.log('beforeAll error' + JSON.stringify(err));
done(); done();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册