diff --git a/wm/test/unittest/BUILD.gn b/wm/test/unittest/BUILD.gn index 144eb0db47d58d3418890c2016317e796b369310..d3ac9b7e22cb40e6fc4d55ff32f2a9fd4f2989f4 100644 --- a/wm/test/unittest/BUILD.gn +++ b/wm/test/unittest/BUILD.gn @@ -19,7 +19,6 @@ group("unittest") { testonly = true deps = [ - ":wm_extension_window_impl_test", ":wm_gtx_input_event_sender_test", ":wm_input_transfer_station_test", ":wm_pattern_detach_callback_proxy_test", @@ -35,7 +34,6 @@ group("unittest") { ":wm_window_agent_test", ":wm_window_display_change_adapter_test", ":wm_window_effect_test", - ":wm_window_extension_session_impl_test", ":wm_window_frame_trace_impl_test", ":wm_window_impl_listener_test", ":wm_window_impl_test", @@ -59,6 +57,8 @@ group("unittest") { ":wm_window_session_impl_test4", ":wm_window_stub_test", ":wm_window_test", + "ui_extension:wm_extension_window_impl_test", + "ui_extension:wm_window_extension_session_impl_test", ] if (!window_manager_use_sceneboard) { deps += [ ":wm_window_proxy_test" ] @@ -518,21 +518,6 @@ ohos_unittest("wm_window_agent_test") { ] } -ohos_unittest("wm_window_extension_session_impl_test") { - module_out_path = module_out_path - - sources = [ "window_extension_session_impl_test.cpp" ] - - deps = [ ":wm_unittest_common" ] - - external_deps = [ - "ability_runtime:app_context", - "c_utils:utils", - "eventhandler:libeventhandler", - "hilog:libhilog", - ] -} - ohos_unittest("wm_root_scene_test") { module_out_path = module_out_path @@ -607,16 +592,6 @@ ohos_unittest("wm_picture_in_picture_option_test") { ] } -ohos_unittest("wm_extension_window_impl_test") { - module_out_path = module_out_path - - sources = [ "extension_window_impl_test.cpp" ] - - deps = [ ":wm_unittest_common" ] - - external_deps = [ "c_utils:utils" ] -} - ohos_unittest("wm_window_manager_agent_proxy_test") { module_out_path = module_out_path @@ -721,7 +696,11 @@ config("wm_unittest_common_public_config") { } ohos_static_library("wm_unittest_common") { - visibility = [ ":*" ] + visibility = [ + ":*", + "ui_extension:*", + ] + testonly = true public_configs = [ diff --git a/wm/test/unittest/ui_extension/BUILD.gn b/wm/test/unittest/ui_extension/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..07024291719a5d09e59d112f3da7ebdbce368ac9 --- /dev/null +++ b/wm/test/unittest/ui_extension/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2024 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("//build/test.gni") +import("//foundation/window/window_manager/windowmanager_aafwk.gni") + +module_out_path = "window_manager/wm/ui_extension" +wm_unittest_common = "../:wm_unittest_common" + +ohos_unittest("wm_extension_window_impl_test") { + module_out_path = module_out_path + sources = [ "extension_window_impl_test.cpp" ] + deps = [ wm_unittest_common ] + external_deps = [ "c_utils:utils" ] +} + +ohos_unittest("wm_window_extension_session_impl_test") { + module_out_path = module_out_path + sources = [ "window_extension_session_impl_test.cpp" ] + deps = [ wm_unittest_common ] + external_deps = [ + "ability_runtime:app_context", + "c_utils:utils", + "eventhandler:libeventhandler", + "hilog:libhilog", + ] +} diff --git a/wm/test/unittest/extension_window_impl_test.cpp b/wm/test/unittest/ui_extension/extension_window_impl_test.cpp similarity index 74% rename from wm/test/unittest/extension_window_impl_test.cpp rename to wm/test/unittest/ui_extension/extension_window_impl_test.cpp index 3f3325c48f1cfa67196dba8f01ddaf38fb7018ea..0404f1fead2d05d3baee295168a8ea5d53d3777f 100644 --- a/wm/test/unittest/extension_window_impl_test.cpp +++ b/wm/test/unittest/ui_extension/extension_window_impl_test.cpp @@ -1,66 +1,44 @@ -/* - * Copyright (c) 2023 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. - */ - -#include - -#include "extension_window_impl.h" - -using namespace testing; -using namespace testing::ext; - -namespace OHOS { -namespace Rosen { -class ExtensionWindowImplTest : public testing::Test { -public: - static void SetUpTestCase(); - static void TearDownTestCase(); - void SetUp() override; - void TearDown() override; -}; - -void ExtensionWindowImplTest::SetUpTestCase() -{ -} - -void ExtensionWindowImplTest::TearDownTestCase() -{ -} - -void ExtensionWindowImplTest::SetUp() -{ -} - -void ExtensionWindowImplTest::TearDown() -{ -} - -namespace { -/** - * @tc.name: GetAvoidAreaByType - * @tc.desc: GetAvoidAreaByType Test - * @tc.type: FUNC - */ -HWTEST_F(ExtensionWindowImplTest, GetAvoidAreaByType, Function | SmallTest | Level2) -{ - sptr window = new Window(); - ExtensionWindowImpl extensionWindowImpl(window); - AvoidAreaType type = AvoidAreaType::TYPE_SYSTEM; - AvoidArea avoidArea; - ASSERT_EQ(WMError::WM_OK, extensionWindowImpl.GetAvoidAreaByType(type, avoidArea)); - ASSERT_EQ(WMError::WM_OK, window->Destroy()); -} -} -} // namespace Rosen +/* + * Copyright (c) 2023 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. + */ + +#include + +#include "extension_window_impl.h" + +using namespace testing; +using namespace testing::ext; + +namespace OHOS { +namespace Rosen { +class ExtensionWindowImplTest : public testing::Test {}; + +namespace { +/** + * @tc.name: GetAvoidAreaByType + * @tc.desc: GetAvoidAreaByType Test + * @tc.type: FUNC + */ +HWTEST_F(ExtensionWindowImplTest, GetAvoidAreaByType, Function | SmallTest | Level2) +{ + sptr window = new Window(); + ExtensionWindowImpl extensionWindowImpl(window); + AvoidAreaType type = AvoidAreaType::TYPE_SYSTEM; + AvoidArea avoidArea; + ASSERT_EQ(WMError::WM_OK, extensionWindowImpl.GetAvoidAreaByType(type, avoidArea)); + ASSERT_EQ(WMError::WM_OK, window->Destroy()); +} +} // namespace +} // namespace Rosen } // namespace OHOS \ No newline at end of file diff --git a/wm/test/unittest/window_extension_session_impl_test.cpp b/wm/test/unittest/ui_extension/window_extension_session_impl_test.cpp similarity index 99% rename from wm/test/unittest/window_extension_session_impl_test.cpp rename to wm/test/unittest/ui_extension/window_extension_session_impl_test.cpp index 59fc5f7d5852088aca40db70497aad8c195251f9..c381facaf892266319fee04c02731c079ab7637e 100644 --- a/wm/test/unittest/window_extension_session_impl_test.cpp +++ b/wm/test/unittest/ui_extension/window_extension_session_impl_test.cpp @@ -599,7 +599,7 @@ HWTEST_F(WindowExtensionSessionImplTest, HidePrivacyContentForHost, Function | S SessionInfo sessionInfo; window_->hostSession_ = new (std::nothrow) SessionMocker(sessionInfo); ASSERT_NE(nullptr, window_->hostSession_); - ASSERT_NE(WMError::WM_OK, window_->HidePrivacyContentForHost(true)); + ASSERT_EQ(WMError::WM_OK, window_->HidePrivacyContentForHost(true)); } /**