提交 83a69d8f 编写于 作者: L lidanyang16

<lidanyang16@huawei.com>

Signed-off-by: Nlidanyang16 <lidanyang16@huawei.com>
上级 3d8b6d69
...@@ -14,6 +14,14 @@ ...@@ -14,6 +14,14 @@
], ],
"type": "AppInstallKit", "type": "AppInstallKit",
"cleanup-apps": true "cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"uinput -T -m 594 2117 594 864 400",
"power-shell setmode 602"
]
} }
] ]
} }
\ No newline at end of file
...@@ -14,6 +14,14 @@ ...@@ -14,6 +14,14 @@
], ],
"type": "AppInstallKit", "type": "AppInstallKit",
"cleanup-apps": true "cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"uinput -T -m 594 2117 594 864 400",
"power-shell setmode 602"
]
} }
] ]
} }
\ No newline at end of file
...@@ -78,10 +78,10 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -78,10 +78,10 @@ describe("SensorJsTest_sensor_39", function () {
*/ */
it("newAccelerometer_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newAccelerometer_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('---------newAccelerometer_SensorJsTest001--------------'); console.info('---------newAccelerometer_SensorJsTest001--------------');
sensor.on(sensor.SensorId.ACCELEROMETER, callback); sensor.on(sensor.SensorId.ACCELEROMETER, callback);
setTimeout(()=>{ setTimeout(()=>{
sensor.off(sensor.SensorId.ACCELEROMETER); sensor.off(sensor.SensorId.ACCELEROMETER);
done(); done();
}, 1000); }, 1000);
}) })
...@@ -127,7 +127,7 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -127,7 +127,7 @@ describe("SensorJsTest_sensor_39", function () {
* @tc.name: newAccelerometer_SensorJsTest004 * @tc.name: newAccelerometer_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAccelerometer_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newAccelerometer_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newAccelerometer_SensorJsTest004--------------'); console.info('---------newAccelerometer_SensorJsTest004--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newAccelerometer_SensorJsTest004 callback in'); console.info('newAccelerometer_SensorJsTest004 callback in');
...@@ -190,7 +190,7 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -190,7 +190,7 @@ describe("SensorJsTest_sensor_39", function () {
* @tc.name: newAccelerometer_SensorJsTest007 * @tc.name: newAccelerometer_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAccelerometer_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newAccelerometer_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newAccelerometer_SensorJsTest007 on error'); console.info('newAccelerometer_SensorJsTest007 on error');
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
...@@ -232,13 +232,14 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -232,13 +232,14 @@ describe("SensorJsTest_sensor_39", function () {
it("newAccelerometer_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAccelerometer_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newAccelerometer_SensorJsTest009 callback in' + JSON.stringify(data)); console.info('newAccelerometer_SensorJsTest009 callback in' + JSON.stringify(data));
expect(false).assertTrue(); expect(typeof (data.x)).assertEqual("number");
done(); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
} }
sensor.on(sensor.SensorId.ACCELEROMETER, onSensorCallback); sensor.on(sensor.SensorId.ACCELEROMETER, onSensorCallback);
sensor.off(sensor.SensorId.ACCELEROMETER, onSensorCallback);
setTimeout(()=>{ setTimeout(()=>{
expect(true).assertTrue(); sensor.off(sensor.SensorId.ACCELEROMETER, onSensorCallback);
done(); done();
}, 1000); }, 1000);
}) })
...@@ -297,7 +298,7 @@ describe("SensorJsTest_sensor_39", function () { ...@@ -297,7 +298,7 @@ describe("SensorJsTest_sensor_39", function () {
* @tc.name: newAccelerometer_SensorJsTest012 * @tc.name: newAccelerometer_SensorJsTest012
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAccelerometer_SensorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newAccelerometer_SensorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
try { try {
sensor.off(sensor.SensorId.ACCELEROMETER, 5); sensor.off(sensor.SensorId.ACCELEROMETER, 5);
} catch (error) { } catch (error) {
......
...@@ -151,7 +151,7 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -151,7 +151,7 @@ describe("SensorJsTest_sensor_41", function () {
* @tc.name: newAmbient_Light_SensorJsTest004 * @tc.name: newAmbient_Light_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAmbient_Light_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newAmbient_Light_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newAmbient_Light_SensorJsTest004--------------'); console.info('---------newAmbient_Light_SensorJsTest004--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newAmbient_Light_SensorJsTest004 callback in'); console.info('newAmbient_Light_SensorJsTest004 callback in');
...@@ -234,7 +234,7 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -234,7 +234,7 @@ describe("SensorJsTest_sensor_41", function () {
* @tc.name: newAmbient_Light_SensorJsTest007 * @tc.name: newAmbient_Light_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAmbient_Light_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newAmbient_Light_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newAmbient_Light_SensorJsTest007 on error'); console.info('newAmbient_Light_SensorJsTest007 on error');
expect(typeof (data.intensity)).assertEqual("number"); expect(typeof (data.intensity)).assertEqual("number");
...@@ -282,8 +282,8 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -282,8 +282,8 @@ describe("SensorJsTest_sensor_41", function () {
it("newAmbient_Light_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newAmbient_Light_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newAmbient_Light_SensorJsTest009 callback in'); console.info('newAmbient_Light_SensorJsTest009 callback in');
expect(false).assertTrue(); expect(typeof (data.intensity)).assertEqual("number");
done(); expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
...@@ -292,9 +292,8 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -292,9 +292,8 @@ describe("SensorJsTest_sensor_41", function () {
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.AMBIENT_LIGHT, onSensorCallback); sensor.on(sensor.SensorId.AMBIENT_LIGHT, onSensorCallback);
sensor.off(sensor.SensorId.AMBIENT_LIGHT, onSensorCallback);
setTimeout(()=>{ setTimeout(()=>{
expect(true).assertTrue(); sensor.off(sensor.SensorId.AMBIENT_LIGHT, onSensorCallback);
done(); done();
}, 500); }, 500);
} }
...@@ -759,7 +758,7 @@ describe("SensorJsTest_sensor_41", function () { ...@@ -759,7 +758,7 @@ describe("SensorJsTest_sensor_41", function () {
* @tc.name: newAmbient_Light_SensorJsTest023 * @tc.name: newAmbient_Light_SensorJsTest023
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newAmbient_Light_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newAmbient_Light_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newAmbient_Light_SensorJsTest023--------------'); console.info('---------newAmbient_Light_SensorJsTest023--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorId.AMBIENT_LIGHT,(error, data) => {
......
...@@ -152,7 +152,7 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -152,7 +152,7 @@ describe("SensorJsTest_sensor_53", function () {
* @tc.name: newBarometer_SensorJsTest004 * @tc.name: newBarometer_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newBarometer_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newBarometer_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newBarometer_SensorJsTest004--------------'); console.info('---------newBarometer_SensorJsTest004--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newBarometer_SensorJsTest004 callback in'); console.info('newBarometer_SensorJsTest004 callback in');
...@@ -235,7 +235,7 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -235,7 +235,7 @@ describe("SensorJsTest_sensor_53", function () {
* @tc.name: newBarometer_SensorJsTest007 * @tc.name: newBarometer_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newBarometer_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newBarometer_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newBarometer_SensorJsTest007 on error'); console.info('newBarometer_SensorJsTest007 on error');
expect(typeof (data.pressure)).assertEqual("number"); expect(typeof (data.pressure)).assertEqual("number");
...@@ -283,8 +283,8 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -283,8 +283,8 @@ describe("SensorJsTest_sensor_53", function () {
it("newBarometer_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newBarometer_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newBarometer_SensorJsTest009 callback in'); console.info('newBarometer_SensorJsTest009 callback in');
expect(false).assertTrue(); expect(typeof (data.pressure)).assertEqual("number");
done(); expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
...@@ -293,9 +293,8 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -293,9 +293,8 @@ describe("SensorJsTest_sensor_53", function () {
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.BAROMETER, onSensorCallback); sensor.on(sensor.SensorId.BAROMETER, onSensorCallback);
sensor.off(sensor.SensorId.BAROMETER, onSensorCallback);
setTimeout(()=>{ setTimeout(()=>{
expect(true).assertTrue(); sensor.off(sensor.SensorId.BAROMETER, onSensorCallback);
done(); done();
}, 500); }, 500);
} }
...@@ -759,7 +758,7 @@ describe("SensorJsTest_sensor_53", function () { ...@@ -759,7 +758,7 @@ describe("SensorJsTest_sensor_53", function () {
* @tc.name: newBarometer_SensorJsTest023 * @tc.name: newBarometer_SensorJsTest023
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newBarometer_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newBarometer_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newBarometer_SensorJsTest023--------------'); console.info('---------newBarometer_SensorJsTest023--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorId.BAROMETER,(error, data) => {
......
...@@ -178,7 +178,7 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -178,7 +178,7 @@ describe("SensorJsTest_sensor_42", function () {
* @tc.name: newGravity_SensorJsTest005 * @tc.name: newGravity_SensorJsTest005
* @tc.desc: Functional Use Cases * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newGravity_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGravity_SensorJsTest005--------------'); console.info('---------newGravity_SensorJsTest005--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newGravity_SensorJsTest005 callback in'); console.info('newGravity_SensorJsTest005 callback in');
...@@ -263,7 +263,7 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -263,7 +263,7 @@ describe("SensorJsTest_sensor_42", function () {
* @tc.name: newGravity_SensorJsTest008 * @tc.name: newGravity_SensorJsTest008
* @tc.desc: Functional Use Cases * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newGravity_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newGravity_SensorJsTest008 on error'); console.info('newGravity_SensorJsTest008 on error');
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
...@@ -313,8 +313,10 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -313,8 +313,10 @@ describe("SensorJsTest_sensor_42", function () {
it("newGravity_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGravity_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newGravity_SensorJsTest010 callback in'); console.info('newGravity_SensorJsTest010 callback in');
expect(false).assertTrue(); expect(typeof (data.x)).assertEqual("number");
done(); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
...@@ -323,9 +325,8 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -323,9 +325,8 @@ describe("SensorJsTest_sensor_42", function () {
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GRAVITY, onSensorCallback); sensor.on(sensor.SensorId.GRAVITY, onSensorCallback);
sensor.off(sensor.SensorId.GRAVITY, onSensorCallback);
setTimeout(()=>{ setTimeout(()=>{
expect(true).assertTrue(); sensor.off(sensor.SensorId.GRAVITY, onSensorCallback);
done(); done();
}, 500); }, 500);
} }
...@@ -787,7 +788,7 @@ describe("SensorJsTest_sensor_42", function () { ...@@ -787,7 +788,7 @@ describe("SensorJsTest_sensor_42", function () {
* @tc.name: newGravity_SensorJsTest024 * @tc.name: newGravity_SensorJsTest024
* @tc.desc: Functional Use Cases * @tc.desc: Functional Use Cases
*/ */
it("newGravity_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newGravity_SensorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGravity_SensorJsTest024--------------'); console.info('---------newGravity_SensorJsTest024--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GRAVITY,(error, data) => {
......
...@@ -155,7 +155,7 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -155,7 +155,7 @@ describe("SensorJsTest_sensor_43", function () {
* @tc.name: newGyroScope_SensorJsTest004 * @tc.name: newGyroScope_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newGyroScope_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newGyroScope_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGyroScope_SensorJsTest004--------------'); console.info('---------newGyroScope_SensorJsTest004--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newGyroScope_SensorJsTest004 callback in'); console.info('newGyroScope_SensorJsTest004 callback in');
...@@ -240,7 +240,7 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -240,7 +240,7 @@ describe("SensorJsTest_sensor_43", function () {
* @tc.name: newGyroScope_SensorJsTest007 * @tc.name: newGyroScope_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newGyroScope_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newGyroScope_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newGyroScope_SensorJsTest007 on error'); console.info('newGyroScope_SensorJsTest007 on error');
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
...@@ -290,8 +290,10 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -290,8 +290,10 @@ describe("SensorJsTest_sensor_43", function () {
it("newGyroScope_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newGyroScope_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newGyroScope_SensorJsTest009 callback in'); console.info('newGyroScope_SensorJsTest009 callback in');
expect(false).assertTrue(); expect(typeof (data.x)).assertEqual("number");
done(); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
...@@ -300,9 +302,8 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -300,9 +302,8 @@ describe("SensorJsTest_sensor_43", function () {
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.GYROSCOPE, onSensorCallback); sensor.on(sensor.SensorId.GYROSCOPE, onSensorCallback);
sensor.off(sensor.SensorId.GYROSCOPE, onSensorCallback);
setTimeout(()=>{ setTimeout(()=>{
expect(true).assertTrue(); sensor.off(sensor.SensorId.GYROSCOPE, onSensorCallback);
done(); done();
}, 500); }, 500);
} }
...@@ -778,7 +779,7 @@ describe("SensorJsTest_sensor_43", function () { ...@@ -778,7 +779,7 @@ describe("SensorJsTest_sensor_43", function () {
* @tc.name: newGyroScope_SensorJsTest023 * @tc.name: newGyroScope_SensorJsTest023
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newGyroScope_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newGyroScope_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newGyroScope_SensorJsTest023--------------'); console.info('---------newGyroScope_SensorJsTest023--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorId.GYROSCOPE,(error, data) => {
......
...@@ -151,7 +151,7 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -151,7 +151,7 @@ describe("SensorJsTest_sensor_45", function () {
* @tc.name: newHall_SensorJsTest004 * @tc.name: newHall_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newHall_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newHall_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newHall_SensorJsTest004--------------'); console.info('---------newHall_SensorJsTest004--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newHall_SensorJsTest004 callback in'); console.info('newHall_SensorJsTest004 callback in');
...@@ -234,7 +234,7 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -234,7 +234,7 @@ describe("SensorJsTest_sensor_45", function () {
* @tc.name: newHall_SensorJsTest007 * @tc.name: newHall_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newHall_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newHall_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newHall_SensorJsTest007 on error'); console.info('newHall_SensorJsTest007 on error');
expect(typeof (data.status)).assertEqual("number"); expect(typeof (data.status)).assertEqual("number");
...@@ -282,8 +282,8 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -282,8 +282,8 @@ describe("SensorJsTest_sensor_45", function () {
it("newHall_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newHall_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newHall_SensorJsTest009 callback in'); console.info('newHall_SensorJsTest009 callback in');
expect(false).assertTrue(); expect(typeof (data.status)).assertEqual("number");
done(); expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
...@@ -292,9 +292,8 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -292,9 +292,8 @@ describe("SensorJsTest_sensor_45", function () {
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.HALL, onSensorCallback); sensor.on(sensor.SensorId.HALL, onSensorCallback);
sensor.off(sensor.SensorId.HALL, onSensorCallback);
setTimeout(()=>{ setTimeout(()=>{
expect(true).assertTrue(); sensor.off(sensor.SensorId.HALL, onSensorCallback);
done(); done();
}, 500); }, 500);
} }
...@@ -758,7 +757,7 @@ describe("SensorJsTest_sensor_45", function () { ...@@ -758,7 +757,7 @@ describe("SensorJsTest_sensor_45", function () {
* @tc.name: newHall_SensorJsTest023 * @tc.name: newHall_SensorJsTest023
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newHall_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newHall_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newHall_SensorJsTest023--------------'); console.info('---------newHall_SensorJsTest023--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorId.HALL,(error, data) => {
......
...@@ -178,7 +178,7 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -178,7 +178,7 @@ describe("SensorJsTest_sensor_37", function () {
* @tc.name: newMagneticField_SensorJsTest005 * @tc.name: newMagneticField_SensorJsTest005
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newMagneticField_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newMagneticField_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newMagneticField_SensorJsTest005--------------'); console.info('---------newMagneticField_SensorJsTest005--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newMagneticField_SensorJsTest005 callback in'); console.info('newMagneticField_SensorJsTest005 callback in');
...@@ -263,7 +263,7 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -263,7 +263,7 @@ describe("SensorJsTest_sensor_37", function () {
* @tc.name: newMagneticField_SensorJsTest008 * @tc.name: newMagneticField_SensorJsTest008
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newMagneticField_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newMagneticField_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newMagneticField_SensorJsTest008 on error'); console.info('newMagneticField_SensorJsTest008 on error');
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
...@@ -313,8 +313,10 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -313,8 +313,10 @@ describe("SensorJsTest_sensor_37", function () {
it("newMagneticField_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newMagneticField_SensorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newMagneticField_SensorJsTest010 callback in'); console.info('newMagneticField_SensorJsTest010 callback in');
expect(false).assertTrue(); expect(typeof (data.x)).assertEqual("number");
done(); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
...@@ -323,9 +325,8 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -323,9 +325,8 @@ describe("SensorJsTest_sensor_37", function () {
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.MAGNETIC_FIELD, onSensorCallback); sensor.on(sensor.SensorId.MAGNETIC_FIELD, onSensorCallback);
sensor.off(sensor.SensorId.MAGNETIC_FIELD, onSensorCallback);
setTimeout(()=>{ setTimeout(()=>{
expect(true).assertTrue(); sensor.off(sensor.SensorId.MAGNETIC_FIELD, onSensorCallback);
done(); done();
}, 500); }, 500);
} }
...@@ -764,7 +765,7 @@ describe("SensorJsTest_sensor_37", function () { ...@@ -764,7 +765,7 @@ describe("SensorJsTest_sensor_37", function () {
* @tc.name: newMagneticField_SensorJsTest023 * @tc.name: newMagneticField_SensorJsTest023
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newMagneticField_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newMagneticField_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newMagneticField_SensorJsTest023--------------'); console.info('---------newMagneticField_SensorJsTest023--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorId.MAGNETIC_FIELD,(error, data) => {
......
...@@ -155,7 +155,7 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -155,7 +155,7 @@ describe("SensorJsTest_sensor_48", function () {
* @tc.name: newOrientating_SensorJsTest004 * @tc.name: newOrientating_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newOrientating_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newOrientating_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newOrientating_SensorJsTest004--------------'); console.info('---------newOrientating_SensorJsTest004--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newOrientating_SensorJsTest004 callback in'); console.info('newOrientating_SensorJsTest004 callback in');
...@@ -240,7 +240,7 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -240,7 +240,7 @@ describe("SensorJsTest_sensor_48", function () {
* @tc.name: newOrientating_SensorJsTest007 * @tc.name: newOrientating_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newOrientating_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newOrientating_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newOrientating_SensorJsTest007 on error'); console.info('newOrientating_SensorJsTest007 on error');
expect(typeof(data.beta)).assertEqual("number"); expect(typeof(data.beta)).assertEqual("number");
...@@ -290,8 +290,10 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -290,8 +290,10 @@ describe("SensorJsTest_sensor_48", function () {
it("newOrientating_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newOrientating_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newOrientating_SensorJsTest009 callback in'); console.info('newOrientating_SensorJsTest009 callback in');
expect(false).assertTrue(); expect(typeof(data.beta)).assertEqual("number");
done(); expect(typeof(data.gamma)).assertEqual("number");
expect(typeof(data.alpha)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
...@@ -300,9 +302,8 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -300,9 +302,8 @@ describe("SensorJsTest_sensor_48", function () {
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ORIENTATION, onSensorCallback); sensor.on(sensor.SensorId.ORIENTATION, onSensorCallback);
sensor.off(sensor.SensorId.ORIENTATION, onSensorCallback);
setTimeout(()=>{ setTimeout(()=>{
expect(true).assertTrue(); sensor.off(sensor.SensorId.ORIENTATION, onSensorCallback);
done(); done();
}, 500); }, 500);
} }
...@@ -767,7 +768,7 @@ describe("SensorJsTest_sensor_48", function () { ...@@ -767,7 +768,7 @@ describe("SensorJsTest_sensor_48", function () {
* @tc.name: newOrientating_SensorJsTest023 * @tc.name: newOrientating_SensorJsTest023
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newOrientating_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newOrientating_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newOrientating_SensorJsTest023--------------'); console.info('---------newOrientating_SensorJsTest023--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ORIENTATION,(error, data) => {
......
...@@ -35,7 +35,25 @@ const PARAMETER_ERROR_MSG = 'The parameter invalid.' ...@@ -35,7 +35,25 @@ const PARAMETER_ERROR_MSG = 'The parameter invalid.'
const PERMISSION_DENIED_MSG = 'Permission denied.' const PERMISSION_DENIED_MSG = 'Permission denied.'
let tokenID = undefined let tokenID = undefined
let permissionNameUser = 'ohos.permission.ACTIVITY_MOTION' let permissionNameUser = 'ohos.permission.ACTIVITY_MOTION'
async function grantPerm(){
try {
let accountManager = osAccount.getAccountManager();
let userId = await accountManager.getOsAccountLocalIdFromProcess();
console.info("SensorJsTest_sensor_57 userId:"+userId)
console.info("============SensorJsTest_sensor_57 grant Permission start ============")
var appInfo = await bundle.getApplicationInfo('ohos.acts.sensors.sensor.function', 0, userId);
tokenID = appInfo.accessTokenId;
console.log('SensorJsTest_sensor_57 accessTokenId:' + appInfo.accessTokenId + ', name:' + appInfo.name +
' ,bundleName:' + appInfo.process)
var atManager = abilityAccessCtrl.createAtManager();
var result = await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
console.info('SensorJsTest_sensor_57 successful. result: ' + JSON.stringify(result));
console.info("============SensorJsTest_sensor_57 grant Permission end ============")
} catch(error) {
console.error('SensorJsTest_sensor_57 exception in, msg:' + JSON.stringify(error))
}
}
describe("SensorJsTest_sensor_57", function () { describe("SensorJsTest_sensor_57", function () {
function callback(data) { function callback(data) {
console.info('callback success' + JSON.stringify(data)); console.info('callback success' + JSON.stringify(data));
...@@ -47,36 +65,34 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -47,36 +65,34 @@ describe("SensorJsTest_sensor_57", function () {
expect(typeof(data.scalar)).assertEqual('number'); expect(typeof(data.scalar)).assertEqual('number');
} }
beforeAll(async function() { beforeAll(async function(done) {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll called') console.info('beforeAll called')
try { await grantPerm();
let accountManager = osAccount.getAccountManager(); done();
let userId = await accountManager.getOsAccountLocalIdFromProcess();
let appInfo = await bundle.getApplicationInfo('ohos.acts.sensors.sensor.function', 0, userId);
tokenID = appInfo.accessTokenId;
console.log('AccessTokenId accessTokenId:' + appInfo.accessTokenId + ', name:' + appInfo.name +
' ,bundleName:' + appInfo.process)
console.info('successful. Data: ' + JSON.stringify(appInfo));
} catch(error) {
console.error('exception in, msg:' + JSON.stringify(error))
}
}) })
afterAll(function() { afterAll(function() {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll called') console.info('afterAll called')
let atManager = abilityAccessCtrl.createAtManager();
atManager.revokeUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.catch((error) => {
console.info('SensorJsTest_sensor_57 error:' + JSON.stringify(error));
expect(error.code).assertEqual(ERR_NOT_HAVE_PERMISSION);
})
}) })
beforeEach(function() { beforeEach(function() {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach called') console.info('beforeEach called')
}) })
afterEach(function() { afterEach(function() {
...@@ -84,13 +100,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -84,13 +100,6 @@ describe("SensorJsTest_sensor_57", function () {
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach called') console.info('afterEach called')
let atManager = abilityAccessCtrl.createAtManager();
atManager.revokeUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.catch((error) => {
console.info('error:' + JSON.stringify(error));
expect(error.code).assertEqual(ERR_NOT_HAVE_PERMISSION);
})
}) })
/* /*
...@@ -100,10 +109,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -100,10 +109,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newPedometerDetection_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest001---------------------------'); console.info('----------------------newPedometerDetection_SensorJsTest001---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -130,11 +135,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -130,11 +135,6 @@ describe("SensorJsTest_sensor_57", function () {
done(); done();
} }
}) })
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest001 error:' + JSON.stringify(error));
done();
})
})
/* /*
* @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0020 * @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0020
...@@ -143,10 +143,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -143,10 +143,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest002---------------------------'); console.info('----------------------newPedometerDetection_SensorJsTest002---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -170,11 +166,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -170,11 +166,6 @@ describe("SensorJsTest_sensor_57", function () {
done(); done();
} }
}) })
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest002 error:' + JSON.stringify(error));
done();
})
})
/* /*
* @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0030 * @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0030
...@@ -183,10 +174,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -183,10 +174,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest003---------------------------'); console.info('----------------------newPedometerDetection_SensorJsTest003---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -213,11 +200,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -213,11 +200,6 @@ describe("SensorJsTest_sensor_57", function () {
done(); done();
} }
}) })
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest003 error:' + JSON.stringify(error));
done();
})
})
/* /*
* @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0040 * @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0040
...@@ -226,10 +208,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -226,10 +208,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest004---------------------------'); console.info('----------------------newPedometerDetection_SensorJsTest004---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -256,11 +234,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -256,11 +234,6 @@ describe("SensorJsTest_sensor_57", function () {
done(); done();
} }
}) })
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest004 error:' + JSON.stringify(error));
done();
})
})
/* /*
* @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0050 * @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0050
...@@ -269,10 +242,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -269,10 +242,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest005---------------------------'); console.info('----------------------newPedometerDetection_SensorJsTest005---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -296,11 +265,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -296,11 +265,6 @@ describe("SensorJsTest_sensor_57", function () {
done(); done();
} }
}) })
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest005 error:' + JSON.stringify(error));
done();
})
})
/* /*
* @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0060 * @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0060
...@@ -309,10 +273,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -309,10 +273,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest006---------------------------'); console.info('----------------------newPedometerDetection_SensorJsTest006---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -335,11 +295,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -335,11 +295,6 @@ describe("SensorJsTest_sensor_57", function () {
done(); done();
} }
}) })
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest006 error:' + JSON.stringify(error));
done();
})
})
/* /*
* @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0070 * @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0070
...@@ -348,10 +303,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -348,10 +303,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest007---------------------------'); console.info('----------------------newPedometerDetection_SensorJsTest007---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -379,11 +330,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -379,11 +330,6 @@ describe("SensorJsTest_sensor_57", function () {
done(); done();
} }
}) })
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest007 error:' + JSON.stringify(error));
done();
})
})
/* /*
* @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0080 * @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0080
...@@ -392,10 +338,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -392,10 +338,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest008---------------------------'); console.info('----------------------newPedometerDetection_SensorJsTest008---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -426,11 +368,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -426,11 +368,6 @@ describe("SensorJsTest_sensor_57", function () {
done(); done();
} }
}) })
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest008 error:' + JSON.stringify(error));
done();
})
})
/* /*
* @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0090 * @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0090
...@@ -439,10 +376,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -439,10 +376,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest009---------------------------'); console.info('----------------------newPedometerDetection_SensorJsTest009---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -470,11 +403,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -470,11 +403,6 @@ describe("SensorJsTest_sensor_57", function () {
done(); done();
} }
}) })
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest009 error:' + JSON.stringify(error));
done();
})
})
/* /*
* @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0100 * @tc.number: SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0100
...@@ -491,7 +419,10 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -491,7 +419,10 @@ describe("SensorJsTest_sensor_57", function () {
done(); done();
} }
try { try {
sensor.on(sensor.SensorId.PEDOMETER_DETECTION, callback); sensor.on(sensor.SensorId.PEDOMETER_DETECTION, callback);
setTimeout(() => {
done();
}, 4000);
} catch (error) { } catch (error) {
console.error('newPedometerDetection_SensorJsTest010 On fail, errorCode:' +JSON.stringify(error)); console.error('newPedometerDetection_SensorJsTest010 On fail, errorCode:' +JSON.stringify(error));
expect(error.code).assertEqual(PERMISSION_DENIED_CODE); expect(error.code).assertEqual(PERMISSION_DENIED_CODE);
...@@ -516,10 +447,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -516,10 +447,6 @@ describe("SensorJsTest_sensor_57", function () {
console.info('--------newPedometerDetection_SensorJsTest011--------'); console.info('--------newPedometerDetection_SensorJsTest011--------');
let errorMessage = "" let errorMessage = ""
let errorMessages = "ReferenceError: xxx is not defined" let errorMessages = "ReferenceError: xxx is not defined"
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -552,12 +479,8 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -552,12 +479,8 @@ describe("SensorJsTest_sensor_57", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
}) })
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest011 error:' + JSON.stringify(error));
done();
})
})
/* /*
* @tc.number:SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0120 * @tc.number:SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0120
* @tc.name: newPedometerDetection_SensorJsTest012 * @tc.name: newPedometerDetection_SensorJsTest012
...@@ -565,10 +488,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -565,10 +488,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest012--------'); console.info('--------newPedometerDetection_SensorJsTest012--------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -595,11 +514,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -595,11 +514,6 @@ describe("SensorJsTest_sensor_57", function () {
done(); done();
} }
}) })
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest012 error:' + JSON.stringify(error));
done();
})
})
/* /*
* @tc.number:SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0130 * @tc.number:SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0130
...@@ -608,10 +522,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -608,10 +522,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest013--------'); console.info('--------newPedometerDetection_SensorJsTest013--------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -637,12 +547,7 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -637,12 +547,7 @@ describe("SensorJsTest_sensor_57", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
}) })
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest013 error:' + JSON.stringify(error));
done();
})
})
/* /*
* @tc.number:SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0140 * @tc.number:SUB_SensorsSystem_NEWPEDOMETER_DETECTION_JSTest_0140
...@@ -651,10 +556,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -651,10 +556,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest014--------'); console.info('--------newPedometerDetection_SensorJsTest014--------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -664,12 +565,12 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -664,12 +565,12 @@ describe("SensorJsTest_sensor_57", function () {
} }
try { try {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newPedometerDetection_SensorJsTest014 on error'); console.info('newPedometerDetection_SensorJsTest014 callback:'+JSON.stringify(data));
expect(typeof(data.scalar)).assertEqual('number'); expect(typeof(data.scalar)).assertEqual('number');
} }
sensor.on(sensor.SensorId.PEDOMETER_DETECTION, onSensorCallback, {'interval': 100000000}); sensor.on(sensor.SensorId.PEDOMETER_DETECTION, onSensorCallback, {'interval': 100000000});
sensor.off(sensor.SensorId.PEDOMETER_DETECTION);
setTimeout(() => { setTimeout(() => {
sensor.off(sensor.SensorId.PEDOMETER_DETECTION);
done(); done();
}, 4000); }, 4000);
} catch (error) { } catch (error) {
...@@ -684,11 +585,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -684,11 +585,6 @@ describe("SensorJsTest_sensor_57", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest014 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -698,10 +594,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -698,10 +594,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest015---------------------------'); console.info('----------------------newPedometerDetection_SensorJsTest015---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -724,11 +616,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -724,11 +616,6 @@ describe("SensorJsTest_sensor_57", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest015 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -738,10 +625,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -738,10 +625,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest016--------'); console.info('--------newPedometerDetection_SensorJsTest016--------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -777,11 +660,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -777,11 +660,6 @@ describe("SensorJsTest_sensor_57", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest016 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -791,10 +669,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -791,10 +669,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------newPedometerDetection_SensorJsTest017--------'); console.info('--------newPedometerDetection_SensorJsTest017--------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -821,11 +695,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -821,11 +695,6 @@ describe("SensorJsTest_sensor_57", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest017 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -835,10 +704,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -835,10 +704,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("newPedometerDetection_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest018---------------------------'); console.info('----------------------newPedometerDetection_SensorJsTest018---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -864,11 +729,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -864,11 +729,6 @@ describe("SensorJsTest_sensor_57", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest018 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -878,10 +738,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -878,10 +738,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest019---------------------------'); console.info('----------------------newPedometerDetection_SensorJsTest019---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -908,11 +764,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -908,11 +764,6 @@ describe("SensorJsTest_sensor_57", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest019 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -922,10 +773,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -922,10 +773,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest020---------------------------'); console.info('----------------------newPedometerDetection_SensorJsTest020---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -955,11 +802,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -955,11 +802,6 @@ describe("SensorJsTest_sensor_57", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest020 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -969,10 +811,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -969,10 +811,6 @@ describe("SensorJsTest_sensor_57", function () {
*/ */
it("newPedometerDetection_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------newPedometerDetection_SensorJsTest021---------------------------'); console.info('----------------------newPedometerDetection_SensorJsTest021---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -1003,11 +841,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -1003,11 +841,6 @@ describe("SensorJsTest_sensor_57", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest021 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -1016,10 +849,6 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -1016,10 +849,6 @@ describe("SensorJsTest_sensor_57", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newPedometerDetection_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newPedometerDetection_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorId.PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -1045,10 +874,5 @@ describe("SensorJsTest_sensor_57", function () { ...@@ -1045,10 +874,5 @@ describe("SensorJsTest_sensor_57", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('newPedometerDetection_SensorJsTest022 error:' + JSON.stringify(error));
done();
})
}) })
})} })}
...@@ -157,7 +157,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -157,7 +157,7 @@ describe("SensorJsTest_sensor_49", function () {
* @tc.name: newRotatingVector_SensorJsTest004 * @tc.name: newRotatingVector_SensorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newRotatingVector_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newRotatingVector_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newRotatingVector_SensorJsTest004--------------'); console.info('---------newRotatingVector_SensorJsTest004--------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newRotatingVector_SensorJsTest004 callback in'); console.info('newRotatingVector_SensorJsTest004 callback in');
...@@ -242,7 +242,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -242,7 +242,7 @@ describe("SensorJsTest_sensor_49", function () {
* @tc.name: newRotatingVector_SensorJsTest007 * @tc.name: newRotatingVector_SensorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newRotatingVector_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newRotatingVector_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onceSensorCallback(data) { function onceSensorCallback(data) {
console.info('newRotatingVector_SensorJsTest007 on error'); console.info('newRotatingVector_SensorJsTest007 on error');
expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.x)).assertEqual("number");
...@@ -293,8 +293,11 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -293,8 +293,11 @@ describe("SensorJsTest_sensor_49", function () {
it("newRotatingVector_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("newRotatingVector_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('newRotatingVector_SensorJsTest009 callback in'); console.info('newRotatingVector_SensorJsTest009 callback in');
expect(false).assertTrue(); expect(typeof (data.x)).assertEqual("number");
done(); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.w)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
...@@ -303,9 +306,8 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -303,9 +306,8 @@ describe("SensorJsTest_sensor_49", function () {
} else { } else {
expect(typeof(data)).assertEqual("object"); expect(typeof(data)).assertEqual("object");
sensor.on(sensor.SensorId.ROTATION_VECTOR, onSensorCallback); sensor.on(sensor.SensorId.ROTATION_VECTOR, onSensorCallback);
sensor.off(sensor.SensorId.ROTATION_VECTOR, onSensorCallback);
setTimeout(()=>{ setTimeout(()=>{
expect(true).assertTrue(); sensor.off(sensor.SensorId.ROTATION_VECTOR, onSensorCallback);
done(); done();
}, 500); }, 500);
} }
...@@ -787,7 +789,7 @@ describe("SensorJsTest_sensor_49", function () { ...@@ -787,7 +789,7 @@ describe("SensorJsTest_sensor_49", function () {
* @tc.name: newRotatingVector_SensorJsTest023 * @tc.name: newRotatingVector_SensorJsTest023
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("newRotatingVector_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("newRotatingVector_SensorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------newRotatingVector_SensorJsTest023--------------'); console.info('---------newRotatingVector_SensorJsTest023--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorId.ROTATION_VECTOR,(error, data) => {
......
...@@ -190,13 +190,14 @@ describe("SensorJsTest_sensor_3", function () { ...@@ -190,13 +190,14 @@ describe("SensorJsTest_sensor_3", function () {
console.info('----------------------Accelerometer_SensorJsTest007---------------------------'); console.info('----------------------Accelerometer_SensorJsTest007---------------------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('Accelerometer_SensorJsTest007 on error'); console.info('Accelerometer_SensorJsTest007 on error');
expect(false).assertTrue(); expect(typeof (data.x)).assertEqual("number");
done(); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
} }
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, onSensorCallback); sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, onSensorCallback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, onSensorCallback);
setTimeout(() => { setTimeout(() => {
expect(true).assertTrue(); sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, onSensorCallback);
done(); done();
}, 500); }, 500);
}) })
......
...@@ -230,15 +230,14 @@ describe("SensorJsTest_sensor_4", function () { ...@@ -230,15 +230,14 @@ describe("SensorJsTest_sensor_4", function () {
console.info('----------------------Ambient_Light_SensorJsTest007---------------------------'); console.info('----------------------Ambient_Light_SensorJsTest007---------------------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('Ambient_Light_SensorJsTest007 on error'); console.info('Ambient_Light_SensorJsTest007 on error');
expect(false).assertTrue(); expect(typeof (data.intensity)).assertEqual("number");
done(); expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT,(error, data) => {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, onSensorCallback); sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, onSensorCallback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, onSensorCallback);
setTimeout(() => { setTimeout(() => {
expect(true).assertTrue(); sensor.off(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, onSensorCallback);
done(); done();
}, 500); }, 500);
}) })
...@@ -547,7 +546,7 @@ describe("SensorJsTest_sensor_4", function () { ...@@ -547,7 +546,7 @@ describe("SensorJsTest_sensor_4", function () {
* @tc.name: Ambient_Light_SensorJsTest017 * @tc.name: Ambient_Light_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("Ambient_Light_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("Ambient_Light_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------Ambient_Light_SensorJsTest017--------------'); console.info('---------Ambient_Light_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT,(error, data) => {
......
...@@ -232,15 +232,14 @@ describe("SensorJsTest_sensor_8", function () { ...@@ -232,15 +232,14 @@ describe("SensorJsTest_sensor_8", function () {
console.info('----------------------Barometer_SensorJsTest007---------------------------'); console.info('----------------------Barometer_SensorJsTest007---------------------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('Barometer_SensorJsTest007 on error'); console.info('Barometer_SensorJsTest007 on error');
expect(false).assertTrue(); expect(typeof (data.pressure)).assertEqual("number");
done(); expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER,(error, data) => {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, onSensorCallback); sensor.on(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, onSensorCallback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, onSensorCallback);
setTimeout(() => { setTimeout(() => {
expect(true).assertTrue(); sensor.off(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER, onSensorCallback);
done(); done();
}, 500); }, 500);
}) })
...@@ -549,7 +548,7 @@ describe("SensorJsTest_sensor_8", function () { ...@@ -549,7 +548,7 @@ describe("SensorJsTest_sensor_8", function () {
* @tc.name: Barometer_SensorJsTest017 * @tc.name: Barometer_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("Barometer_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("Barometer_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------Barometer_SensorJsTest017--------------'); console.info('---------Barometer_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_BAROMETER,(error, data) => {
......
...@@ -238,15 +238,16 @@ describe("SensorJsTest_sensor_9", function () { ...@@ -238,15 +238,16 @@ describe("SensorJsTest_sensor_9", function () {
console.info('----------------------Gravity_SensorJsTest007---------------------------'); console.info('----------------------Gravity_SensorJsTest007---------------------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('Gravity_SensorJsTest007 on error'); console.info('Gravity_SensorJsTest007 on error');
expect(false).assertTrue(); expect(typeof (data.x)).assertEqual("number");
done(); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY,(error, data) => {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, onSensorCallback); sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, onSensorCallback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, onSensorCallback);
setTimeout(() => { setTimeout(() => {
expect(true).assertTrue(); sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, onSensorCallback);
done(); done();
}, 500); }, 500);
}) })
...@@ -555,7 +556,7 @@ describe("SensorJsTest_sensor_9", function () { ...@@ -555,7 +556,7 @@ describe("SensorJsTest_sensor_9", function () {
* @tc.name: Gravity_SensorJsTest017 * @tc.name: Gravity_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("Gravity_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("Gravity_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------Gravity_SensorJsTest017--------------'); console.info('---------Gravity_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY,(error, data) => {
......
...@@ -238,15 +238,16 @@ describe("SensorJsTest_sensor_5", function () { ...@@ -238,15 +238,16 @@ describe("SensorJsTest_sensor_5", function () {
console.info('----------------------Gyroscope_SensorJsTest007---------------------------'); console.info('----------------------Gyroscope_SensorJsTest007---------------------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('Gyroscope_SensorJsTest007 on error'); console.info('Gyroscope_SensorJsTest007 on error');
expect(false).assertTrue(); expect(typeof (data.x)).assertEqual("number");
done(); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE,(error, data) => {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, onSensorCallback); sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, onSensorCallback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, onSensorCallback);
setTimeout(() => { setTimeout(() => {
expect(true).assertTrue(); sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, onSensorCallback);
done(); done();
}, 500); }, 500);
}) })
...@@ -555,7 +556,7 @@ describe("SensorJsTest_sensor_5", function () { ...@@ -555,7 +556,7 @@ describe("SensorJsTest_sensor_5", function () {
* @tc.name: Gyroscope_SensorJsTest017 * @tc.name: Gyroscope_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("Gyroscope_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("Gyroscope_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------Gyroscope_SensorJsTest017--------------'); console.info('---------Gyroscope_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE,(error, data) => {
......
...@@ -228,15 +228,14 @@ describe("SensorJsTest_sensor_7", function () { ...@@ -228,15 +228,14 @@ describe("SensorJsTest_sensor_7", function () {
console.info('----------------------Hall_SensorJsTest007---------------------------'); console.info('----------------------Hall_SensorJsTest007---------------------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('Hall_SensorJsTest007 on error'); console.info('Hall_SensorJsTest007 on error');
expect(false).assertTrue(); expect(typeof (data.status)).assertEqual("number");
done(); expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_HALL,(error, data) => {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL, onSensorCallback); sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL, onSensorCallback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_HALL, onSensorCallback);
setTimeout(() => { setTimeout(() => {
expect(true).assertTrue(); sensor.off(sensor.SensorType.SENSOR_TYPE_ID_HALL, onSensorCallback);
done(); done();
}, 500); }, 500);
}) })
...@@ -545,7 +544,7 @@ describe("SensorJsTest_sensor_7", function () { ...@@ -545,7 +544,7 @@ describe("SensorJsTest_sensor_7", function () {
* @tc.name: Hall_SensorJsTest017 * @tc.name: Hall_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("Hall_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("Hall_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------Hall_SensorJsTest017--------------'); console.info('---------Hall_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_HALL,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_HALL,(error, data) => {
......
...@@ -238,15 +238,16 @@ describe("SensorJsTest_sensor_15", function () { ...@@ -238,15 +238,16 @@ describe("SensorJsTest_sensor_15", function () {
console.info('----------------------MagneticField_SensorJsTest007---------------------------'); console.info('----------------------MagneticField_SensorJsTest007---------------------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('MagneticField_SensorJsTest007 on error'); console.info('MagneticField_SensorJsTest007 on error');
expect(false).assertTrue(); expect(typeof (data.x)).assertEqual("number");
done(); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD,(error, data) => {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, onSensorCallback); sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, onSensorCallback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, onSensorCallback);
setTimeout(() => { setTimeout(() => {
expect(true).assertTrue(); sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, onSensorCallback);
done(); done();
}, 500); }, 500);
}) })
...@@ -555,7 +556,7 @@ describe("SensorJsTest_sensor_15", function () { ...@@ -555,7 +556,7 @@ describe("SensorJsTest_sensor_15", function () {
* @tc.name: MagneticField_SensorJsTest017 * @tc.name: MagneticField_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("MagneticField_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("MagneticField_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------MagneticField_SensorJsTest017--------------'); console.info('---------MagneticField_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD,(error, data) => {
......
...@@ -238,15 +238,16 @@ describe("SensorJsTest_sensor_16", function () { ...@@ -238,15 +238,16 @@ describe("SensorJsTest_sensor_16", function () {
console.info('----------------------Orientating_SensorJsTest007---------------------------'); console.info('----------------------Orientating_SensorJsTest007---------------------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('Orientating_SensorJsTest007 on error'); console.info('Orientating_SensorJsTest007 on error');
expect(false).assertTrue(); expect(typeof(data.beta)).assertEqual("number");
done(); expect(typeof(data.gamma)).assertEqual("number");
expect(typeof(data.alpha)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,(error, data) => {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, onSensorCallback); sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, onSensorCallback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, onSensorCallback);
setTimeout(() => { setTimeout(() => {
expect(true).assertTrue(); sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, onSensorCallback);
done(); done();
}, 500); }, 500);
}) })
...@@ -555,7 +556,7 @@ describe("SensorJsTest_sensor_16", function () { ...@@ -555,7 +556,7 @@ describe("SensorJsTest_sensor_16", function () {
* @tc.name: Orientating_SensorJsTest017 * @tc.name: Orientating_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("Orientating_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("Orientating_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------Orientating_SensorJsTest017--------------'); console.info('---------Orientating_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION,(error, data) => {
......
...@@ -35,7 +35,25 @@ const PARAMETER_ERROR_MSG = 'The parameter invalid.' ...@@ -35,7 +35,25 @@ const PARAMETER_ERROR_MSG = 'The parameter invalid.'
const PERMISSION_DENIED_MSG = 'Permission denied.' const PERMISSION_DENIED_MSG = 'Permission denied.'
let tokenID = undefined let tokenID = undefined
let permissionNameUser = 'ohos.permission.ACTIVITY_MOTION' let permissionNameUser = 'ohos.permission.ACTIVITY_MOTION'
async function grantPerm(){
try {
let accountManager = osAccount.getAccountManager();
let userId = await accountManager.getOsAccountLocalIdFromProcess();
console.info("SensorJsTest_sensor_17 userId:"+userId)
console.info("============SensorJsTest_sensor_17 grant Permission start ============")
var appInfo = await bundle.getApplicationInfo('ohos.acts.sensors.sensor.function', 0, userId);
tokenID = appInfo.accessTokenId;
console.log('SensorJsTest_sensor_17 accessTokenId:' + appInfo.accessTokenId + ', name:' + appInfo.name +
' ,bundleName:' + appInfo.process)
var atManager = abilityAccessCtrl.createAtManager();
var result = await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
console.info('SensorJsTest_sensor_17 successful. result: ' + JSON.stringify(result));
console.info("============SensorJsTest_sensor_17 grant Permission end ============")
} catch(error) {
console.error('SensorJsTest_sensor_17 exception in, msg:' + JSON.stringify(error))
}
}
describe("SensorJsTest_sensor_17", function () { describe("SensorJsTest_sensor_17", function () {
function callback(data) { function callback(data) {
console.info('old callback success' + JSON.stringify(data)); console.info('old callback success' + JSON.stringify(data));
...@@ -46,37 +64,35 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -46,37 +64,35 @@ describe("SensorJsTest_sensor_17", function () {
console.info('old callback2 sucess' + JSON.stringify(data)); console.info('old callback2 sucess' + JSON.stringify(data));
expect(typeof(data.scalar)).assertEqual('number'); expect(typeof(data.scalar)).assertEqual('number');
} }
beforeAll(async function() { beforeAll(async function(done) {
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
console.info('beforeAll called') console.info('beforeAll called')
try { await grantPerm();
let accountManager = osAccount.getAccountManager(); done();
let userId = await accountManager.getOsAccountLocalIdFromProcess();
let appInfo = await bundle.getApplicationInfo('ohos.acts.sensors.sensor.function', 0, userId);
tokenID = appInfo.accessTokenId;
console.log('AccessTokenId accessTokenId:' + appInfo.accessTokenId + ', name:' + appInfo.name +
' ,bundleName:' + appInfo.process)
console.info('successful. Data: ' + JSON.stringify(appInfo));
} catch(error) {
console.error('exception in, msg:' + JSON.stringify(error))
}
}) })
afterAll(function() { afterAll(function() {
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
console.info('afterAll called') console.info('afterAll called')
let atManager = abilityAccessCtrl.createAtManager();
atManager.revokeUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.catch((error) => {
console.info('SensorJsTest_sensor_17 error:' + JSON.stringify(error));
expect(error.code).assertEqual(ERR_NOT_HAVE_PERMISSION);
})
}) })
beforeEach(function() { beforeEach(function() {
/* /*
* @tc.setup: setup invoked before each testcases * @tc.setup: setup invoked before each testcases
*/ */
console.info('beforeEach called') console.info('beforeEach called')
}) })
afterEach(function() { afterEach(function() {
...@@ -84,13 +100,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -84,13 +100,6 @@ describe("SensorJsTest_sensor_17", function () {
* @tc.teardown: teardown invoked after each testcases * @tc.teardown: teardown invoked after each testcases
*/ */
console.info('afterEach called') console.info('afterEach called')
let atManager = abilityAccessCtrl.createAtManager();
atManager.revokeUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.catch((error) => {
console.info('error:' + JSON.stringify(error));
expect(error.code).assertEqual(ERR_NOT_HAVE_PERMISSION);
})
}) })
/* /*
...@@ -100,10 +109,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -100,10 +109,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("PedometerDetection_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest001---------------------------'); console.info('----------------------PedometerDetection_SensorJsTest001---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -129,11 +134,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -129,11 +134,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest001 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -143,10 +143,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -143,10 +143,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest002---------------------------'); console.info('----------------------PedometerDetection_SensorJsTest002---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -169,11 +165,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -169,11 +165,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest002 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -183,10 +174,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -183,10 +174,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest003---------------------------'); console.info('----------------------PedometerDetection_SensorJsTest003---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -212,11 +199,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -212,11 +199,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest003 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -226,10 +208,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -226,10 +208,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest004", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest004---------------------------'); console.info('----------------------PedometerDetection_SensorJsTest004---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -255,11 +233,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -255,11 +233,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest004 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -269,10 +242,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -269,10 +242,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest005", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest005---------------------------'); console.info('----------------------PedometerDetection_SensorJsTest005---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -295,11 +264,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -295,11 +264,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest005 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -309,10 +273,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -309,10 +273,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest006", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest006---------------------------'); console.info('----------------------PedometerDetection_SensorJsTest006---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -334,11 +294,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -334,11 +294,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest006 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -348,10 +303,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -348,10 +303,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest007", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest007---------------------------'); console.info('----------------------PedometerDetection_SensorJsTest007---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -378,11 +329,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -378,11 +329,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest007 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -392,10 +338,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -392,10 +338,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest008", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest008---------------------------'); console.info('----------------------PedometerDetection_SensorJsTest008---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -425,11 +367,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -425,11 +367,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest008 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -439,10 +376,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -439,10 +376,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest009", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest009---------------------------'); console.info('----------------------PedometerDetection_SensorJsTest009---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -469,11 +402,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -469,11 +402,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest009 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -492,6 +420,9 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -492,6 +420,9 @@ describe("SensorJsTest_sensor_17", function () {
} }
try { try {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback); sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback);
setTimeout(() => {
done();
}, 4000);
} catch (error) { } catch (error) {
console.error('PedometerDetection_SensorJsTest010 On fail, errorCode:' +JSON.stringify(error)); console.error('PedometerDetection_SensorJsTest010 On fail, errorCode:' +JSON.stringify(error));
expect(error.code).assertEqual(PERMISSION_DENIED_CODE); expect(error.code).assertEqual(PERMISSION_DENIED_CODE);
...@@ -516,10 +447,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -516,10 +447,6 @@ describe("SensorJsTest_sensor_17", function () {
console.info('--------PedometerDetection_SensorJsTest011--------'); console.info('--------PedometerDetection_SensorJsTest011--------');
let errorMessage = "" let errorMessage = ""
let errorMessages = "ReferenceError: xxx is not defined" let errorMessages = "ReferenceError: xxx is not defined"
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -552,12 +479,8 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -552,12 +479,8 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
}) })
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest011 error:' + JSON.stringify(error));
done();
})
})
/* /*
* @tc.number:SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0120 * @tc.number:SUB_SensorsSystem_PEDOMETER_DETECTION_JSTest_0120
* @tc.name: PedometerDetection_SensorJsTest012 * @tc.name: PedometerDetection_SensorJsTest012
...@@ -565,10 +488,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -565,10 +488,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest012", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------PedometerDetection_SensorJsTest012--------'); console.info('--------PedometerDetection_SensorJsTest012--------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -594,11 +513,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -594,11 +513,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest012 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -608,10 +522,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -608,10 +522,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest013", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------PedometerDetection_SensorJsTest013--------'); console.info('--------PedometerDetection_SensorJsTest013--------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -637,11 +547,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -637,11 +547,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest013 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -651,10 +556,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -651,10 +556,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest014", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------PedometerDetection_SensorJsTest014--------'); console.info('--------PedometerDetection_SensorJsTest014--------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -664,12 +565,12 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -664,12 +565,12 @@ describe("SensorJsTest_sensor_17", function () {
} }
try { try {
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('PedometerDetection_SensorJsTest014 on error'); console.info('PedometerDetection_SensorJsTest014 data:' + JSON.stringify(data));
expect(typeof(data.scalar)).assertEqual('number'); expect(typeof(data.scalar)).assertEqual('number');
} }
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, onSensorCallback, {'interval': 100000000}); sensor.on(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, onSensorCallback, {'interval': 100000000});
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION);
setTimeout(() => { setTimeout(() => {
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION);
done(); done();
}, 4000); }, 4000);
} catch (error) { } catch (error) {
...@@ -684,11 +585,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -684,11 +585,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest014 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -698,10 +594,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -698,10 +594,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest015---------------------------'); console.info('----------------------PedometerDetection_SensorJsTest015---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -724,11 +616,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -724,11 +616,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest015 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -738,10 +625,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -738,10 +625,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------PedometerDetection_SensorJsTest016--------'); console.info('--------PedometerDetection_SensorJsTest016--------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -777,11 +660,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -777,11 +660,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest016 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -791,10 +669,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -791,10 +669,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('--------PedometerDetection_SensorJsTest017--------'); console.info('--------PedometerDetection_SensorJsTest017--------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -821,11 +695,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -821,11 +695,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest017 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -835,10 +704,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -835,10 +704,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { it("PedometerDetection_SensorJsTest018", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest018---------------------------'); console.info('----------------------PedometerDetection_SensorJsTest018---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -864,11 +729,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -864,11 +729,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest018 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -878,10 +738,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -878,10 +738,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest019---------------------------'); console.info('----------------------PedometerDetection_SensorJsTest019---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -908,11 +764,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -908,11 +764,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest019 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -922,10 +773,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -922,10 +773,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest020---------------------------'); console.info('----------------------PedometerDetection_SensorJsTest020---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -955,11 +802,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -955,11 +802,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest020 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -969,10 +811,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -969,10 +811,6 @@ describe("SensorJsTest_sensor_17", function () {
*/ */
it("PedometerDetection_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------PedometerDetection_SensorJsTest021---------------------------'); console.info('----------------------PedometerDetection_SensorJsTest021---------------------------');
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -1003,11 +841,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -1003,11 +841,6 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest021 error:' + JSON.stringify(error));
done();
})
}) })
/* /*
...@@ -1016,10 +849,6 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -1016,10 +849,6 @@ describe("SensorJsTest_sensor_17", function () {
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("PedometerDetection_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it("PedometerDetection_SensorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
let atManager = abilityAccessCtrl.createAtManager();
await atManager.grantUserGrantedPermission(tokenID, permissionNameUser,
PermissionFlag.PERMISSION_SYSTEM_FIXED)
.then(() => {
try { try {
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, (error, data) => {
if (error) { if (error) {
...@@ -1045,10 +874,5 @@ describe("SensorJsTest_sensor_17", function () { ...@@ -1045,10 +874,5 @@ describe("SensorJsTest_sensor_17", function () {
expect(error.message).assertEqual(PARAMETER_ERROR_MSG); expect(error.message).assertEqual(PARAMETER_ERROR_MSG);
done(); done();
} }
})
.catch ((error) => {
console.error('PedometerDetection_SensorJsTest022 error:' + JSON.stringify(error));
done();
})
}) })
})} })}
...@@ -240,15 +240,16 @@ describe("SensorJsTest_sensor_20", function () { ...@@ -240,15 +240,16 @@ describe("SensorJsTest_sensor_20", function () {
console.info('----------------------RotatingVector_SensorJsTest007---------------------------'); console.info('----------------------RotatingVector_SensorJsTest007---------------------------');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('RotatingVector_SensorJsTest007 on error'); console.info('RotatingVector_SensorJsTest007 on error');
expect(false).assertTrue(); expect(typeof (data.x)).assertEqual("number");
done(); expect(typeof (data.y)).assertEqual("number");
expect(typeof (data.z)).assertEqual("number");
expect(typeof (data.timestamp)).assertEqual("number");
} }
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,(error, data) => {
sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, onSensorCallback); sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, onSensorCallback);
sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, onSensorCallback);
setTimeout(() => { setTimeout(() => {
expect(true).assertTrue(); sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, onSensorCallback);
done(); done();
}, 500); }, 500);
}) })
...@@ -557,7 +558,7 @@ describe("SensorJsTest_sensor_20", function () { ...@@ -557,7 +558,7 @@ describe("SensorJsTest_sensor_20", function () {
* @tc.name: RotatingVector_SensorJsTest017 * @tc.name: RotatingVector_SensorJsTest017
* @tc.desc:Verification results of the incorrect parameters of the test interface * @tc.desc:Verification results of the incorrect parameters of the test interface
*/ */
it("RotatingVector_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("RotatingVector_SensorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('---------RotatingVector_SensorJsTest017--------------'); console.info('---------RotatingVector_SensorJsTest017--------------');
try{ try{
sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,(error, data) => { sensor.getSingleSensor(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,(error, data) => {
......
...@@ -87,7 +87,7 @@ describe("SensorJsTest_sensor_26", function () { ...@@ -87,7 +87,7 @@ describe("SensorJsTest_sensor_26", function () {
* @tc.name: subscribeBarometer_SensorJsTest002 * @tc.name: subscribeBarometer_SensorJsTest002
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
*/ */
it("subscribeBarometer_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("subscribeBarometer_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeBarometer_SensorJsTest002---------------------------'); console.info('----------------------subscribeBarometer_SensorJsTest002---------------------------');
try{ try{
sensor.getSingleSensor(BarometerId ,(error, data) => { sensor.getSingleSensor(BarometerId ,(error, data) => {
...@@ -127,7 +127,7 @@ describe("SensorJsTest_sensor_26", function () { ...@@ -127,7 +127,7 @@ describe("SensorJsTest_sensor_26", function () {
* @tc.name: subscribeBarometer_SensorJsTest003 * @tc.name: subscribeBarometer_SensorJsTest003
* @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.desc:Verification results of the incorrect parameters of the test interface.
*/ */
it("subscribeBarometer_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, function (done) { it("subscribeBarometer_SensorJsTest003", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('----------------------subscribeBarometer_SensorJsTest003---------------------------'); console.info('----------------------subscribeBarometer_SensorJsTest003---------------------------');
try{ try{
sensor.getSingleSensor(BarometerId,(error, data) => { sensor.getSingleSensor(BarometerId,(error, data) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册