提交 f31b5667 编写于 作者: Z zhaoyuan17

Update ans xts code

Signed-off-by: Nzhaoyuan17 <zhaoyuan17@huawei.com>
上级 152e4d28
...@@ -17,8 +17,8 @@ group("badgedisplayed") { ...@@ -17,8 +17,8 @@ group("badgedisplayed") {
testonly = true testonly = true
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [
#"badgedisplay:ActsAnsBadgeDisplayTest", "badgedisplay:ActsAnsBadgeDisplayTest",
#"localcandisplay:localcandisplay", "localcandisplay:localcandisplay",
] ]
} }
} }
...@@ -17,8 +17,8 @@ group("enablenotification") { ...@@ -17,8 +17,8 @@ group("enablenotification") {
testonly = true testonly = true
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [
#"enablenotification:ActsAnsEnableNotificationTest", "enablenotification:ActsAnsEnableNotificationTest",
#"localnotificationenable:ActsAnsLocalNotificationTest", "localnotificationenable:ActsAnsLocalNotificationTest",
] ]
} }
} }
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
/entry/.preview
.cxx
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="D:\HUAWEI\DevEco Studio 2.1.0.301\tools\gradle" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/entry" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://developer.huawei.com/repo/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://repo.huaweicloud.com/repository/maven/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
"kits": [ "kits": [
{ {
"test-file-name": [ "test-file-name": [
"ActsAnsEnableNotificationTest.hap" "ActsAnsEnableNotificationTest.hap",
"ActsAnsLocalNotificationTest.hap"
], ],
"type": "AppInstallKit", "type": "AppInstallKit",
"cleanup-apps": true "cleanup-apps": true
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
}, },
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.example.actsansenablenotificationonetest", "package": "com.example.actsansenablenotificationtest",
"name": ".MyApplication", "name": ".MyApplication",
"deviceType": [ "deviceType": [
"phone" "phone"
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
] ]
} }
], ],
"name": "com.example.actsansenablenotificationonetest.MainAbility", "name": "com.example.actsansenablenotificationtest.MainAbility",
"icon": "$media:icon", "icon": "$media:icon",
"description": "$string:mainability_description", "description": "$string:mainability_description",
"label": "$string:app_name", "label": "$string:app_name",
......
...@@ -169,6 +169,29 @@ describe('ActsAnsEnableNotificationTest', function () { ...@@ -169,6 +169,29 @@ describe('ActsAnsEnableNotificationTest', function () {
done(); done();
}) })
}) })
/*
* @tc.number: ActsGetEnable_test_1100
* @tc.name: isNotificationEnabled()
* @tc.desc: verify the function of isNotificationEnabled
*/
it('ActsGetEnable_test_1100', 0, async function (done) {
await notify.isNotificationEnabled((err,data) => {
console.log("==========================>ActsGetEnable_test_1100 success=======================>"+err+data)
expect(typeof(data)).assertEqual('boolean')
})
done();
})
/*
* @tc.number: ActsGetEnable_test_1200
* @tc.name: isNotificationEnabled()
* @tc.desc: verify the function of isNotificationEnabled
*/
it('ActsGetEnable_test_1200', 0, async function (done) {
var promise = await notify.isNotificationEnabled()
console.log("==========================>ActsGetEnable_test_1200 success=======================>"+promise)
expect(typeof(promise)).assertEqual('boolean')
done();
})
/* /*
* @tc.number: ActsSetEnable_test_0100 * @tc.number: ActsSetEnable_test_0100
* @tc.name: enableNotification() * @tc.name: enableNotification()
......
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
/entry/.preview
.cxx
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="D:\HUAWEI\DevEco Studio 2.1.0.301\tools\gradle" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/entry" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://developer.huawei.com/repo/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://repo.huaweicloud.com/repository/maven/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.actsanslocalnotificationtest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsLocalNotificationTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
} }
...@@ -37,8 +37,6 @@ export default { ...@@ -37,8 +37,6 @@ export default {
const configService = core.getDefaultService('config') const configService = core.getDefaultService('config')
configService.setConfig(this) configService.setConfig(this)
require('../../../test/List.test')
core.execute() core.execute()
}, },
onReady() { onReady() {
......
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./LocalNotificationEnable.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import notify from '@ohos.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var time = 1000
describe('ActsAnsLocalNotificationTest', function () {
console.info("===========ActsLocalNotificationTest start====================>");
/*
* @tc.number: ActsLocalNotification_test_0100
* @tc.name: isNotificationEnabled()
* @tc.desc: verify the function of isNotificationEnabled
*/
it('ActsLocalNotification_test_0100', 0, async function (done) {
await notify.isNotificationEnabled((err,data) => {
console.log("==========================>ActsLocalNotification_test_0100 success=======================>"+err+data)
expect(typeof(data)).assertEqual('boolean')
})
done();
setTimeout(function(){
console.debug("====>time out ActsLocalNotification_test_0100====>");
}, time);
})
/*
* @tc.number: ActsLocalNotification_test_0200
* @tc.name: isNotificationEnabled()
* @tc.desc: verify the function of isNotificationEnabled
*/
it('ActsLocalNotification_test_0200', 0, async function (done) {
var promise = await notify.isNotificationEnabled()
console.log("==========================>ActsLocalNotification_test_0200 success=======================>"+promise)
expect(typeof(promise)).assertEqual('boolean')
done();
setTimeout(function(){
console.debug("====>time out ActsLocalNotification_test_0200====>");
}, time);
})
})
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
/entry/.preview
.cxx
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="E:\AMS\jsDevelopTools\DevEco Studio 2.1.0.301\tools\gradle" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/entry" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://developer.huawei.com/repo/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://repo.huaweicloud.com/repository/maven/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import notify from '@ohos.notification' import notify from '@ohos.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var time = 1000 var time = 300
var ERR_ANS_NON_SYSTEM_APP = 67108877 var ERR_ANS_NON_SYSTEM_APP = 67108877
describe('ActsAnsActiveTest', function () { describe('ActsAnsActiveTest', function () {
console.info("===========ActsAnsActiveTest start====================>"); console.info("===========ActsAnsActiveTest start====================>");
...@@ -79,9 +79,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -79,9 +79,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_0100 publish end==================>"); console.debug("===============Ans_GetActive_0100 publish end==================>");
notify.getActiveNotifications(getCallback); notify.getActiveNotifications(getCallback);
console.debug("===============Ans_GetActive_0100 getActiveNotifications end==================>"); console.debug("===============Ans_GetActive_0100 getActiveNotifications end==================>");
done();
setTimeout(async function(){ setTimeout(async function(){
console.debug("===============Ans_GetActive_0100 done==================>"); console.debug("===============Ans_GetActive_0100 done==================>");
done();
}, time); }, time);
}) })
...@@ -142,9 +142,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -142,9 +142,9 @@ describe('ActsAnsActiveTest', function () {
console.log("=======Ans_GetActive_0200 getCallback badgeIconStyle=====>"+promiseData[i].badgeIconStyle) console.log("=======Ans_GetActive_0200 getCallback badgeIconStyle=====>"+promiseData[i].badgeIconStyle)
} }
console.debug("===============Ans_GetActive_0200 getActiveNotifications end==================>"); console.debug("===============Ans_GetActive_0200 getActiveNotifications end==================>");
done();
setTimeout(async function(){ setTimeout(async function(){
console.debug("===============Ans_GetActive_0200 done==================>"); console.debug("===============Ans_GetActive_0200 done==================>");
done();
}, time); }, time);
}) })
...@@ -218,9 +218,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -218,9 +218,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_0300 publish2 end==================>"); console.debug("===============Ans_GetActive_0300 publish2 end==================>");
notify.getActiveNotifications(getCallbackTwo); notify.getActiveNotifications(getCallbackTwo);
console.debug("===============Ans_GetActive_0300 getActiveNotifications end==================>"); console.debug("===============Ans_GetActive_0300 getActiveNotifications end==================>");
done();
setTimeout(async function(){ setTimeout(async function(){
console.debug("===============Ans_GetActive_0300 done==================>"); console.debug("===============Ans_GetActive_0300 done==================>");
done();
}, time); }, time);
}) })
...@@ -289,9 +289,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -289,9 +289,9 @@ describe('ActsAnsActiveTest', function () {
} }
} }
console.debug("===============Ans_GetActive_0400 getActiveNotifications end==================>"); console.debug("===============Ans_GetActive_0400 getActiveNotifications end==================>");
done();
setTimeout(async function(){ setTimeout(async function(){
console.debug("===============Ans_GetActive_0400 done==================>"); console.debug("===============Ans_GetActive_0400 done==================>");
done();
}, time); }, time);
}) })
...@@ -307,9 +307,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -307,9 +307,9 @@ describe('ActsAnsActiveTest', function () {
console.log("Ans_GetActive_0500 getCallback data.length============>" + data.length); console.log("Ans_GetActive_0500 getCallback data.length============>" + data.length);
console.log("Ans_GetActive_0500 getCallback JSON.stringify(data)============>" + JSON.stringify(data)); console.log("Ans_GetActive_0500 getCallback JSON.stringify(data)============>" + JSON.stringify(data));
expect(data.length).assertEqual(0); expect(data.length).assertEqual(0);
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetActive_0500 done==================>"); console.debug("===============Ans_GetActive_0500 done==================>");
done();
}, time); }, time);
}); });
}) })
...@@ -327,9 +327,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -327,9 +327,9 @@ describe('ActsAnsActiveTest', function () {
expect(promiseData.length).assertEqual(0); expect(promiseData.length).assertEqual(0);
console.debug("=========Ans_GetActive_0600 promiseData.length=============>"+promiseData.length); console.debug("=========Ans_GetActive_0600 promiseData.length=============>"+promiseData.length);
console.debug("==Ans_GetActivcae_0600 JSON.stringify(promiseData)========>"+JSON.stringify(promiseData)); console.debug("==Ans_GetActivcae_0600 JSON.stringify(promiseData)========>"+JSON.stringify(promiseData));
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetActive_0600 done==================>"); console.debug("===============Ans_GetActive_0600 done==================>");
done();
}, time); }, time);
}) })
...@@ -394,9 +394,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -394,9 +394,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_0700 cancel end==================>"); console.debug("===============Ans_GetActive_0700 cancel end==================>");
notify.getActiveNotifications(getCallbackFour); notify.getActiveNotifications(getCallbackFour);
console.debug("===============Ans_GetActive_0700 getActiveNotifications end==================>"); console.debug("===============Ans_GetActive_0700 getActiveNotifications end==================>");
done();
setTimeout(async function(){ setTimeout(async function(){
console.debug("===============Ans_GetActive_0700 done==================>"); console.debug("===============Ans_GetActive_0700 done==================>");
done();
}, time); }, time);
}) })
...@@ -454,9 +454,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -454,9 +454,9 @@ describe('ActsAnsActiveTest', function () {
console.log("============Ans_GetActive_0800 getCallback label=====>"+promiseData[i].label) console.log("============Ans_GetActive_0800 getCallback label=====>"+promiseData[i].label)
} }
console.debug("===============Ans_GetActive_0800 getActiveNotifications end==================>"); console.debug("===============Ans_GetActive_0800 getActiveNotifications end==================>");
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetActive_0800 done==================>"); console.debug("===============Ans_GetActive_0800 done==================>");
done();
}, time); }, time);
}) })
...@@ -508,9 +508,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -508,9 +508,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_0900 cancelAll end==================>"); console.debug("===============Ans_GetActive_0900 cancelAll end==================>");
notify.getActiveNotifications(getCallbackFive); notify.getActiveNotifications(getCallbackFive);
console.debug("===============Ans_GetActive_0900 getActiveNotifications end==================>"); console.debug("===============Ans_GetActive_0900 getActiveNotifications end==================>");
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetActive_0900 done==================>"); console.debug("===============Ans_GetActive_0900 done==================>");
done();
}, time); }, time);
}) })
...@@ -558,9 +558,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -558,9 +558,9 @@ describe('ActsAnsActiveTest', function () {
console.log("Ans_GetActive_1000 getCallback data============>"+JSON.stringify(promiseData)); console.log("Ans_GetActive_1000 getCallback data============>"+JSON.stringify(promiseData));
expect(promiseData.length).assertEqual(0); expect(promiseData.length).assertEqual(0);
console.debug("===============Ans_GetActive_1000 getActiveNotifications end==================>"); console.debug("===============Ans_GetActive_1000 getActiveNotifications end==================>");
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetActive_1000 done==================>"); console.debug("===============Ans_GetActive_1000 done==================>");
done();
}, time); }, time);
}) })
...@@ -599,9 +599,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -599,9 +599,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_1100 publish end==================>"); console.debug("===============Ans_GetActive_1100 publish end==================>");
notify.getActiveNotificationCount(getCountCallback); notify.getActiveNotificationCount(getCountCallback);
console.debug("===============Ans_GetActive_1100 getActiveNotificationCount end==================>"); console.debug("===============Ans_GetActive_1100 getActiveNotificationCount end==================>");
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetActive_1100 done==================>"); console.debug("===============Ans_GetActive_1100 done==================>");
done();
}, time); }, time);
}) })
...@@ -636,9 +636,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -636,9 +636,9 @@ describe('ActsAnsActiveTest', function () {
var promiseCount = await notify.getActiveNotificationCount(); var promiseCount = await notify.getActiveNotificationCount();
expect(promiseCount).assertEqual(1); expect(promiseCount).assertEqual(1);
console.debug("===============Ans_GetActive_1200 promiseCount==================>"+promiseCount); console.debug("===============Ans_GetActive_1200 promiseCount==================>"+promiseCount);
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetActive_1200 done==================>"); console.debug("===============Ans_GetActive_1200 done==================>");
done();
}, time); }, time);
}) })
...@@ -698,9 +698,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -698,9 +698,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_1300 publish end==================>"); console.debug("===============Ans_GetActive_1300 publish end==================>");
notify.getActiveNotificationCount(getCountCallbackTwo); notify.getActiveNotificationCount(getCountCallbackTwo);
console.debug("===============Ans_GetActive_1300 getActiveNotificationCount end==================>"); console.debug("===============Ans_GetActive_1300 getActiveNotificationCount end==================>");
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetActive_1300 done==================>"); console.debug("===============Ans_GetActive_1300 done==================>");
done();
}, time); }, time);
}) })
...@@ -755,9 +755,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -755,9 +755,9 @@ describe('ActsAnsActiveTest', function () {
var promiseCount = await notify.getActiveNotificationCount(); var promiseCount = await notify.getActiveNotificationCount();
expect(promiseCount).assertEqual(2); expect(promiseCount).assertEqual(2);
console.debug("===============Ans_GetActive_1400 promiseCount==================>"+promiseCount); console.debug("===============Ans_GetActive_1400 promiseCount==================>"+promiseCount);
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetActive_1400 done==================>"); console.debug("===============Ans_GetActive_1400 done==================>");
done();
}, time); }, time);
}) })
...@@ -776,9 +776,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -776,9 +776,9 @@ describe('ActsAnsActiveTest', function () {
await notify.cancelAll(); await notify.cancelAll();
notify.getActiveNotificationCount(getCountCallbackThree); notify.getActiveNotificationCount(getCountCallbackThree);
console.debug("===============Ans_GetActive_1500 getActiveNotificationCount end==================>"); console.debug("===============Ans_GetActive_1500 getActiveNotificationCount end==================>");
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetActive_1500 done==================>"); console.debug("===============Ans_GetActive_1500 done==================>");
done();
}, time); }, time);
}) })
...@@ -793,9 +793,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -793,9 +793,9 @@ describe('ActsAnsActiveTest', function () {
var promiseCount = await notify.getActiveNotificationCount(); var promiseCount = await notify.getActiveNotificationCount();
expect(promiseCount).assertEqual(0); expect(promiseCount).assertEqual(0);
console.debug("===============Ans_GetActive_1600 promiseCount==================>"+promiseCount); console.debug("===============Ans_GetActive_1600 promiseCount==================>"+promiseCount);
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetActive_1600 done==================>"); console.debug("===============Ans_GetActive_1600 done==================>");
done();
}, time); }, time);
}) })
...@@ -846,9 +846,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -846,9 +846,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_1700 cancel end==================>"); console.debug("===============Ans_GetActive_1700 cancel end==================>");
notify.getActiveNotificationCount(getCountCallbackFour); notify.getActiveNotificationCount(getCountCallbackFour);
console.debug("===============Ans_GetActive_1700 getActiveNotifications end==================>"); console.debug("===============Ans_GetActive_1700 getActiveNotifications end==================>");
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetActive_1700 done==================>"); console.debug("===============Ans_GetActive_1700 done==================>");
done();
}, time); }, time);
}) })
...@@ -894,9 +894,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -894,9 +894,9 @@ describe('ActsAnsActiveTest', function () {
var promiseCount = await notify.getActiveNotificationCount(); var promiseCount = await notify.getActiveNotificationCount();
expect(promiseCount).assertEqual(1); expect(promiseCount).assertEqual(1);
console.debug("===============Ans_GetActive_1800 promiseCount===========>"+promiseCount); console.debug("===============Ans_GetActive_1800 promiseCount===========>"+promiseCount);
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetActive_1800 done==================>"); console.debug("===============Ans_GetActive_1800 done==================>");
done();
}, time); }, time);
}) })
...@@ -946,9 +946,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -946,9 +946,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetActive_1900 cancel end==================>"); console.debug("===============Ans_GetActive_1900 cancel end==================>");
notify.getActiveNotificationCount(getCountCallbackFive); notify.getActiveNotificationCount(getCountCallbackFive);
console.debug("===============Ans_GetActive_1900 getActiveNotifications end==================>"); console.debug("===============Ans_GetActive_1900 getActiveNotifications end==================>");
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetActive_1900 done==================>"); console.debug("===============Ans_GetActive_1900 done==================>");
done();
}, time); }, time);
}) })
...@@ -994,19 +994,17 @@ describe('ActsAnsActiveTest', function () { ...@@ -994,19 +994,17 @@ describe('ActsAnsActiveTest', function () {
var promiseCount = await notify.getActiveNotificationCount(); var promiseCount = await notify.getActiveNotificationCount();
expect(promiseCount).assertEqual(0); expect(promiseCount).assertEqual(0);
console.debug("===============Ans_GetActive_2000 promiseCount===========>"+promiseCount); console.debug("===============Ans_GetActive_2000 promiseCount===========>"+promiseCount);
done();
setTimeout(function(){ setTimeout(function(){
console.debug("===============Ans_GetActive_2000 done==================>"); console.debug("===============Ans_GetActive_2000 done==================>");
done();
}, time); }, time);
}) })
function getAllCallbackNine(err, data){ function getAllCallbackNine(err,data){
console.debug("========Ans_GetAllActive_0900 getAllCallbackNine data.length========>"+data.length); console.debug("===========Ans_GetAllActive_0900 getAllCallbackNine data.length============>"+data.length);
console.debug("========Ans_GetAllActive_0900 getAllCallbackNine err.code========>"+err.code); console.debug("===========Ans_GetAllActive_0900 getAllCallbackNine err.code============>"+err.code);
expect(err.code).assertEqual(67108877); expect(err.code).assertEqual(ERR_ANS_NON_SYSTEM_APP);
expect(data).assertEqual(undefined);
} }
/* /*
* @tc.number: Ans_GetAllActive_0900 * @tc.number: Ans_GetAllActive_0900
* @tc.name: getAllActiveNotifications(callback: AsyncCallback<Array<NotificationRequest>>): void; * @tc.name: getAllActiveNotifications(callback: AsyncCallback<Array<NotificationRequest>>): void;
...@@ -1032,9 +1030,9 @@ describe('ActsAnsActiveTest', function () { ...@@ -1032,9 +1030,9 @@ describe('ActsAnsActiveTest', function () {
console.debug("===============Ans_GetAllActive_0900 publish CurrentApp notify end==================>"); console.debug("===============Ans_GetAllActive_0900 publish CurrentApp notify end==================>");
notify.getAllActiveNotifications(getAllCallbackNine); notify.getAllActiveNotifications(getAllCallbackNine);
console.debug("===============Ans_GetAllActive_0900 getAllActiveNotifications end==================>"); console.debug("===============Ans_GetAllActive_0900 getAllActiveNotifications end==================>");
done(); setTimeout(function(){
setTimeout(async function(){
console.debug("===============Ans_GetAllActive_0900 done==================>"); console.debug("===============Ans_GetAllActive_0900 done==================>");
done();
}, time); }, time);
}) })
...@@ -1061,11 +1059,16 @@ describe('ActsAnsActiveTest', function () { ...@@ -1061,11 +1059,16 @@ describe('ActsAnsActiveTest', function () {
} }
await notify.publish(notificationRequestOfCurrentApp); await notify.publish(notificationRequestOfCurrentApp);
console.debug("===============Ans_GetAllActive_1000 publish CurrentApp notify end==================>"); console.debug("===============Ans_GetAllActive_1000 publish CurrentApp notify end==================>");
await notify.getAllActiveNotifications().then().catch((err)=>{ await notify.getAllActiveNotifications().then(()=>{
console.debug("=======Ans_GetAllActive_1000 then========>");
}).catch((err)=>{
expect(err.code).assertEqual(ERR_ANS_NON_SYSTEM_APP); expect(err.code).assertEqual(ERR_ANS_NON_SYSTEM_APP);
console.debug("==Ans_GetAllActive_1000 err==>"+err.code); console.debug("=======Ans_GetAllActive_1000 err==========>"+err.code);
done();
}); });
setTimeout(function(){
console.debug("===============Ans_GetAllActive_1000 done==================>");
done();
}, time);
}) })
}) })
...@@ -19,7 +19,6 @@ group("subscribe") { ...@@ -19,7 +19,6 @@ group("subscribe") {
deps = [ deps = [
"publish:ActsAnsPublishTest", "publish:ActsAnsPublishTest",
"subscribe:ActsAnsSubscriberTest", "subscribe:ActsAnsSubscriberTest",
"subsystem:ActsAnsSubSystemTest",
] ]
} }
} }
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
/entry/.preview
.cxx
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="D:\HUAWEI\DevEco Studio 2.1.0.301\tools\gradle" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/entry" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://developer.huawei.com/repo/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://repo.huaweicloud.com/repository/maven/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsSubSystemTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsSubSystemTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.actsanssubsystemtest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsSubSystemTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsanssubsystemtest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsanssubsystemtest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsanssubsystemtest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "Subscriber"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./Subscriber.js')
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import notify from '@ohos.notification'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var time = 1000
var ERR_ANS_NON_SYSTEM_APP = 67108877
describe('ActsAnsSubSystemTest', function () {
console.info("===========ActsAnsSubSystemTest start====================>");
//subscribeOn
function subscribeOnCallback(err) {
console.debug("===>subscribeOnCallback===>");
expect(err.code).assertEqual(0);
}
/*
* @tc.number: ActsSubscriber_test_1400
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_1500', 0, async function (done) {
console.debug("===ActsSubscriber_test_1400===begin===>");
var subInfo ={
onConnect:subscribeOnCallback,
}
await notify.subscribe(subInfo, (err)=>{
console.debug("=====subErrorCode====="+err.code)
expect(err.code).assertEqual(ERR_ANS_NON_SYSTEM_APP);
done();
})
console.debug("===ActsSubscriber_test_1500===end==>");
setTimeout(function(){
console.debug("====>time out ActsSubscriber_test_1500====>");
}, time);
})
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册