Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
646aba9f
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看板
提交
646aba9f
编写于
12月 26, 2022
作者:
Z
zhuhongtao66
提交者:
futurezhou
12月 29, 2022
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add xts for mod_securitylabel and mod_statfs
Signed-off-by:
N
zhuhongtao66
<
zhuhongtao12@huawei.com
>
上级
3de19324
变更
6
展开全部
显示空白变更内容
内联
并排
Showing
6 changed file
with
934 addition
and
550 deletion
+934
-550
storage/storagesecuritylabeljstest/src/main/js/test/Common.js
...age/storagesecuritylabeljstest/src/main/js/test/Common.js
+5
-3
storage/storagesecuritylabeljstest/src/main/js/test/List.test.js
.../storagesecuritylabeljstest/src/main/js/test/List.test.js
+2
-2
storage/storagesecuritylabeljstest/src/main/js/test/securitylabel.test.js
...ecuritylabeljstest/src/main/js/test/securitylabel.test.js
+625
-543
storage/storagestatfsjstest/src/main/js/test/Common.js
storage/storagestatfsjstest/src/main/js/test/Common.js
+3
-1
storage/storagestatfsjstest/src/main/js/test/List.test.js
storage/storagestatfsjstest/src/main/js/test/List.test.js
+3
-1
storage/storagestatfsjstest/src/main/js/test/statvfs.test.js
storage/storagestatfsjstest/src/main/js/test/statvfs.test.js
+296
-0
未找到文件。
storage/storagesecuritylabeljstest/src/main/js/test/Common.js
浏览文件 @
646aba9f
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Copyright (C) 2021
-2022
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
...
...
@@ -13,8 +13,9 @@
* limitations under the License.
*/
import
securityLabel
from
'
@ohos.securityLabel
'
;
import
securityLabel
from
'
@ohos.
file.
securityLabel
'
;
import
fileio
from
'
@ohos.fileio
'
;
import
fileIO
from
'
@ohos.file.fs
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
...
...
@@ -35,5 +36,6 @@ export {
it
,
expect
,
securityLabel
,
fileio
fileio
,
fileIO
};
\ No newline at end of file
storage/storagesecuritylabeljstest/src/main/js/test/List.test.js
浏览文件 @
646aba9f
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import
securitylabel
from
'
./securitylabel.test.js
'
import
security
_
label
from
'
./securitylabel.test.js
'
export
default
function
testsuite
()
{
security
label
()
security_
label
()
}
storage/storagesecuritylabeljstest/src/main/js/test/securitylabel.test.js
浏览文件 @
646aba9f
此差异已折叠。
点击以展开。
storage/storagestatfsjstest/src/main/js/test/Common.js
浏览文件 @
646aba9f
...
...
@@ -14,6 +14,7 @@
*/
import
statfs
from
'
@ohos.statfs
'
;
import
statvfs
from
'
@ohos.file.statvfs
'
export
const
FILE_CONTENT
=
'
hello world
'
;
...
...
@@ -32,5 +33,6 @@ export {
afterAll
,
it
,
expect
,
statfs
statfs
,
statvfs
};
\ No newline at end of file
storage/storagestatfsjstest/src/main/js/test/List.test.js
浏览文件 @
646aba9f
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Copyright (C) 2021
-2022
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
...
...
@@ -14,6 +14,8 @@
*/
import
statfs_test
from
'
./statfs.test.js
'
import
statvfs_test
from
'
./statvfs.test.js
'
export
default
function
testsuite
()
{
statfs_test
()
statvfs_test
()
}
storage/storagestatfsjstest/src/main/js/test/statvfs.test.js
0 → 100644
浏览文件 @
646aba9f
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
it
,
expect
,
isIntNum
,
statvfs
}
from
'
./Common
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
export
default
function
statvfs_test
()
{
describe
(
'
statvfs_test
'
,
function
()
{
/**
* @tc.number SUB_DF_STATFS_GET_FREE_SIZE_0000
* @tc.name statvfs_test_get_free_size_async_000
* @tc.desc Test getFreeSize() interfaces, when the path is a sandbox path, promise way back.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statvfs_test_get_free_size_async_000
'
,
0
,
async
function
(
done
)
{
try
{
let
context
=
featureAbility
.
getContext
();
let
data
=
await
context
.
getFilesDir
();
let
number
=
await
statvfs
.
getFreeSize
(
data
);
console
.
log
(
"
getFreeSize getFilesDir===>
"
+
(
number
/
1024
));
expect
(
isIntNum
(
number
)).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
statvfs_test_get_free_size_async_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
}
});
/**
* @tc.number SUB_DF_STATFS_GET_FREE_SIZE_0100
* @tc.name statvfs_test_get_free_size_async_001
* @tc.desc Test getFreeSize() interfaces, when the path is dev, callback way back.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statvfs_test_get_free_size_async_001
'
,
0
,
async
function
(
done
)
{
try
{
statvfs
.
getFreeSize
(
"
/dev
"
,
(
err
,
number
)
=>
{
if
(
err
)
{
console
.
log
(
'
statvfs_test_get_free_size_async_001 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
console
.
log
(
"
getFreeSizeNumber dev===>:
"
+
(
number
/
1024
));
expect
(
isIntNum
(
number
)).
assertTrue
();
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
statvfs_test_get_free_size_async_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
}
});
/**
* @tc.number SUB_DF_STATFS_GET_FREE_SIZE_0200
* @tc.name statvfs_test_get_free_size_async_002
* @tc.desc Test getFreeSize() interfaces, when the parameter type is wrong.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statvfs_test_get_free_size_async_002
'
,
0
,
async
function
(
done
)
{
try
{
await
statvfs
.
getFreeSize
(
1
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
console
.
log
(
'
statvfs_test_get_free_size_async_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
"
Invalid argument
"
).
assertTrue
();
done
();
}
});
/**
* @tc.number SUB_DF_STATFS_GET_FREE_SIZE_0300
* @tc.name statvfs_test_get_free_size_async_003
* @tc.desc Test getFreeSize() interfaces, when there are no parameters.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statvfs_test_get_free_size_async_003
'
,
0
,
async
function
(
done
)
{
try
{
await
statvfs
.
getFreeSize
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
console
.
log
(
'
statvfs_test_get_free_size_async_003 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
"
Invalid argument
"
).
assertTrue
();
done
();
}
});
/**
* @tc.number SUB_DF_STATFS_GET_FREE_SIZE_0400
* @tc.name statvfs_test_get_free_size_async_004
* @tc.desc Test getFreeSize() interfaces, when the path is empty.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statvfs_test_get_free_size_async_004
'
,
0
,
async
function
(
done
)
{
try
{
await
statvfs
.
getFreeSize
(
""
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
console
.
log
(
'
statvfs_test_get_free_size_async_004 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900002
&&
e
.
message
==
'
No such file or directory
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number SUB_DF_STATFS_GET_FREE_SIZE_0500
* @tc.name statvfs_test_get_free_size_async_005
* @tc.desc Test getFreeSize() interfaces, when the path is empty.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statvfs_test_get_free_size_async_005
'
,
0
,
async
function
(
done
)
{
try
{
statvfs
.
getFreeSize
(
""
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
statvfs_test_get_free_size_async_005 error package: {
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
expect
(
err
.
code
==
13900002
&&
err
.
message
==
'
No such file or directory
'
).
assertTrue
();
done
();
}
});
}
catch
(
e
)
{
console
.
log
(
'
statvfs_test_get_free_size_async_005 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
}
});
/**
* @tc.number SUB_DF_STATFS_GET_TOTAL_SIZE_0000
* @tc.name statvfs_test_get_total_size_async_000
* @tc.desc Test getTotalSize() interfaces, when the path is a sandbox path, promise way back.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statvfs_test_get_total_size_async_000
'
,
0
,
async
function
(
done
)
{
try
{
let
context
=
featureAbility
.
getContext
();
let
data
=
await
context
.
getFilesDir
();
let
number
=
await
statvfs
.
getTotalSize
(
data
);
console
.
log
(
"
getTotalSizeNumber GetFilesDir====>:
"
+
(
number
/
1024
));
expect
(
isIntNum
(
number
)).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
statvfs_test_get_total_size_async_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
}
});
/**
* @tc.number SUB_DF_STATFS_GET_TOTAL_SIZE_0100
* @tc.name statvfs_test_get_total_size_async_001
* @tc.desc Test getTotalSize() interfaces, when the path is dev, callback way back.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statvfs_test_get_total_size_async_001
'
,
0
,
async
function
(
done
)
{
try
{
statvfs
.
getTotalSize
(
"
/dev
"
,
(
err
,
number
)
=>
{
if
(
err
)
{
console
.
log
(
'
statvfs_test_get_total_size_async_001 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
console
.
log
(
"
getTotalSizeNumber dev===>:
"
+
(
number
/
1024
));
expect
(
isIntNum
(
number
)).
assertTrue
();
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
statvfs_test_get_total_size_async_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
}
});
/**
* @tc.number SUB_DF_STATFS_GET_TOTAL_SIZE_0200
* @tc.name statvfs_test_get_total_size_async_002
* @tc.desc Test getTotalSize() interfaces, when the parameter type is wrong.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statvfs_test_get_total_size_async_002
'
,
0
,
async
function
(
done
)
{
try
{
await
statvfs
.
getTotalSize
(
1
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
console
.
log
(
'
statvfs_test_get_total_size_async_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
"
Invalid argument
"
).
assertTrue
();
done
();
}
});
/**
* @tc.number SUB_DF_STATFS_GET_TOTAL_SIZE_0300
* @tc.name statvfs_test_get_total_size_async_003
* @tc.desc Test getTotalSize() interfaces, when there are no parameters.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statvfs_test_get_total_size_async_003
'
,
0
,
async
function
(
done
)
{
try
{
await
statvfs
.
getTotalSize
();
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
console
.
log
(
'
statvfs_test_get_total_size_async_003 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
"
Invalid argument
"
).
assertTrue
();
done
();
}
});
/**
* @tc.number SUB_DF_STATFS_GET_TOTAL_SIZE_0400
* @tc.name statvfs_test_get_total_size_async_004
* @tc.desc Test getTotalSize() interfaces, when the path is empty.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statvfs_test_get_total_size_async_004
'
,
0
,
async
function
(
done
)
{
try
{
await
statvfs
.
getTotalSize
(
""
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
console
.
log
(
'
statvfs_test_get_total_size_async_004 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900002
&&
e
.
message
==
'
No such file or directory
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number SUB_DF_STATFS_GET_TOTAL_SIZE_0500
* @tc.name statvfs_test_get_total_size_async_005
* @tc.desc Test getTotalSize() interfaces, when the path is empty.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statvfs_test_get_total_size_async_005
'
,
0
,
async
function
(
done
)
{
try
{
statvfs
.
getTotalSize
(
""
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
statvfs_test_get_total_size_async_005 error package: {
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
expect
(
err
.
code
==
13900002
&&
err
.
message
==
'
No such file or directory
'
).
assertTrue
();
done
();
}
});
}
catch
(
e
)
{
console
.
log
(
'
statvfs_test_get_total_size_async_004 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
}
});
});
}
鸿蒙社区
@harmonycommunity
mentioned in commit
5d680271
·
1月 12, 2023
mentioned in commit
5d680271
mentioned in commit 5d68027145231b6e37788a9f7fa5577bbda6f23d
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录