Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
ca576395
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ca576395
编写于
6月 20, 2022
作者:
L
liangzhenyu123
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
liangzhenyu6@huawei.com
Signed-off-by:
N
liangzhenyu123
<
liangzhenyu6@huawei.com
>
上级
ad2c1d9d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
47 addition
and
63 deletion
+47
-63
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/RdbstoreRdbstoreJsunit.test.js
...p/src/main/js/default/test/RdbstoreRdbstoreJsunit.test.js
+1
-58
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StoragePromiseJsunit.test.js
...hap/src/main/js/default/test/StoragePromiseJsunit.test.js
+42
-1
distributeddatamgr/distributeddataObjectjstest/hap/src/main/js/default/test/ObjectStoreJsunit.test.js
...st/hap/src/main/js/default/test/ObjectStoreJsunit.test.js
+4
-4
未找到文件。
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/RdbstoreRdbstoreJsunit.test.js
浏览文件 @
ca576395
...
@@ -169,63 +169,6 @@ describe('rdbStoreTest', function () {
...
@@ -169,63 +169,6 @@ describe('rdbStoreTest', function () {
done
();
done
();
console
.
log
(
TAG
+
"
************* testRdbStore0005 end *************
"
);
console
.
log
(
TAG
+
"
************* testRdbStore0005 end *************
"
);
})
})
/**
* @tc.name rdb store deleteRdbStore
* @tc.number SUB_DDM_AppDataFWK_JSRDB_RdbStore_0060
* @tc.desc rdb store deleteRdbStore
*/
// it('testRdbStore0006', 0, async function (done) {
// console.log(TAG + "************* testRdbStore0006 start *************");
//
// let storePromise = dataRdb.getRdbStore(STORE_CONFIG, 4);
// storePromise.then(async (store) => {
// try {
// await store.executeSql(CREATE_TABLE_TEST);
// let deletePromise = dataRdb.deleteRdbStore("rdbstore.db")
// deletePromise.then(()=>{
// console.log(TAG + "deleteRdbStore promise done" + store);
// expect(true).assertTrue();
// })
// } catch (e) {
// expect(null).assertFail();
// }
// }).catch((err) => {
// expect(null).assertFail();
// })
// await storePromise
// storePromise = null
// done();
// console.log(TAG + "************* testRdbStore0006 end *************");
// })
/**
* @tc.name rdb store deleteRdbStore
* @tc.number SUB_DDM_AppDataFWK_JSRDB_RdbStore_0070
* @tc.desc rdb store deleteRdbStore
*/
it
(
'
testRdbStore0007
'
,
0
,
async
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testRdbStore0007 start *************
"
);
let
storePromise
=
dataRdb
.
getRdbStore
(
STORE_CONFIG
,
6
);
storePromise
.
then
(
async
(
store
)
=>
{
try
{
await
store
.
executeSql
(
CREATE_TABLE_TEST
);
let
deletePromise
=
dataRdb
.
deleteRdbStore
(
"
rdbstore.db
"
)
deletePromise
.
then
(()
=>
{
console
.
log
(
TAG
+
"
deleteRdbStore promise done
"
+
store
);
expect
(
true
).
assertTrue
();
})
}
catch
(
e
)
{
expect
(
null
).
assertFail
();
}
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
})
await
storePromise
storePromise
=
null
done
();
console
.
log
(
TAG
+
"
************* testRdbStore0007 end *************
"
);
})
console
.
log
(
TAG
+
"
*************Unit Test End*************
"
);
console
.
log
(
TAG
+
"
*************Unit Test End*************
"
);
})
})
\ No newline at end of file
distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StoragePromiseJsunit.test.js
浏览文件 @
ca576395
...
@@ -21,6 +21,8 @@ const KEY_TEST_LONG_ELEMENT = 'key_test_long';
...
@@ -21,6 +21,8 @@ const KEY_TEST_LONG_ELEMENT = 'key_test_long';
const
KEY_TEST_FLOAT_ELEMENT
=
'
key_test_float
'
;
const
KEY_TEST_FLOAT_ELEMENT
=
'
key_test_float
'
;
const
KEY_TEST_BOOLEAN_ELEMENT
=
'
key_test_boolean
'
;
const
KEY_TEST_BOOLEAN_ELEMENT
=
'
key_test_boolean
'
;
const
KEY_TEST_STRING_ELEMENT
=
'
key_test_string
'
;
const
KEY_TEST_STRING_ELEMENT
=
'
key_test_string
'
;
const
MAX_KEY_LENGTH
=
'
X
'
.
repeat
(
32
)
const
MAX_VALUE_LENGTH
=
'
y
'
.
repeat
(
8191
)
var
mPref
;
var
mPref
;
describe
(
'
storageTest
'
,
function
()
{
describe
(
'
storageTest
'
,
function
()
{
...
@@ -380,7 +382,7 @@ describe('storageTest', function () {
...
@@ -380,7 +382,7 @@ describe('storageTest', function () {
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0200
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0200
* @tc.desc Maximum length of key test
* @tc.desc Maximum length of key test
*/
*/
it
(
'
testMaxLengthofKe
t
y0200
'
,
0
,
async
function
(
done
){
it
(
'
testMaxLengthofKey0200
'
,
0
,
async
function
(
done
){
mPref
.
clearSync
();
mPref
.
clearSync
();
const
promise
=
mPref
.
put
(
MAX_KEY_LENGTH
,
"
value1
"
)
const
promise
=
mPref
.
put
(
MAX_KEY_LENGTH
,
"
value1
"
)
promise
.
then
((
ret
)
=>
{
promise
.
then
((
ret
)
=>
{
...
@@ -449,4 +451,43 @@ describe('storageTest', function () {
...
@@ -449,4 +451,43 @@ describe('storageTest', function () {
await
promise
;
await
promise
;
done
();
done
();
})
})
/**
* @tc.name Maximum length of key test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0240
* @tc.desc Maximum length of key test
*/
it
(
'
testMaxLengthofKey0240
'
,
0
,
async
function
(
done
){
mPref
.
putSync
(
MAX_KEY_LENGTH
,
"
value1
"
);
expect
(
"
value1
"
).
assertEqual
(
mPref
.
getSync
(
MAX_KEY_LENGTH
,
"
default
"
));
const
promise
=
mPref
.
delete
(
MAX_KEY_LENGTH
);
promise
.
then
((
ret
)
=>
{
expect
(
"
default
"
).
assertEqual
(
mPref
.
getSync
(
MAX_KEY_LENGTH
,
"
default
"
));
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
});
await
promise
;
done
();
})
/**
* @tc.name Maximum length of value test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0250
* @tc.desc Maximum length of value test
*/
it
(
'
testMaxLengthofValue0250
'
,
0
,
async
function
(
done
)
{
mPref
.
clearSync
();
mPref
.
putSync
(
"
test
"
,
MAX_VALUE_LENGTH
)
const
promise
=
mPref
.
put
(
"
test
"
,
"
y
"
.
repeat
(
8192
));
promise
.
then
((
ret
)
=>
{
expect
(
MAX_VALUE_LENGTH
).
assertEqual
(
mPref
.
getSync
(
"
test
"
,
"
defaultvalue
"
));
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
});
await
promise
;
mPref
.
putSync
(
"
test
"
,
MAX_VALUE_LENGTH
)
expect
(
MAX_VALUE_LENGTH
).
assertEqual
(
mPref
.
getSync
(
"
test
"
,
"
defaultvalue
"
));
done
();
})
})
})
distributeddatamgr/distributeddataObjectjstest/hap/src/main/js/default/test/ObjectStoreJsunit.test.js
浏览文件 @
ca576395
...
@@ -57,8 +57,8 @@ function statusCallback3(sessionId, networkId, status) {
...
@@ -57,8 +57,8 @@ function statusCallback3(sessionId, networkId, status) {
}
}
function
sleep
(
delay
)
{
function
sleep
(
delay
)
{
var
start
=
(
new
Date
()).
getTime
();
var
start
=
(
new
Date
()).
getTime
();
while
((
new
Date
()).
getTime
()
-
start
<
delay
)
{
while
((
new
Date
()).
getTime
()
-
start
>=
delay
)
{
continue
;
break
;
}
}
}
}
...
@@ -72,10 +72,10 @@ describe('objectStoreTest', function () {
...
@@ -72,10 +72,10 @@ describe('objectStoreTest', function () {
console
.
info
(
"
====>beforeAll start====
"
);
console
.
info
(
"
====>beforeAll start====
"
);
var
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.distributeddataObject
'
,
0
,
100
);
var
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.distributeddataObject
'
,
0
,
100
);
tokenID
=
appInfo
.
accessTokenId
;
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
"
accessTokenId
"
+
appInfo
.
accessTokenId
+
"
bundleName:
"
+
appInfo
.
name
);
console
.
info
(
"
bundleName:
"
+
appInfo
.
name
);
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
atManager
=
abilityAccessCtrl
.
createAtManager
();
var
result
=
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
PERMISSION_USER_NAME
,
PERMISSION_USER_SET
);
var
result
=
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
PERMISSION_USER_NAME
,
PERMISSION_USER_SET
);
console
.
info
(
"
tokenId
"
+
tokenID
+
"
result:
"
+
result
);
console
.
info
(
"
result:
"
+
result
);
sleep
(
TIMEOUT
);
sleep
(
TIMEOUT
);
console
.
debug
(
"
====>beforeAll end====
"
);
console
.
debug
(
"
====>beforeAll end====
"
);
done
();
done
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录