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

!5162 【xts_acts】【monthly_0816】ability/dmsfwk 测试套参数覆盖

Merge pull request !5162 from 于小雅/monthly_20220816
......@@ -16,6 +16,9 @@ import("//build/ohos_var.gni")
group("ability") {
testonly = true
if (is_standard_system) {
deps = [ "ability_runtime:ability_runtime" ]
deps = [
"ability_runtime:ability_runtime",
"dmsfwk:dmsfwk",
]
}
}
......@@ -21,6 +21,8 @@ ohos_js_hap_suite("continuationmanager_js_test") {
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsContinuationManagerJsTest"
subsystem_name = "ability"
part_name = "dmsfwk"
}
ohos_js_assets("continuationmanager_js_assets") {
js2abc = true
......
......@@ -19,8 +19,8 @@ const TEST_DEVICE_ID = "test_deviceId";
const TEST_CONNECT_STATUS = continuationManager.DeviceConnectState.CONNECTED;
let token = -1;
export default function ContinuationManagerTest() {
describe('ContinuationManagerTest', function() {
export default function continuationManagerTest() {
describe('continuationManagerTest', function() {
beforeAll(async function (done) {
console.info('beforeAll');
......@@ -58,6 +58,7 @@ describe('ContinuationManagerTest', function() {
*/
it('testRegister001', 0, async function(done) {
try {
console.info("testRegister001Begin ");
continuationManager.register(function (err, data) {
expect(err.code == 0).assertTrue();
expect(data - token == 1).assertTrue();
......@@ -85,7 +86,7 @@ describe('ContinuationManagerTest', function() {
authInfo: {}
};
continuationManager.register(continuationExtraParams, function(err, data){
console.info("testRegister002 " + err.message)
console.info("testRegister002 " + err.message);
expect(err.message == "Invalidate params.").assertTrue();
done();
});
......@@ -133,7 +134,7 @@ describe('ContinuationManagerTest', function() {
deviceType: ["00E"],
description: "description",
filter: {"name": "authInfo","length": 8},
continuationMode: continuationManager.ContinuationMode.COLLABORATION_MUTIPLE,
continuationMode: continuationManager.ContinuationMode.COLLABORATION_MULTIPLE,
authInfo: {"name": "authInfo","length": 8}
};
continuationManager.register(continuationExtraParams, function(err, data) {
......@@ -149,6 +150,160 @@ describe('ContinuationManagerTest', function() {
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_REGISTER_0500
* @tc.name [JS-API8]ContinuationManager.register().
* @tc.desc Test Js Api ContinuationManager.register() testcase 005
*/
it('testRegister005', 0, async function(done) {
try {
let continuationExtraParams = {
deviceType: ["00E"],
description: "description",
filter: {"name": "authInfo","length": 8},
continuationMode: continuationManager.ContinuationMode.COLLABORATION_SINGLE,
authInfo: {"name": "authInfo","length": 8}
};
continuationManager.register(continuationExtraParams, function(err, data) {
expect(err.code == 0).assertTrue();
expect(data - token == 1).assertTrue();
done();
});
} catch (e) {
console.info("testRegister005 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_REGISTER_0600
* @tc.name [JS-API8]ContinuationManager.register().
* @tc.desc Test Js Api ContinuationManager.register() testcase 006
*/
it('testRegister006', 0, async function(done) {
try {
let continuationExtraParams = {
deviceType: ["00E"],
description: "description",
filter: {"name": "authInfo","length": 8},
continuationMode: continuationManager.ContinuationMode.COLLABORATION_SINGLE,
authInfo: {"name": "authInfo","length": 8}
};
continuationManager.register(continuationExtraParams).then((data) => {
expect(data - token == 1).assertTrue();
}).catch((err) => {
expect(err.code == 29360210).assertTrue();
});
} catch (e) {
console.info("testRegister006 " + e);
expect(null).assertFail();
}
done();
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_REGISTER_0700
* @tc.name [JS-API8]ContinuationManager.register().
* @tc.desc Test Js Api ContinuationManager.register() testcase 007
*/
it('testRegister007', 0, async function(done) {
try {
let continuationExtraParams = {
deviceType: ["00E"],
description: "description",
filter: {"name": "authInfo","length": 8},
continuationMode: continuationManager.ContinuationMode.COLLABORATION_MULTIPLE,
authInfo: {"name": "authInfo","length": 8}
};
continuationManager.register(continuationExtraParams).then((data) => {
expect(data - token == 1).assertTrue();
}).catch((err) => {
expect(err.code == 29360210).assertTrue();
});
} catch (e) {
console.info("testRegister007 " + e);
expect(null).assertFail();
}
done();
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_REGISTER_0800
* @tc.name [JS-API8]ContinuationManager.register().
* @tc.desc Test Js Api ContinuationManager.register() testcase 008
*/
it('testRegister008', 0, async function(done) {
try {
let continuationExtraParams = {
deviceType: [],
description: "",
filter: "",
continuationMode: null,
authInfo: {}
};
continuationManager.register(continuationExtraParams).then((data) => {
expect(data - token != 1).assertTrue();
}).catch((err) => {
expect(err.code == 29360210).assertTrue();
});
} catch (e) {
console.info("testRegister008 " + e);
expect(null).assertFail();
}
done();
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_REGISTER_0900
* @tc.name [JS-API8]ContinuationManager.register().
* @tc.desc Test Js Api ContinuationManager.register() testcase 009
*/
it('testRegister009', 0, async function(done) {
try {
let continuationExtraParams = {
deviceType: ["00E"],
description: "description",
filter: {"name": "authInfo","length": 8},
continuationMode: 10,
authInfo: {"name": "authInfo","length": 8}
};
continuationManager.register(continuationExtraParams).then((data) => {
expect(data - token != 1).assertTrue();
}).catch((err) => {
expect(err.code == 29360210).assertTrue();
});
done();
} catch (e) {
console.info("testRegister009 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_REGISTER_1000
* @tc.name [JS-API8]ContinuationManager.register().
* @tc.desc Test Js Api ContinuationManager.register() testcase 010
*/
it('testRegister010', 0, async function(done) {
try {
continuationManager.register().then((data) => {
expect(data - token == 1).assertTrue();
}).catch((err) => {
expect(err.code == 29360210).assertTrue();
});
} catch (e) {
console.info("testRegister010 " + e);
expect(null).assertFail();
}
done();
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UNREGISTER_0100
* @tc.name [JS-API8]ContinuationManager.unregister().
......@@ -208,6 +363,46 @@ describe('ContinuationManagerTest', function() {
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UNREGISTER_0400
* @tc.name [JS-API8]ContinuationManager.unregister().
* @tc.desc Test Js Api ContinuationManager.unregister() testcase 004
*/
it('testUnregister004', 0, async function(done) {
try {
continuationManager.unregister(300, function (data) {
expect(data.code == 29360208).assertTrue();
})
done();
} catch (e) {
console.info("testUnregister004 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UNREGISTER_0500
* @tc.name [JS-API8]ContinuationManager.unregister().
* @tc.desc Test Js Api ContinuationManager.unregister() testcase 005
*/
it('testUnregister005', 0, async function(done) {
try {
continuationManager.unregister(token, function (data) {
console.info("testUnregister005 " + JSON.stringify(data));
expect(data.code == 0).assertTrue();
})
done();
} catch (e) {
console.info("testUnregister005 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0100
* @tc.name [JS-API8]ContinuationManager.on().
......@@ -397,7 +592,7 @@ describe('ContinuationManagerTest', function() {
deviceType: ["00E"],
description: "description",
filter: {"name": "authInfo","length": 8},
continuationMode: continuationManager.ContinuationMode.COLLABORATION_MUTIPLE,
continuationMode: continuationManager.ContinuationMode.COLLABORATION_MULTIPLE,
authInfo: {"name": "authInfo","length": 8}
};
continuationManager.startDeviceManager(null, continuationExtraParams, function (err, data) {
......@@ -423,7 +618,7 @@ describe('ContinuationManagerTest', function() {
deviceType: ["00E"],
description: "description",
filter: {"name": "authInfo","length": 8},
continuationMode: continuationManager.ContinuationMode.COLLABORATION_MUTIPLE,
continuationMode: continuationManager.ContinuationMode.COLLABORATION_MULTIPLE,
authInfo: {"name": "authInfo","length": 8}
};
continuationManager.startDeviceManager(52, continuationExtraParams, function (err, data) {
......@@ -514,6 +709,54 @@ describe('ContinuationManagerTest', function() {
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_STARTDEVICEMANAGER_0800
* @tc.name [JS-API8]ContinuationManager.startDeviceManager().
* @tc.desc Test Js Api ContinuationManager.startDeviceManager() testcase 008
*/
it('testStartDeviceManager008', 0, async function(done) {
try {
let continuationExtraParams = {
deviceType: ["00E"],
description: "description",
filter: {"name": "authInfo","length": 8},
continuationMode: continuationManager.ContinuationMode.COLLABORATION_SINGLE,
authInfo: {"name": "authInfo","length": 8}
};
continuationManager.startDeviceManager(token, continuationExtraParams).then((data) => {
expect(data == undefined).assertTrue();
}).catch((err) => {
expect(err.code == 29360210).assertTrue();
});
done();
} catch (e) {
console.info("testStartDeviceManager008 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_STARTDEVICEMANAGER_0900
* @tc.name [JS-API8]ContinuationManager.startDeviceManager().
* @tc.desc Test Js Api ContinuationManager.startDeviceManager() testcase 009
*/
it('testStartDeviceManager009', 0, async function(done) {
try {
continuationManager.startDeviceManager(token).then((data) => {
expect(data == undefined).assertTrue();
}).catch((err) => {
expect(err.code == 29360210).assertTrue();
});
done();
} catch (e) {
console.info("testStartDeviceManager009 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UPDATECONNECTSTATUS_0100
* @tc.name [JS-API8]ContinuationManager.updateConnectStatus().
......@@ -572,4 +815,74 @@ describe('ContinuationManagerTest', function() {
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UPDATECONNECTSTATUS_0400
* @tc.name [JS-API8]ContinuationManager.updateConnectStatus().
* @tc.desc Test Js Api ContinuationManager.updateConnectStatus() testcase 004
*/
it('testUpdateConnectStatus004', 0, async function(done) {
try {
console.info('testUpdateConnectStatus004 begin');
continuationManager.updateConnectStatus(token, TEST_DEVICE_ID,
continuationManager.DeviceConnectState.IDLE).then((data) => {
expect(data == undefined).assertTrue();
}).catch((err) => {
expect(err.code == 29360210).assertTrue();
});
done();
} catch (e) {
console.info("testUpdateConnectStatus004 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UPDATECONNECTSTATUS_0500
* @tc.name [JS-API8]ContinuationManager.updateConnectStatus().
* @tc.desc Test Js Api ContinuationManager.updateConnectStatus() testcase 005
*/
it('testUpdateConnectStatus005', 0, async function(done) {
try {
console.info('testUpdateConnectStatus005 begin');
continuationManager.updateConnectStatus(token, TEST_DEVICE_ID,
continuationManager.DeviceConnectState.CONNECTING).then((data) => {
expect(data == undefined).assertTrue();
}).catch((err) => {
expect(err.code == 29360210).assertTrue();
});
done();
} catch (e) {
console.info("testUpdateConnectStatus005 " + e);
expect(null).assertFail();
done();
}
})
/**
* @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UPDATECONNECTSTATUS_0600
* @tc.name [JS-API8]ContinuationManager.updateConnectStatus().
* @tc.desc Test Js Api ContinuationManager.updateConnectStatus() testcase 006
*/
it('testUpdateConnectStatus006', 0, async function(done) {
try {
continuationManager.updateConnectStatus(token, TEST_DEVICE_ID,
continuationManager.DeviceConnectState.DISCONNECTING).then((data) => {
expect(data == undefined).assertTrue();
}).catch((err) => {
expect(err.code == 29360210).assertTrue();
});
done();
} catch (e) {
console.info("testUpdateConnectStatus006 " + e);
expect(null).assertFail();
done();
}
})
})}
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import ContinuationManagerTest from './ContinuationManagerJsunit.test.js'
import continuationManagerTest from './ContinuationManagerJsunit.test.js'
export default function testsuite() {
ContinuationManagerTest()
continuationManagerTest()
}
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos_var.gni")
group("systemabilitymgr") {
testonly = true
if (is_standard_system) {
deps = [ "dmsfwk:dmsfwk" ]
}
}
......@@ -260,14 +260,16 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
expect(true).assertTrue();
})
function getTransferParam(iCmd, iReqType, iValue, iIndex) {
function getTransferParam(iCmd, iReqTarType, iReqType, iValue, iIndex) {
var tmpUint8Array = new Uint8Array(512);
var requestCmd = iCmd
var requestTargetType = iReqTarType
var requestType = iReqType
var value = iValue;
var index = iIndex;
var controlParam = {
request: requestCmd,
target: requestTargetType,
reqType: requestType,
value: value,
index: index,
......@@ -432,7 +434,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
var timeout = 5000;
var controlParam = getTransferParam(6, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7)
var controlParam = getTransferParam(6, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7)
| (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), (2 << 8), 0)
callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0540 GetDescriptor')
})
......@@ -456,7 +458,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
var timeout = 5000;
var controlParam = getTransferParam(0, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7)
var controlParam = getTransferParam(0, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7)
| (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0)
callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0550 GetStatus')
})
......@@ -480,7 +482,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
var timeout = 5000;
var controlParam = getTransferParam(8, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7)
var controlParam = getTransferParam(8, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7)
| (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0)
callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0560 GetConfiguration')
})
......@@ -504,7 +506,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
var timeout = 5000;
var controlParam = getTransferParam(10, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7)
var controlParam = getTransferParam(10, usb.USB_REQUEST_TARGET_INTERFACE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7)
| (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_INTERFACE & 0x1f), 0, 1)
callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0570 GetInterface')
})
......@@ -528,7 +530,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
var timeout = 5000;
var controlParam = getTransferParam(1, (usb.USB_REQUEST_DIR_TO_DEVICE << 7)
var controlParam = getTransferParam(1, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_TO_DEVICE << 7)
| (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0)
callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0580 ClearFeature')
})
......@@ -552,7 +554,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
var timeout = 5000;
var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7)
var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_INTERFACE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7)
| (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_INTERFACE & 0x1f), (2 << 8), 0)
callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0590 ClearFeature')
})
......@@ -576,7 +578,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
var timeout = 5000;
var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7)
var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_ENDPOINT, (usb.USB_REQUEST_DIR_TO_DEVICE << 7)
| (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_ENDPOINT & 0x1f), (2 << 8), 0)
callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0600 ClearFeature')
})
......@@ -584,7 +586,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
/**
* @tc.number : SUB_USB_JS_0610
* @tc.name : controlTransfer
* @tc.desc : 控制传输 ClearFeature: ccmd 255 reqType 5 value 512 index 0
* @tc.desc : 控制传输 ClearFeature: cmd 255 reqType 5 value 512 index 0
*/
it('SUB_USB_JS_0610', 0, function () {
console.info('usb SUB_USB_JS_0610 begin');
......@@ -600,7 +602,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
var timeout = 5000;
var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7)
var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_OTHER, (usb.USB_REQUEST_DIR_TO_DEVICE << 7)
| (usb.USB_REQUEST_TYPE_VENDOR << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), (2 << 8), 0)
callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0610 ClearFeature')
})
......@@ -624,7 +626,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () {
}
var timeout = 5000;
var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7)
var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_OTHER, (usb.USB_REQUEST_DIR_TO_DEVICE << 7)
| (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), 0, 0)
callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0620 ClearFeature')
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册