1 /*
2 * Copyright (c) 2021 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 "print_sync_load_callback.h"
18 #include "iservice_registry.h"
19 #include "isystem_ability_load_callback.h"
20 #include "print_log.h"
21 #define private public
22 #include "print_manager_client.h"
23 #undef private
24 #include "system_ability_definition.h"
25
26 using namespace testing::ext;
27
28 namespace OHOS {
29 namespace Print {
30 class PrintSyncLoadCallbackTest : public testing::Test {
31 public:
32 static void SetUpTestCase(void);
33 static void TearDownTestCase(void);
34 void SetUp();
35 void TearDown();
36 };
37
SetUpTestCase(void)38 void PrintSyncLoadCallbackTest::SetUpTestCase(void) {}
39
TearDownTestCase(void)40 void PrintSyncLoadCallbackTest::TearDownTestCase(void) {}
41
SetUp(void)42 void PrintSyncLoadCallbackTest::SetUp(void) {}
43
TearDown(void)44 void PrintSyncLoadCallbackTest::TearDown(void) {}
45
46 /**
47 * @tc.name: PrintSyncLoadCallbackTest_0001
48 * @tc.desc: Verify the capability function.
49 * @tc.type: FUNC
50 * @tc.require:
51 */
52 HWTEST_F(PrintSyncLoadCallbackTest, PrintSyncLoadCallbackTest_0001_NeedRename, TestSize.Level1)
53 {
54 OHOS::Print::PrintSyncLoadCallback printSyncLoadCallback;
55 int32_t systemAbilityId = 0;
56 const sptr<IRemoteObject> remoteObject;
57 printSyncLoadCallback.OnLoadSystemAbilitySuccess(systemAbilityId, remoteObject);
58 EXPECT_EQ(PrintManagerClient::GetInstance()->ready_, true);
59 printSyncLoadCallback.OnLoadSystemAbilityFail(systemAbilityId);
60 EXPECT_EQ(PrintManagerClient::GetInstance()->ready_, true);
61 }
62 } // namespace Print
63 } // namespace OHOS