• 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 "ability_background_connection.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 AbilityBackgroundConnectionTest : 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 AbilityBackgroundConnectionTest::SetUpTestCase(void) {}
TearDownTestCase(void)36 void AbilityBackgroundConnectionTest::TearDownTestCase(void) {}
TearDown()37 void AbilityBackgroundConnectionTest::TearDown() {}
SetUp()38 void AbilityBackgroundConnectionTest::SetUp() {}
39 
40 /**
41  * @tc.name: AbilityBackgroundConnectionTest_OnAbilityConnectDone_0001
42  * @tc.desc: Test the state of OnAbilityConnectDone
43  * @tc.type: FUNC
44  */
45 HWTEST_F(AbilityBackgroundConnectionTest, OnAbilityConnectDone_0001, TestSize.Level1)
46 {
47     AppExecFwk::ElementName element;
48     sptr<IRemoteObject> remoteObject;
49     int resultCode = 1;
50     auto connection = std::make_shared<AbilityBackgroundConnection>();
51     connection->OnAbilityConnectDone(element, remoteObject, resultCode);
52     EXPECT_NE(resultCode, ERR_OK);
53 }
54 } // namespace AAFwk
55 } // namespace OHOS
56