• 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 #define private public
18 #define protected public
19 #include "ag_convert_callback_impl.h"
20 #include "hilog_tag_wrapper.h"
21 #undef private
22 #undef protected
23 
24 using namespace testing::ext;
25 using namespace testing;
26 namespace OHOS {
27 namespace AAFwk {
28 class AgConvertCallbackImplTest : public testing::Test {
29 public:
30     static void SetUpTestCase(void);
31     static void TearDownTestCase(void);
32     void SetUp();
33     void TearDown();
34 };
SetUpTestCase(void)35 void AgConvertCallbackImplTest::SetUpTestCase(void) {}
TearDownTestCase(void)36 void AgConvertCallbackImplTest::TearDownTestCase(void) {}
TearDown()37 void AgConvertCallbackImplTest::TearDown() {}
SetUp()38 void AgConvertCallbackImplTest::SetUp() {}
39 
40 /**
41  * @tc.name: AgConvertCallbackImplTest_OnConvert_0001
42  * @tc.desc: Test the state of OnConvert
43  * @tc.type: FUNC
44  */
45 HWTEST_F(AgConvertCallbackImplTest, OnConvert_0001, TestSize.Level1)
46 {
__anon208d88140102(int x, AppDomainVerify::TargetInfo &y) 47     ConvertCallbackTask task = [](int x, AppDomainVerify::TargetInfo &y) {};
48     auto callbackImpl = std::make_shared<ConvertCallbackImpl>(std::move(task));
49     int resultCode = 1;
50     AppDomainVerify::TargetInfo targetInfo;
51     callbackImpl->task_ = nullptr;
52     callbackImpl->OnConvert(resultCode, targetInfo);
53     EXPECT_EQ(callbackImpl->task_, nullptr);
54 }
55 } // namespace AAFwk
56 } // namespace OHOS
57