diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.json new file mode 100644 index 0000000000000000000000000000000000000000..37cef49bd87fa09c35822d979093798aadf1d28e --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_0100.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.py new file mode 100644 index 0000000000000000000000000000000000000000..fe77038dc3169016feb22619843ccc9ecf962df1 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0100.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_0100(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls /proc/%d/root/storage" % pid).split() + content = ["External", "Users", "hmdfs"] + for i in content: + self.driver.Assert.contains(result, i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.json new file mode 100644 index 0000000000000000000000000000000000000000..23a17d16f2c734984e35f583147293c8d2d96cf2 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_0200.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.py new file mode 100644 index 0000000000000000000000000000000000000000..b343eb5815da28373ae304cdda108cdbf8078ea8 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0200.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_0200(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser" % pid).split() + content = ["Desktop", "Documents", "Download", "appdata"] + for i in content: + self.driver.Assert.contains(result, i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.json new file mode 100644 index 0000000000000000000000000000000000000000..f165385e59d55eec15257c4f11b719d63df08e01 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_0300.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.py new file mode 100644 index 0000000000000000000000000000000000000000..445058d92d8269d7ca9b0a4f9fca8f99d795d740 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0300.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_0300(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls -Z /proc/%d/root/storage/Users/currentUser/appdata" % pid) + content = ["el1", "el2"] + for i in content: + self.driver.Assert.contains(result, "u:object_r:sharefs:s0 %s" % i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.json new file mode 100644 index 0000000000000000000000000000000000000000..59bc7747fd111f6440a82c0b80023e6315dd1979 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_0400.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.py new file mode 100644 index 0000000000000000000000000000000000000000..d3dee7c606bcea31d78a03ef53214b8a681e68b5 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0400.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_0400(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls -Z /proc/%d/root/storage/Users/currentUser/appdata/el2" % pid) + content = ["base", "distributedfiles", "cloud"] + for i in content: + self.driver.Assert.contains(result, "u:object_r:sharefs:s0 %s" % i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.json new file mode 100644 index 0000000000000000000000000000000000000000..54a9ac3cb59f242c45b1197e94e13a256ef2f6e3 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_0500.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.py new file mode 100644 index 0000000000000000000000000000000000000000..d02268c621f9e79d98498c4c3cdd2a3d45facd86 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0500.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_0500(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + count = 0 + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + for i in range(1, 3): + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el%d/base" % (pid, i)).split() + for bundle_name in result: + if "com.huawei" in bundle_name or "com.ohos" in bundle_name: + count += 1 + self.driver.Assert.greater(count, 0) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.json new file mode 100644 index 0000000000000000000000000000000000000000..6a121bdec22fc685c7e9ed15f064eefeefd95509 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_0600.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.py new file mode 100644 index 0000000000000000000000000000000000000000..70aad1087c7835bca48a7b6796f036e5c536dfdb --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0600.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_0600(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls -Z /proc/%d/root/storage/Users/currentUser/appdata/el1" % pid) + self.driver.Assert.contains(result, "u:object_r:sharefs:s0 base") + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.json new file mode 100644 index 0000000000000000000000000000000000000000..a121ad733dec949c54107f40449718bb52e68c53 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_0700.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.py new file mode 100644 index 0000000000000000000000000000000000000000..eedbd0c994b04d1d6659a56e368778038ffd422b --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0700.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_0700(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + count = 0 + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el2/distributedfiles" % pid,).split() + for bundle_name in result: + if "com.huawei" in bundle_name or "com.ohos" in bundle_name: + count += 1 + self.driver.Assert.greater(count, 0) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.json new file mode 100644 index 0000000000000000000000000000000000000000..6287a7412862c2e01b9807fb74fa3ee5a8681a15 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_0800.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.py new file mode 100644 index 0000000000000000000000000000000000000000..a6eb0537193fbb9b7030df2d0be27a5150e75fee --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0800.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_0800(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + count = 0 + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el2/cloud" % pid,).split() + for bundle_name in result: + if "com.huawei" in bundle_name or "com.ohos" in bundle_name: + count += 1 + self.driver.Assert.greater(count, 0) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.json new file mode 100644 index 0000000000000000000000000000000000000000..263ddb3ea44f7380a63443bdb3f09910c00f0cc2 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_0900.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.py new file mode 100644 index 0000000000000000000000000000000000000000..483ca0d9da92aa8262fd9c9d4f1334a8083b12e6 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_0900.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_0900(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global file_mgr + count = 0 + file_mgr = "com.huawei.hmos.filemanager" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(file_mgr) + time.sleep(3) + pid = self.driver.System.get_pid(file_mgr) + result = self.driver.shell("ls -Z /proc/%d/root/storage" % pid,).split() + for i in result: + if "sharefs" in i: + count += 1 + self.driver.Assert.equal(count, 0) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(file_mgr) + self.driver.AppManager.stop_app(file_mgr) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.json new file mode 100644 index 0000000000000000000000000000000000000000..93fd80459e4c7e1c17fe21a6a4c5bb3abd9c9cdd --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_1000.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.py new file mode 100644 index 0000000000000000000000000000000000000000..fadacf1cad49301c521e57e4443bb365c437bdd8 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1000.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_1000(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls /proc/%d/root/storage" % pid) + content = ["External", "Users", "hmdfs"] + for i in content: + self.driver.Assert.contains(result, i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.json new file mode 100644 index 0000000000000000000000000000000000000000..30d9d7f62378d9a2ad938624cbda00e6c884e732 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_1100.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.py new file mode 100644 index 0000000000000000000000000000000000000000..edb2d53e0a867cca2bfa394146e6bccf7ee4b817 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1100.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_1100(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser" % pid) + content = ["Desktop", "Documents", "Download", "appdata"] + for i in content: + self.driver.Assert.contains(result, i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.json new file mode 100644 index 0000000000000000000000000000000000000000..acdc15170a6b519b2f4df69b18c5cb4a264ac3b6 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_1200.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.py new file mode 100644 index 0000000000000000000000000000000000000000..8222ed2b930b88c971050784432a1417ab38056d --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1200.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_1200(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls -Z /proc/%d/root/storage" % pid) + content = ["External", "hmdfs", "Users"] + for i in content: + self.driver.Assert.contains(result, "u:object_r:sharefs:s0 %s" % i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.json new file mode 100644 index 0000000000000000000000000000000000000000..8a32ef90b0d7220b682a35bdcd85d21e66d714ed --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_1300.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.py new file mode 100644 index 0000000000000000000000000000000000000000..ba97e8b42419b4100ae82729ab51ff6bb5d95986 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1300.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_1300(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls -Z /proc/%d/root/storage/Users" % pid).rsplit("\n") + self.driver.Assert.equal(result[0], "u:object_r:sharefs:s0 currentUser") + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.json new file mode 100644 index 0000000000000000000000000000000000000000..996a4fa5fd75980aba46c155141c9795d72d8ccb --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_1400.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.py new file mode 100644 index 0000000000000000000000000000000000000000..0ed88b1861e654fa2be42ef3a091a5c4e0293df0 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1400.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_1400(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata" % pid).split() + content = ["el1", "el2"] + for i in content: + self.driver.Assert.contains(result, i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.json new file mode 100644 index 0000000000000000000000000000000000000000..54bd33bda1b98607dbb05ac151b5e311fbb876ce --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_1500.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.py new file mode 100644 index 0000000000000000000000000000000000000000..cbf790e855cc5e7e70156f6577922f8c96c8b422 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1500.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_1500(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls -Z /proc/%d/root/storage/Users/currentUser/appdata/el2" % pid) + content = ["base", "distributedfiles", "cloud"] + for i in content: + self.driver.Assert.contains(result, "sharefs_appdata_file:s0 %s" % i) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.json new file mode 100644 index 0000000000000000000000000000000000000000..72687bc77325e4e862fae808a89d57106b69da71 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_1600.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.py new file mode 100644 index 0000000000000000000000000000000000000000..ff97c3fb558319f90205ec78ea9fc3afe79927ca --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1600.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_1600(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + count = 0 + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + for i in range(1, 3): + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el%d/base" % (pid, i)).split() + for bundle_name in result: + if "com.huawei" in bundle_name or "com.ohos" in bundle_name: + count += 1 + self.driver.Assert.greater(count, 0) + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.json new file mode 100644 index 0000000000000000000000000000000000000000..2812a80cc0b7bef17b709d117f6b7a171b8d6314 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_1700.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.py new file mode 100644 index 0000000000000000000000000000000000000000..5470fad519286ebf263245615c384de83db050c1 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1700.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_1700(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls -Z /proc/%d/root/storage/Users/currentUser/appdata/el1" % pid).split("\n") + self.driver.Assert.equal(result[0], "u:object_r:sharefs_appdata_file:s0 base") + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1800.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1800.json new file mode 100644 index 0000000000000000000000000000000000000000..4c99d75a3aef8f4f60f0d8727b6ee6a89e40a633 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1800.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_1800.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1800.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1800.py new file mode 100644 index 0000000000000000000000000000000000000000..63745571bb67816753ed667d5018056f2a517dc0 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1800.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_1800(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + count = 0 + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el2/distributedfiles" % pid).split() + for bundle_name in result: + if "com.huawei" in bundle_name or "com.ohos" in bundle_name: + count += 1 + self.driver.Assert.greater(count, 0) + + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1900.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1900.json new file mode 100644 index 0000000000000000000000000000000000000000..2317c21eb2ef1d92487dd852ef9a7eccf7a8c009 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1900.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_1900.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1900.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1900.py new file mode 100644 index 0000000000000000000000000000000000000000..22558db9e0a9826516607acf1e7ec80c4739402d --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_1900.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_1900(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + count = 0 + notepad = "com.huawei.hmos.notepad" + self.driver.shell("echo 0 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el2/cloud" % pid).split() + for bundle_name in result: + if "com.huawei" in bundle_name or "com.ohos" in bundle_name: + count += 1 + self.driver.Assert.greater(count, 0) + + + def teardown(self): + Step("收尾工作.................") + self.driver.shell("echo 1 > /proc/sys/kernel/dec/dec_mode") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2000.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2000.json new file mode 100644 index 0000000000000000000000000000000000000000..02b26feb95f9c42de609a7104f0f434a7390b03a --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2000.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_2000.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2000.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2000.py new file mode 100644 index 0000000000000000000000000000000000000000..1e6eb9b327487ad6a75ecf75eded060a164ee733 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2000.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_2000(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser" % pid) + self.driver.Assert.contains(result, "Operation not permitted") + + def teardown(self): + Step("收尾工作.................") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2100.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2100.json new file mode 100644 index 0000000000000000000000000000000000000000..408fde332d0bc2a37dc633fcf906b61a4283f58d --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2100.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_2100.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2100.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2100.py new file mode 100644 index 0000000000000000000000000000000000000000..1c568221f2bcfa9fb0a29e91cfc4907a9339dd3c --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2100.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_2100(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata" % pid) + self.driver.Assert.contains(result, "Operation not permitted") + + def teardown(self): + Step("收尾工作.................") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2200.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2200.json new file mode 100644 index 0000000000000000000000000000000000000000..dd6ba86e6a31d99a3d15f572942c15349c8c8ec6 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2200.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_2200.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2200.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2200.py new file mode 100644 index 0000000000000000000000000000000000000000..306fef87e725a9dd516b81e4c49871ba011fb1bc --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2200.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_2200(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + for i in range(1, 3): + result = self.driver.shell("ls /proc/%d/root/storage/Users/currentUser/appdata/el%d" % (pid, i)) + self.driver.Assert.contains(result, "Operation not permitted") + + def teardown(self): + Step("收尾工作.................") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2300.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2300.json new file mode 100644 index 0000000000000000000000000000000000000000..d73be368e52a1b21405961697fb9fc0ed4b989c1 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2300.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_2300.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2300.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2300.py new file mode 100644 index 0000000000000000000000000000000000000000..d4aa98d265317e7891e2bef6811015bce78c76e4 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2300.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_2300(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls /proc/%d/root/storage/External" % pid) + self.driver.Assert.contains(result, "Operation not permitted") + + def teardown(self): + Step("收尾工作.................") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2500.json b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2500.json new file mode 100644 index 0000000000000000000000000000000000000000..0d7b7b628c967a21df407aaa3308fd34c7c7eee6 --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2500.json @@ -0,0 +1,14 @@ +{ + "description": "Config for OpenHarmony devicetest test cases", + "environment": [ + { + "type": "device" + } + ], + "driver": { + "type": "DeviceTest", + "py_file": [ + "sub_startup_appspawn_filemgr_sandbox/SubStartupAppspawnFilemgrSandbox_2500.py" + ] + } +} \ No newline at end of file diff --git a/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2500.py b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2500.py new file mode 100644 index 0000000000000000000000000000000000000000..c2088316aa187efa5cc4dc8c9b3853cc46227cef --- /dev/null +++ b/test/autotest/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX/SUB_STARTUP_APPSPAWN_FILEMGR_SANDBOX_2500.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 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 time +from devicetest.core.test_case import TestCase, Step +from hypium import * + + +class SubStartupAppspawnFilemgrSandbox_2500(TestCase): + + def __init__(self, controllers): + self.tag = self.__class__.__name__ + TestCase.__init__(self, self.tag, controllers) + self.driver = UiDriver(self.device1) + + def setup(self): + Step(self.devices[0].device_id) + global device + device = self.driver.shell("param get const.product.model") + device = device.replace("\n", "").replace(" ", "") + device = str(device) + Step(device) + # 解锁屏幕 + wake = self.driver.Screen.is_on() + time.sleep(0.5) + if wake: + self.driver.ScreenLock.unlock() + else: + self.driver.Screen.wake_up() + self.driver.ScreenLock.unlock() + self.driver.Screen.enable_stay_awake() + + def process(self): + global notepad + notepad = "com.huawei.hmos.notepad" + self.driver.AppManager.start_app(notepad) + time.sleep(3) + pid = self.driver.System.get_pid(notepad) + result = self.driver.shell("ls /proc/%d/root/storage/hmdfs" % pid) + self.driver.Assert.contains(result, "Operation not permitted") + + def teardown(self): + Step("收尾工作.................") + self.driver.AppManager.clear_app_data(notepad) + self.driver.AppManager.stop_app(notepad) \ No newline at end of file