1 /* 2 * Copyright (c) 2022 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 "window_extension_proxy.h" 18 #include "window_extension_stub.h" 19 #include "window_extension_stub_impl.h" 20 #include "window_extension_client_interface.h" 21 #include "window_extension_client_stub_impl.h" 22 #include "window_extension_connection.h" 23 24 using namespace testing; 25 using namespace testing::ext; 26 27 namespace OHOS { 28 namespace Rosen { 29 class WindowExtensionProxyTest : public testing::Test { 30 public: 31 static void SetUpTestCase(); 32 static void TearDownTestCase(); 33 void SetUp() override; 34 void TearDown() override; 35 sptr<WindowExtensionStub> mockWindowExtensionStub_; 36 sptr<WindowExtensionProxy> windowExtensionProxy_; 37 }; 38 SetUpTestCase()39void WindowExtensionProxyTest::SetUpTestCase() 40 { 41 } 42 TearDownTestCase()43void WindowExtensionProxyTest::TearDownTestCase() 44 { 45 } 46 SetUp()47void WindowExtensionProxyTest::SetUp() 48 { 49 mockWindowExtensionStub_ = new WindowExtensionStubImpl("name"); 50 windowExtensionProxy_ = new WindowExtensionProxy(mockWindowExtensionStub_); 51 } 52 TearDown()53void WindowExtensionProxyTest::TearDown() 54 { 55 } 56 57 namespace { 58 /** 59 * @tc.name: SetBounds 60 * @tc.desc: test success 61 * @tc.type: FUNC 62 */ 63 HWTEST_F(WindowExtensionProxyTest, SetBounds, Function | SmallTest | Level2) 64 { 65 windowExtensionProxy_->Show(); 66 windowExtensionProxy_->Hide(); 67 sptr<IWindowExtensionCallback> componentCallback_ = nullptr; 68 sptr<IWindowExtensionClient> clientToken(new WindowExtensionClientStubImpl(componentCallback_)); 69 windowExtensionProxy_->GetExtensionWindow(clientToken); 70 Rect rect; 71 windowExtensionProxy_->SetBounds(rect); 72 } 73 } 74 } 75 }