• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 
18 #include "hilog_tag_wrapper.h"
19 #include "parcel.h"
20 #include "start_window_option.h"
21 
22 using namespace testing;
23 using namespace testing::ext;
24 
25 namespace OHOS {
26 namespace AbilityRuntime {
27 
28 class StartWindowOptionTest : public testing::Test {
29 public:
30     static void SetUpTestCase();
31     static void TearDownTestCase();
32     void SetUp() override;
33     void TearDown() override;
34 };
35 
SetUpTestCase(void)36 void StartWindowOptionTest::SetUpTestCase(void) {}
37 
TearDownTestCase(void)38 void StartWindowOptionTest::TearDownTestCase(void) {}
39 
SetUp()40 void StartWindowOptionTest::SetUp() {}
41 
TearDown()42 void StartWindowOptionTest::TearDown() {}
43 
44 /**
45  * @tc.number: StartWindowOption_ReadFromParcel_0100
46  * @tc.name: ReadFromParcel
47  * @tc.desc: ReadFromParcel
48  */
49 HWTEST_F(StartWindowOptionTest, StartWindowOption_ReadFromParcel_0100, TestSize.Level1)
50 {
51     TAG_LOGI(AAFwkTag::TEST, "StartWindowOption_ReadFromParcel_0100 start");
52 
53     std::shared_ptr<AAFwk::StartWindowOption> startWindowOption = std::make_shared<AAFwk::StartWindowOption>();
54     ASSERT_NE(startWindowOption, nullptr);
55 
56     Parcel parcel;
57     bool ret = startWindowOption->ReadFromParcel(parcel);
58     EXPECT_TRUE(ret);
59 
60     TAG_LOGI(AAFwkTag::TEST, "StartWindowOption_ReadFromParcel_0100 end");
61 }
62 
63 /**
64  * @tc.number: StartWindowOption_Unmarshalling_0100
65  * @tc.name: Unmarshalling
66  * @tc.desc: Unmarshalling
67  */
68 HWTEST_F(StartWindowOptionTest, StartWindowOption_Unmarshalling_0100, TestSize.Level1)
69 {
70     TAG_LOGI(AAFwkTag::TEST, "StartWindowOption_Unmarshalling_0100 start");
71 
72     std::shared_ptr<AAFwk::StartWindowOption> startWindowOption = std::make_shared<AAFwk::StartWindowOption>();
73     ASSERT_NE(startWindowOption, nullptr);
74     Parcel parcel;
75     AAFwk::StartWindowOption* option = startWindowOption->Unmarshalling(parcel);
76     EXPECT_NE(option, nullptr);
77     delete option;
78     option = nullptr;
79 
80     TAG_LOGI(AAFwkTag::TEST, "StartWindowOption_Unmarshalling_0100 end");
81 }
82 
83 /**
84  * @tc.number: StartWindowOption_Marshalling_0100
85  * @tc.name: Marshalling
86  * @tc.desc: Marshalling
87  */
88 HWTEST_F(StartWindowOptionTest, StartWindowOption_Marshalling_0100, TestSize.Level1)
89 {
90     TAG_LOGI(AAFwkTag::TEST, "StartWindowOption_Marshalling_0100 start");
91 
92     std::shared_ptr<AAFwk::StartWindowOption> startWindowOption = std::make_shared<AAFwk::StartWindowOption>();
93     ASSERT_NE(startWindowOption, nullptr);
94     Parcel parcel;
95     bool ret = startWindowOption->Marshalling(parcel);
96     EXPECT_TRUE(ret);
97 
98     TAG_LOGI(AAFwkTag::TEST, "StartWindowOption_Marshalling_0100 end");
99 }
100 } // namespace AbilityRuntime
101 } // namespace OHOS