• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <gtest/gtest.h>
17 #include "iremote_object_mocker.h"
18 #include "session_manager/include/scene_session_manager.h"
19 #include "session_manager/include/zidl/scene_session_manager_proxy.h"
20 #include "window_manager_agent.h"
21 #include "zidl/window_manager_agent_interface.h"
22 
23 using namespace testing;
24 using namespace testing::ext;
25 namespace OHOS {
26 namespace Rosen {
27 class sceneSessionManagerProxyTest : public testing::Test {
28 public:
29     static void SetUpTestCase();
30     static void TearDownTestCase();
31     void SetUp() override;
32     void TearDown() override;
33     sptr<IRemoteObject> iRemoteObjectMocker;
34     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_;
35 };
36 
SetUpTestCase()37 void sceneSessionManagerProxyTest::SetUpTestCase()
38 {
39 }
40 
TearDownTestCase()41 void sceneSessionManagerProxyTest::TearDownTestCase()
42 {
43 }
44 
SetUp()45 void sceneSessionManagerProxyTest::SetUp()
46 {
47 }
48 
TearDown()49 void sceneSessionManagerProxyTest::TearDown()
50 {
51 }
52 
53 namespace {
54 /**
55  * @tc.name: RegisterWindowManagerAgent01
56  * @tc.desc: normal function
57  * @tc.type: FUNC
58  */
59 HWTEST_F(sceneSessionManagerProxyTest, RegisterWindowManagerAgent01, Function | SmallTest | Level2)
60 {
61     sptr<IWindowManagerAgent> windowManagerAgent = new WindowManagerAgent();
62     WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_FOCUS;
63     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
64     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ = new SceneSessionManagerProxy(iRemoteObjectMocker);
65 
66     ASSERT_EQ(WMError::WM_OK, sceneSessionManagerProxy_->RegisterWindowManagerAgent(type, windowManagerAgent));
67     ASSERT_EQ(WMError::WM_OK, sceneSessionManagerProxy_->UnregisterWindowManagerAgent(type, windowManagerAgent));
68     sceneSessionManagerProxy_ = nullptr;
69 }
70 
71 }
72 }
73 }
74