Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
44daaa71
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
44daaa71
编写于
10月 25, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6100 元能力接口覆盖 回合monthly
Merge pull request !6100 from yangzk/monthly_20221018
上级
6a1e0d79
509c4202
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
1190 addition
and
14 deletion
+1190
-14
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
...rhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
+165
-1
ability/ability_runtime/apicover/formmodule/entry/src/main/ets/Application/AbilityStage.ts
...formmodule/entry/src/main/ets/Application/AbilityStage.ts
+12
-1
ability/ability_runtime/apicover/formmodule/entry/src/main/ets/FormAbility/FormAbility.ts
.../formmodule/entry/src/main/ets/FormAbility/FormAbility.ts
+21
-11
ability/ability_runtime/apicover/formmodule/entry/src/main/ets/ModuleAbility/ModuleAbility.ts
...mmodule/entry/src/main/ets/ModuleAbility/ModuleAbility.ts
+24
-1
ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js
...ytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js
+43
-0
notification/ans_standard/actsNotificationWantAgentTest/src/main/js/test/ActsNotificationWantAgentNewTest.js
...Test/src/main/js/test/ActsNotificationWantAgentNewTest.js
+923
-0
notification/ans_standard/actsNotificationWantAgentTest/src/main/js/test/List.test.js
...tsNotificationWantAgentTest/src/main/js/test/List.test.js
+2
-0
未找到文件。
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets
浏览文件 @
44daaa71
...
...
@@ -16,6 +16,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
import
formProvider
from
'@ohos.application.formProvider'
;
import
FormInfo
from
'@ohos.application.formInfo'
;
import
formInfoNew
from
'@ohos.app.form.formInfo'
;
import
formError
from
'@ohos.application.formError'
;
import
formHost
from
'@ohos.application.formHost'
;
import
errorManager
from
'@ohos.application.errorManager'
;
...
...
@@ -23,10 +24,13 @@ import abilityConstant from '@ohos.application.AbilityConstant'
import
appManager
from
'@ohos.application.appManager'
import
applicationContext
from
'@ohos.application.context'
import
commonEvent
from
'@ohos.commonEvent'
;
import
ability
from
'@ohos.ability.ability'
import
ability
from
'@ohos.ability.ability'
;
import
abilityDelegatorRegistry
from
'@ohos.app.ability.abilityDelegatorRegistry'
;
var
EXTENSION_INFO_ERR
=
16000001
var
INNER_ERROR
=
16000050
var
CROSS_USER_DENY
=
201
var
INVALID_PARAM
=
401
var
trueInfo
;
var
array
=
new
Array
();
function
sleep
(
time
)
{
...
...
@@ -226,6 +230,120 @@ export default function ApiCoverTest() {
})
})
/*
* @tc.number SUB_AA_ABILITY_Extension_API_009
* @tc.name connectServiceExtensionAbility with invalid want.
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_ABILITY_Extension_API_009'
,
0
,
async
function
(
done
)
{
console
.
log
(
`SUB_AA_ABILITY_Extension_API_009 start`
);
let
want
=
{
bundleName
:
"com.example.extensionapitest1"
,
abilityName
:
"FirstExtension"
};
let
options
=
{
onConnect
:
function
(
elementName
,
proxy
)
{
console
.
log
(
"onConnect"
);
},
onDisconnect
:
function
()
{
console
.
log
(
"onDisconnect"
);
},
onFailed
:
function
()
{
console
.
log
(
"onFailed"
);
}
}
try
{
let
id
=
globalThis
.
abilityContext
.
connectServiceExtensionAbility
(
want
,
options
);
console
.
log
(
`connectServiceExtensionAbility id: ${id}`
);
}
catch
(
err
)
{
console
.
log
(
`connectServiceExtensionAbility catch code: ${err.code}, message: ${err.message}`
);
expect
()
.
assertFail
();
}
done
();
})
/*
* @tc.number SUB_AA_ABILITY_Extension_API_010
* @tc.name disconnectServiceExtensionAbility with invalid connectionId.
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_ABILITY_Extension_API_010'
,
0
,
async
function
(
done
)
{
console
.
log
(
`SUB_AA_ABILITY_Extension_API_010 start`
);
try
{
globalThis
.
abilityContext
.
disconnectServiceExtensionAbility
(
undefined
,
(
err
,
data
)
=>
{
console
.
log
(
`disconnectServiceExtensionAbility, err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}`
);
expect
(
err
.
code
)
.
assertEqual
(
INNER_ERROR
);
done
();
})
}
catch
(
err
)
{
console
.
log
(
`disconnectServiceExtensionAbility catch code: ${err.code}, message: ${err.message}`
);
expect
()
.
assertFail
();
done
();
}
})
/*
* @tc.number SUB_AA_ABILITY_Extension_API_011
* @tc.name disconnectServiceExtensionAbility with invalid connectionId.
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_ABILITY_Extension_API_011'
,
0
,
async
function
(
done
)
{
console
.
log
(
`SUB_AA_ABILITY_Extension_API_011 start`
);
try
{
globalThis
.
abilityContext
.
disconnectServiceExtensionAbility
(
undefined
)
.
then
((
err
,
data
)
=>
{
console
.
log
(
`disconnectServiceExtensionAbility, err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}`
);
expect
(
err
.
code
)
.
assertEqual
(
INNER_ERROR
);
});
}
catch
(
err
)
{
console
.
log
(
`disconnectServiceExtensionAbility catch code: ${err.code}, message: ${err.message}`
);
expect
()
.
assertFail
();
}
done
();
})
/*
* @tc.number SUB_AA_ABILITY_Extension_API_012
* @tc.name killProcessesBySelf with invalid param.
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_ABILITY_Extension_API_012'
,
0
,
async
function
(
done
)
{
try
{
globalThis
.
abilityContext
.
getApplicationContext
()
.
killProcessesBySelf
();
globalThis
.
abilityContext
.
getApplicationContext
()
.
killProcessesBySelf
((
err
,
data
)
=>
{
console
.
log
(
`killProcessesBySelf, err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}`
);
})
let
abilityDelegator
:
abilityDelegatorRegistry
.
AbilityDelegator
;
abilityDelegator
=
abilityDelegatorRegistry
.
getAbilityDelegator
();
let
abilityDelegatorArgs
:
abilityDelegatorRegistry
.
AbilityDelegatorArgs
;
abilityDelegatorArgs
=
abilityDelegatorRegistry
.
getArguments
();
let
abilityMonitor
:
abilityDelegatorRegistry
.
AbilityMonitor
=
{
abilityName
:
"FirstExtension"
}
abilityDelegator
.
addAbilityMonitor
(
abilityMonitor
,
(
err
,
data
)
=>
{
console
.
log
(
`printMsg, err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}`
);
})
abilityDelegator
.
printMsg
(
undefined
);
abilityDelegator
.
printMsg
(
undefined
,
(
err
,
data
)
=>
{
console
.
log
(
`printMsg, err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}`
);
});
let
shellCmdResult
:
abilityDelegatorRegistry
.
ShellCmdResult
;
shellCmdResult
=
await
abilityDelegator
.
executeShellCmd
(
undefined
);
abilityDelegator
.
executeShellCmd
(
undefined
,
0
,
(
err
,
data
)
=>
{
console
.
log
(
`executeShellCmd, err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}`
);
});
abilityDelegator
.
executeShellCmd
(
undefined
,
(
err
,
data
)
=>
{
console
.
log
(
`executeShellCmd, err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}`
);
});
}
catch
(
err
)
{
console
.
log
(
`catch code: ${err.code}, message: ${err.message}`
);
}
done
();
})
/*
* @tc.number SUB_AA_AMS_Context_0100
* @tc.name Get the resource and path of the context.
...
...
@@ -345,6 +463,52 @@ export default function ApiCoverTest() {
expect
(
3
)
.
assertEqual
(
FormInfo
.
FormDimension
.
Dimension_2_4
)
expect
(
4
)
.
assertEqual
(
FormInfo
.
FormDimension
.
Dimension_4_4
)
expect
(
5
)
.
assertEqual
(
FormInfo
.
FormDimension
.
Dimension_2_1
)
expect
(
1
)
.
assertEqual
(
FormInfo
.
FormType
.
JS
);
expect
(
2
)
.
assertEqual
(
FormInfo
.
FormType
.
eTS
);
expect
(
1
)
.
assertEqual
(
FormInfo
.
VisibilityType
.
FORM_VISIBLE
);
expect
(
2
)
.
assertEqual
(
FormInfo
.
VisibilityType
.
FORM_INVISIBLE
);
done
();
});
/*
* @tc.number SUB_AA_Form_provider_TestFormInfo_0200
* @tc.name Get all FormInfo types
* @tc.desc Function test
* @tc.level 3
*/
it
(
'SUB_AA_Form_provider_TestFormInfo_0200'
,
0
,
async
function
(
done
)
{
console
.
info
(
"SUB_AA_Form_provider_TestFormInfo_0200"
);
expect
(
"ohos.extra.param.key.form_dimension"
)
.
assertEqual
(
formInfoNew
.
FormParam
.
DIMENSION_KEY
)
expect
(
"ohos.extra.param.key.form_height"
)
.
assertEqual
(
formInfoNew
.
FormParam
.
HEIGHT_KEY
)
expect
(
"ohos.extra.param.key.module_name"
)
.
assertEqual
(
formInfoNew
.
FormParam
.
MODULE_NAME_KEY
)
expect
(
"ohos.extra.param.key.form_width"
)
.
assertEqual
(
formInfoNew
.
FormParam
.
WIDTH_KEY
)
expect
(
"ohos.extra.param.key.form_name"
)
.
assertEqual
(
formInfoNew
.
FormParam
.
NAME_KEY
)
expect
(
"ohos.extra.param.key.form_temporary"
)
.
assertEqual
(
formInfoNew
.
FormParam
.
TEMPORARY_KEY
)
expect
(
"ohos.extra.param.key.form_identity"
)
.
assertEqual
(
formInfoNew
.
FormParam
.
IDENTITY_KEY
)
expect
(
"ohos.extra.param.key.bundle_name"
)
.
assertEqual
(
formInfoNew
.
FormParam
.
BUNDLE_NAME_KEY
)
expect
(
"ohos.extra.param.key.ability_name"
)
.
assertEqual
(
formInfoNew
.
FormParam
.
ABILITY_NAME_KEY
)
expect
(
0
)
.
assertEqual
(
formInfoNew
.
FormState
.
DEFAULT
)
expect
(
1
)
.
assertEqual
(
formInfoNew
.
FormState
.
READY
)
expect
(
-
1
)
.
assertEqual
(
formInfoNew
.
FormState
.
UNKNOWN
)
expect
(
0
)
.
assertEqual
(
formInfoNew
.
ColorMode
.
MODE_DARK
)
expect
(
1
)
.
assertEqual
(
formInfoNew
.
ColorMode
.
MODE_LIGHT
)
console
.
info
(
"SUB_AA_Form_provider_TestFormInfo_0200:"
+
formInfoNew
.
FormDimension
.
Dimension_2_1
);
expect
(
1
)
.
assertEqual
(
formInfoNew
.
FormDimension
.
Dimension_1_2
)
expect
(
2
)
.
assertEqual
(
formInfoNew
.
FormDimension
.
Dimension_2_2
)
expect
(
3
)
.
assertEqual
(
formInfoNew
.
FormDimension
.
Dimension_2_4
)
expect
(
4
)
.
assertEqual
(
formInfoNew
.
FormDimension
.
Dimension_4_4
)
expect
(
5
)
.
assertEqual
(
formInfoNew
.
FormDimension
.
Dimension_2_1
)
expect
(
1
)
.
assertEqual
(
formInfoNew
.
FormType
.
JS
);
expect
(
2
)
.
assertEqual
(
formInfoNew
.
FormType
.
eTS
);
expect
(
1
)
.
assertEqual
(
formInfoNew
.
VisibilityType
.
FORM_VISIBLE
);
expect
(
2
)
.
assertEqual
(
formInfoNew
.
VisibilityType
.
FORM_INVISIBLE
);
let
formStateInfo
:
formInfoNew
.
FormStateInfo
=
{
formState
:
formInfoNew
.
FormState
.
READY
,
want
:
{
bundleName
:
"com.example.extensionapitest"
,
abilityName
:
"FirstExtension"
}
}
done
();
});
...
...
ability/ability_runtime/apicover/formmodule/entry/src/main/ets/Application/AbilityStage.ts
浏览文件 @
44daaa71
import
AbilityStage
from
"
@ohos.app
lication
.AbilityStage
"
import
AbilityStage
from
"
@ohos.app
.ability
.AbilityStage
"
export
default
class
MyAbilityStage
extends
AbilityStage
{
onCreate
()
{
console
.
log
(
"
[Demo] MyAbilityStage onCreate
"
)
globalThis
.
stageContext
=
this
.
context
;
}
onAcceptWant
(
want
)
{
console
.
log
(
"
[Demo] MyAbilityStage onAcceptWant called want:
"
+
JSON
.
stringify
(
want
));
let
abilityId
=
want
.
parameters
.
startId
.
toString
();
return
abilityId
;
}
onConfigurationUpdate
(
configuration
)
{
console
.
log
(
'
[Demo] MyAbilityStage onConfigurationUpdate:
'
+
JSON
.
stringify
(
configuration
));
}
}
\ No newline at end of file
ability/ability_runtime/apicover/formmodule/entry/src/main/ets/FormAbility/FormAbility.ts
浏览文件 @
44daaa71
import
FormExtension
from
'
@ohos.application.FormExtension
'
;
import
formBindingData
from
'
@ohos.app
lication
.formBindingData
'
;
import
formInfo
from
'
@ohos.app
lication
.formInfo
'
;
import
FormExtension
Ability
from
'
@ohos.app.form.FormExtensionAbility
'
;
import
formBindingData
from
'
@ohos.app
.form
.formBindingData
'
;
import
formInfo
from
'
@ohos.app
.form
.formInfo
'
;
export
default
class
FormModuleAbility
extends
FormExtension
{
on
Create
(
want
)
{
export
default
class
FormModuleAbility
extends
FormExtension
Ability
{
on
AddForm
(
want
)
{
// Called to return a FormBindingData object.
console
.
info
(
"
FormAbility onCreate
"
)
console
.
info
(
"
FormAbility onAddForm
"
)
globalThis
.
abilityContext
=
this
.
context
;
let
formData
=
{
};
return
formBindingData
.
createFormBindingData
(
formData
);
}
onCastToNormal
(
formId
)
{
onCastToNormal
Form
(
formId
)
{
// Called when the form provider is notified that a temporary form is successfully
// converted to a normal form.
}
onUpdate
(
formId
)
{
onUpdate
Form
(
formId
)
{
// Called to notify the form provider to update a specified form.
}
on
VisibilityChange
(
newStatus
)
{
on
ChangeFormVisibility
(
newStatus
)
{
// Called when the form provider receives form events from the system.
}
onEvent
(
formId
,
message
)
{
on
Form
Event
(
formId
,
message
)
{
// Called when a specified message event defined by the form provider is triggered.
}
on
Destroy
(
formId
)
{
on
RemoveForm
(
formId
)
{
// Called to notify the form provider that a specified form has been destroyed.
}
onConfigurationUpdate
(
configuration
)
{
console
.
log
(
'
FormAbility onConfigurationUpdate:
'
+
JSON
.
stringify
(
configuration
));
}
onAcquireFormState
(
want
)
{
// Called to return a {@link FormState} object.
return
formInfo
.
FormState
.
READY
;
}
onShareForm
(
formId
)
{
console
.
log
(
'
FormAbility onShareForm:
'
+
JSON
.
stringify
(
formId
));
return
{};
}
};
\ No newline at end of file
ability/ability_runtime/apicover/formmodule/entry/src/main/ets/ModuleAbility/ModuleAbility.ts
浏览文件 @
44daaa71
import
Ability
from
'
@ohos.application.Ability
'
import
Ability
from
'
@ohos.app.ability.Ability
'
import
AbilityConstant
from
"
../../../../../../../../../../../../interface/sdk-js/api/@ohos.app.ability.AbilityConstant
"
;
export
default
class
ModuleAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
console
.
log
(
"
[Demo] MainAbility onCreate
"
)
globalThis
.
abilityWant
=
want
;
globalThis
.
abilityContext
=
this
.
context
;
globalThis
.
abilityCallee
=
this
.
callee
;
}
onDestroy
()
{
...
...
@@ -22,6 +26,10 @@ export default class ModuleAbility extends Ability {
console
.
log
(
"
[Demo] MainAbility onWindowStageDestroy
"
)
}
onWindowStageRestore
(
windowStage
)
{
console
.
log
(
"
[Demo] MainAbility onWindowStageRestore
"
)
}
onForeground
()
{
// Ability has brought to foreground
console
.
log
(
"
[Demo] MainAbility onForeground
"
)
...
...
@@ -31,4 +39,19 @@ export default class ModuleAbility extends Ability {
// Ability has back to background
console
.
log
(
"
[Demo] MainAbility onBackground
"
)
}
onContinue
(
wantParam
)
{
console
.
log
(
"
[Demo] MainAbility onContinue
"
)
return
AbilityConstant
.
OnContinueResult
.
AGREE
;
}
onConfigurationUpdate
(
configuration
)
{
console
.
log
(
'
[Demo] MainAbility onConfigurationUpdate:
'
+
JSON
.
stringify
(
configuration
));
}
onDump
(
param
)
{
console
.
log
(
"
[Demo] MainAbility onDump:
"
+
JSON
.
stringify
(
param
))
return
[
"
MainAbility
"
]
}
};
ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js
浏览文件 @
44daaa71
...
...
@@ -14,6 +14,7 @@
*/
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
wantconstant
from
'
@ohos.ability.wantConstant
'
import
wantConstantNew
from
'
@ohos.app.ability.wantConstant
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
commonEvent
from
'
@ohos.commonEvent
'
import
particleAbility
from
'
@ohos.ability.particleAbility
'
...
...
@@ -152,6 +153,48 @@ describe('ActsFeatureAbilityTest', function () {
done
();
})
/**
* @tc.number: ACTS_wantConstant_0200
* @tc.name: wantConstant : Check specific enum
* @tc.desc: Check the return type of the interface (by Promise)
*/
it
(
'
ACTS_wantConstant_0200
'
,
0
,
async
function
(
done
)
{
expect
(
wantConstantNew
.
Action
.
ACTION_HOME
).
assertEqual
(
"
ohos.want.action.home
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_DIAL
).
assertEqual
(
"
ohos.want.action.dial
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_SEARCH
).
assertEqual
(
"
ohos.want.action.search
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_WIRELESS_SETTINGS
).
assertEqual
(
"
ohos.settings.wireless
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_MANAGE_APPLICATIONS_SETTINGS
)
.
assertEqual
(
"
ohos.settings.manage.applications
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_APPLICATION_DETAILS_SETTINGS
)
.
assertEqual
(
"
ohos.settings.application.details
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_SET_ALARM
).
assertEqual
(
"
ohos.want.action.setAlarm
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_SHOW_ALARMS
).
assertEqual
(
"
ohos.want.action.showAlarms
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_SNOOZE_ALARM
).
assertEqual
(
"
ohos.want.action.snoozeAlarm
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_DISMISS_ALARM
).
assertEqual
(
"
ohos.want.action.dismissAlarm
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_DISMISS_TIMER
).
assertEqual
(
"
ohos.want.action.dismissTimer
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_SEND_SMS
).
assertEqual
(
"
ohos.want.action.sendSms
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_CHOOSE
).
assertEqual
(
"
ohos.want.action.choose
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_SELECT
).
assertEqual
(
"
ohos.want.action.select
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_SEND_DATA
).
assertEqual
(
"
ohos.want.action.sendData
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_SEND_MULTIPLE_DATA
).
assertEqual
(
"
ohos.want.action.sendMultipleData
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_SCAN_MEDIA_FILE
).
assertEqual
(
"
ohos.want.action.scanMediaFile
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_VIEW_DATA
).
assertEqual
(
"
ohos.want.action.viewData
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_EDIT_DATA
).
assertEqual
(
"
ohos.want.action.editData
"
);
expect
(
wantConstantNew
.
Action
.
INTENT_PARAMS_INTENT
).
assertEqual
(
"
ability.want.params.INTENT
"
);
expect
(
wantConstantNew
.
Action
.
INTENT_PARAMS_TITLE
).
assertEqual
(
"
ability.want.params.TITLE
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_FILE_SELECT
).
assertEqual
(
"
ohos.action.fileSelect
"
);
expect
(
wantConstantNew
.
Action
.
PARAMS_STREAM
).
assertEqual
(
"
ability.params.stream
"
);
expect
(
wantConstantNew
.
Action
.
ACTION_APP_ACCOUNT_AUTH
).
assertEqual
(
"
account.appAccount.action.auth
"
);
expect
(
wantConstantNew
.
Entity
.
ENTITY_HOME
).
assertEqual
(
"
entity.system.home
"
);
expect
(
wantConstantNew
.
Entity
.
ENTITY_DEFAULT
).
assertEqual
(
"
entity.system.default
"
);
expect
(
wantConstantNew
.
Entity
.
ENTITY_VOICE
).
assertEqual
(
"
entity.system.voice
"
);
expect
(
wantConstantNew
.
Entity
.
ENTITY_BROWSABLE
).
assertEqual
(
"
entity.system.browsable
"
);
expect
(
wantConstantNew
.
Entity
.
ENTITY_VIDEO
).
assertEqual
(
"
entity.system.video
"
);
done
();
})
/**
* @tc.number: ACTS_GetContext_0100
* @tc.name: GetContext : Obtains the Context object
...
...
notification/ans_standard/actsNotificationWantAgentTest/src/main/js/test/ActsNotificationWantAgentNewTest.js
0 → 100644
浏览文件 @
44daaa71
/*
* 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
wantAgent
from
'
@ohos.app.ability.wantAgent
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
export
default
function
ActsNotificationWantAgentNewTest
()
{
describe
(
'
SUB_NOTIFICATION_ANS_WANT_AGENT_NEW_TEST
'
,
function
()
{
let
TAG
=
'
SUB_NOTIFICATION_ANS_WANT_AGENT_NEW_TEST ===>
'
console
.
info
(
TAG
+
'
SUB_NOTIFICATION_ANS_WANT_AGENT_NEW_TEST START
'
)
let
WantAgent
=
{}
let
wantAgentData1
=
{}
let
wantAgentData2
=
{}
let
WantAgentInfo
=
{
wants
:
[
{
deviceId
:
"
deviceId
"
,
bundleName
:
"
com.example.actsnotificationwantagent
"
,
abilityName
:
"
com.example.actsnotificationwantagent.MainAbility
"
,
action
:
"
action1
"
,
entities
:
[
"
entity1
"
],
type
:
"
MIMETYPE
"
,
uri
:
"
key={true,true,false}
"
,
parameters
:
{
myKey0
:
2222
,
myKey1
:
[
1
,
2
,
3
],
myKey2
:
"
[1, 2, 3]
"
,
myKey3
:
"
notification
"
,
myKey4
:
[
false
,
true
,
false
],
myKey5
:
[
"
ANS
"
,
"
WANT
"
,
"
AGENT
"
],
myKey6
:
true
}
}
],
operationType
:
wantAgent
.
OperationType
,
requestCode
:
0
,
wantAgentFlags
:
[
wantAgent
.
WantAgentFlags
],
extraInfo
:
{
key
:
'
WantAgentInfo_test
'
}
}
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0100
* @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void
* @tc.desc : OperationType.UNKNOWN_TYPE & WantAgentFlags.ONE_TIME_FLAG
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0100 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
UNKNOWN_TYPE
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
ONE_TIME_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0100 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0200
* @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void
* @tc.desc : OperationType.START_ABILITY & WantAgentFlags.NO_BUILD_FLAG
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0200 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITY
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
NO_BUILD_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0200 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0300
* @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void
* @tc.desc : OperationType.START_ABILITIES & WantAgentFlags.CANCEL_PRESENT_FLAG
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0300 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITIES
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
CANCEL_PRESENT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0300 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0400
* @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void
* @tc.desc : OperationType.START_SERVICE & WantAgentFlags.UPDATE_PRESENT_FLAG
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0400 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_SERVICE
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0400 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0500
* @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void
* @tc.desc : OperationType.SEND_COMMON_EVENT & WantAgentFlags.CONSTANT_FLAG
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0500 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
SEND_COMMON_EVENT
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
CONSTANT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0500 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0600
* @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void
* @tc.desc : OperationType.UNKNOWN_TYPE & WantAgentFlags.REPLACE_ELEMENT
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0600 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
UNKNOWN_TYPE
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
REPLACE_ELEMENT
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0600 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0700
* @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void
* @tc.desc : OperationType.START_ABILITY & WantAgentFlags.REPLACE_ACTION
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0700 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITY
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
REPLACE_ACTION
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0700 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0800
* @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void
* @tc.desc : OperationType.START_ABILITIES & WantAgentFlags.REPLACE_URI
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0800 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITIES
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
REPLACE_URI
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0800 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0900
* @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void
* @tc.desc : OperationType.START_SERVICE & WantAgentFlags.REPLACE_ENTITIES
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0900 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_SERVICE
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
REPLACE_ENTITIES
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_0900 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1000
* @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void
* @tc.desc : OperationType.SEND_COMMON_EVENT & WantAgentFlags.REPLACE_BUNDLE
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1000 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
SEND_COMMON_EVENT
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
REPLACE_BUNDLE
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1000 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1100
* @tc.name : function getWantAgent(info: WantAgentInfo): Promise<WantAgent>
* @tc.desc : OperationType.UNKNOWN_TYPE & WantAgentFlags.ONE_TIME_FLAG
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1100 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
UNKNOWN_TYPE
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
ONE_TIME_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
).
then
((
data
)
=>
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getWantAgent Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1100 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1200
* @tc.name : function getWantAgent(info: WantAgentInfo): Promise<WantAgent>
* @tc.desc : OperationType.START_ABILITY & WantAgentFlags.NO_BUILD_FLAG
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1200 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITY
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
NO_BUILD_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
).
then
((
data
)
=>
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getWantAgent Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1200 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1300
* @tc.name : function getWantAgent(info: WantAgentInfo): Promise<WantAgent>
* @tc.desc : OperationType.START_ABILITIES & WantAgentFlags.CANCEL_PRESENT_FLAG
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1300 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITIES
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
CANCEL_PRESENT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
).
then
((
data
)
=>
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getWantAgent Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1300 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1400
* @tc.name : function getWantAgent(info: WantAgentInfo): Promise<WantAgent>
* @tc.desc : OperationType.START_SERVICE & WantAgentFlags.UPDATE_PRESENT_FLAG
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1400 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_SERVICE
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
).
then
((
data
)
=>
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getWantAgent Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1400 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1500
* @tc.name : function getWantAgent(info: WantAgentInfo): Promise<WantAgent>
* @tc.desc : OperationType.SEND_COMMON_EVENT & WantAgentFlags.CONSTANT_FLAG
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1500 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
SEND_COMMON_EVENT
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
CONSTANT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
).
then
((
data
)
=>
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getWantAgent Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1500 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1600
* @tc.name : function getWantAgent(info: WantAgentInfo): Promise<WantAgent>
* @tc.desc : OperationType.UNKNOWN_TYPE & WantAgentFlags.REPLACE_ELEMENT
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1600 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
UNKNOWN_TYPE
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
REPLACE_ELEMENT
wantAgent
.
getWantAgent
(
WantAgentInfo
).
then
((
data
)
=>
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getWantAgent Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1600 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1700
* @tc.name : function getWantAgent(info: WantAgentInfo): Promise<WantAgent>
* @tc.desc : OperationType.START_ABILITY & WantAgentFlags.REPLACE_ACTION
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1700 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITY
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
REPLACE_ACTION
wantAgent
.
getWantAgent
(
WantAgentInfo
).
then
((
data
)
=>
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getWantAgent Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1700 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1800
* @tc.name : function getWantAgent(info: WantAgentInfo): Promise<WantAgent>
* @tc.desc : OperationType.START_ABILITIES & WantAgentFlags.REPLACE_URI
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1800 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITIES
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
REPLACE_URI
wantAgent
.
getWantAgent
(
WantAgentInfo
).
then
((
data
)
=>
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getWantAgent Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1800 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1900
* @tc.name : function getWantAgent(info: WantAgentInfo): Promise<WantAgent>
* @tc.desc : OperationType.START_SERVICE & WantAgentFlags.REPLACE_ENTITIES
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1900 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_SERVICE
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
REPLACE_ENTITIES
wantAgent
.
getWantAgent
(
WantAgentInfo
).
then
((
data
)
=>
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getWantAgent Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_1900 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2000
* @tc.name : function getWantAgent(info: WantAgentInfo): Promise<WantAgent>
* @tc.desc : OperationType.SEND_COMMON_EVENT & WantAgentFlags.REPLACE_BUNDLE
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2000 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
SEND_COMMON_EVENT
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
REPLACE_BUNDLE
wantAgent
.
getWantAgent
(
WantAgentInfo
).
then
((
data
)
=>
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getWantAgent Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2000 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2100
* @tc.name : function cancel(agent: WantAgent, callback: AsyncCallback<void>): void
* @tc.desc : Cancels a WantAgent
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2100 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITY
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
wantAgent
.
cancel
(
WantAgent
,
(
err
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
cancel AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
console
.
info
(
`
${
TAG
}
cancel AsyncCallback success`
)
expect
(
true
).
assertTrue
()
done
()
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2100 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2200
* @tc.name : function cancel(agent: WantAgent): Promise<void>
* @tc.desc : Cancels a WantAgent
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2200 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITY
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
).
then
((
data
)
=>
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getWantAgent Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
wantAgent
.
cancel
(
WantAgent
).
then
(()
=>
{
console
.
info
(
`
${
TAG
}
cancel Promise success`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
cancel Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2200 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2300
* @tc.name : function getBundleName(agent: WantAgent, callback: AsyncCallback<string>): void
* @tc.desc : Obtains the bundle name of a WantAgent.
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2300 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITY
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
wantAgent
.
getBundleName
(
WantAgent
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getBundleName AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
console
.
info
(
`
${
TAG
}
getBundleName AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
data
).
assertEqual
(
'
com.example.actsnotificationwantagent
'
)
done
()
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2300 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2400
* @tc.name : function getBundleName(agent: WantAgent): Promise<string>
* @tc.desc : Obtains the bundle name of a WantAgent
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2400 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITY
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
).
then
((
data
)
=>
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getWantAgent Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
wantAgent
.
getBundleName
(
WantAgent
)
.
then
((
data
)
=>
{
console
.
info
(
`
${
TAG
}
getBundleName Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
data
).
assertEqual
(
'
com.example.actsnotificationwantagent
'
)
done
()
})
.
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getBundleName Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2400 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2500
* @tc.name : function getUid(agent: WantAgent, callback: AsyncCallback<number>): void
* @tc.desc : Obtains the UID of a WantAgent
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2500 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITY
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
await
wantAgent
.
getUid
(
WantAgent
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getUid AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
console
.
info
(
`
${
TAG
}
getUid AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2500 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2600
* @tc.name : function getUid(agent: WantAgent): Promise<number>
* @tc.desc : Obtains the UID of a WantAgent
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2600 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITY
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
).
then
((
data
)
=>
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getWantAgent Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
await
wantAgent
.
getUid
(
WantAgent
).
then
((
data
)
=>
{
console
.
info
(
`
${
TAG
}
getUid Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getUid Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2600 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2700
* @tc.name : function equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback<boolean>): void
* @tc.desc : Checks whether two WantAgent objects are equal
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2700 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITY
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
wantAgentData1
=
data
wantAgentData2
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
wantAgent
.
equal
(
wantAgentData1
,
wantAgentData2
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
equal AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
console
.
info
(
`
${
TAG
}
equal AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
data
).
assertTrue
()
done
()
}
})
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2700 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2800
* @tc.name : function equal(agent: WantAgent, otherAgent: WantAgent): Promise<boolean>
* @tc.desc : Checks whether two WantAgent objects are equal
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2800 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITY
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
wantAgentData1
=
data
wantAgentData2
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
wantAgent
.
equal
(
wantAgentData1
,
wantAgentData2
).
then
((
data
)
=>
{
console
.
info
(
`
${
TAG
}
equal Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
data
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
equal Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2800 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2900
* @tc.name : function getOperationType(agent: WantAgent, callback: AsyncCallback<number>): void
* @tc.desc : Obtains the {@link OperationType} of a {@link WantAgent}
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2900 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITY
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
await
wantAgent
.
getOperationType
(
WantAgent
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getOperationType AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
console
.
info
(
`
${
TAG
}
getOperationType AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_2900 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_3000
* @tc.name : function getOperationType(agent: WantAgent): Promise<number>
* @tc.desc : Obtains the {@link OperationType} of a {@link WantAgent}
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_3000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_3000 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITY
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
).
then
((
data
)
=>
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getWantAgent Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
await
wantAgent
.
getOperationType
(
WantAgent
)
.
then
((
data
)
=>
{
console
.
info
(
`
${
TAG
}
getOperationType Promise success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
true
).
assertTrue
()
done
()
})
.
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getOperationType Promise err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_3000 END`
)
})
/*
* @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_3100
* @tc.name : function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback<CompleteData>): void
* @tc.desc : Triggers a WantAgent
*/
it
(
'
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_3100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_3100 START`
)
WantAgentInfo
.
operationType
=
wantAgent
.
OperationType
.
START_ABILITY
WantAgentInfo
.
wantAgentFlags
=
wantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
wantAgent
.
getWantAgent
(
WantAgentInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback err:
${
err
.
code
}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
WantAgent
=
data
console
.
info
(
`
${
TAG
}
getWantAgent AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
let
triggerInfo
=
{
code
:
0
,
want
:
{
deviceId
:
"
deviceId
"
,
bundleName
:
"
com.example.actsnotificationwantagent
"
,
abilityName
:
"
com.example.actsnotificationwantagent.MainAbility
"
,
action
:
"
action1
"
,
entities
:
[
"
entity1
"
],
type
:
"
MIMETYPE
"
,
uri
:
"
key={true,true,false}
"
,
parameters
:
{
myKey0
:
2222
,
myKey1
:
[
1
,
2
,
3
],
myKey2
:
"
[1, 2, 3]
"
,
myKey3
:
"
notification
"
,
myKey4
:
[
false
,
true
,
false
],
myKey5
:
[
"
ANS
"
,
"
WANT
"
,
"
AGENT
"
],
myKey6
:
true
,
}
},
permission
:
''
,
extraInfo
:
{
test
:
'
this is a test value
'
}
}
wantAgent
.
trigger
(
WantAgent
,
triggerInfo
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
trigger AsyncCallback err:
${
JSON
.
stringify
(
err
)}
`
)
expect
(
false
).
assertTrue
()
done
()
}
else
{
console
.
info
(
`
${
TAG
}
trigger AsyncCallback success:
${
JSON
.
stringify
(
data
)}
`
)
expect
(
typeof
(
data
.
wantAgent
)).
assertEqual
(
'
object
'
)
expect
(
data
.
finalCode
).
assertEqual
(
0
)
expect
(
data
.
finalData
).
assertEqual
(
''
)
expect
(
typeof
(
data
.
extraInfo
)).
assertEqual
(
'
object
'
)
expect
(
data
.
want
.
deviceId
).
assertEqual
(
'
deviceId
'
)
expect
(
data
.
want
.
bundleName
).
assertEqual
(
'
com.example.actsnotificationwantagent
'
)
expect
(
data
.
want
.
abilityName
).
assertEqual
(
'
com.example.actsnotificationwantagent.MainAbility
'
)
done
()
}
})
}
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_ANS_GET_WANT_AGENT_NEW_TEST_3100 END`
)
})
console
.
info
(
TAG
+
'
SUB_NOTIFICATION_ANS_WANT_AGENT_NEW_TEST END
'
)
})
}
notification/ans_standard/actsNotificationWantAgentTest/src/main/js/test/List.test.js
浏览文件 @
44daaa71
...
...
@@ -13,6 +13,8 @@
* limitations under the License.
*/
import
ActsNotificationWantAgentTest
from
'
./ActsNotificationWantAgentTest.js
'
import
ActsNotificationWantAgentNewTest
from
'
./ActsNotificationWantAgentNewTest.js
'
export
default
function
testsuite
()
{
ActsNotificationWantAgentTest
()
ActsNotificationWantAgentNewTest
()
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录