• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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_service_helper.h"
18 #include "print_constant.h"
19 
20 using namespace testing::ext;
21 
22 namespace OHOS {
23 namespace Print {
24 class PrintServiceHelperTest : public testing::Test {
25 public:
26     static void SetUpTestCase(void);
27     static void TearDownTestCase(void);
28     void SetUp();
29     void TearDown();
30 };
31 
SetUpTestCase(void)32 void PrintServiceHelperTest::SetUpTestCase(void) {}
33 
TearDownTestCase(void)34 void PrintServiceHelperTest::TearDownTestCase(void) {}
35 
SetUp(void)36 void PrintServiceHelperTest::SetUp(void) {}
37 
TearDown(void)38 void PrintServiceHelperTest::TearDown(void) {}
39 
40 /**
41 * @tc.name: PrintServiceHelperTest_0001
42 * @tc.desc: reportPrintSuccess
43 * @tc.type: FUNC
44 * @tc.require:
45 */
46 HWTEST_F(PrintServiceHelperTest, PrintServiceHelperTest_0001, TestSize.Level1)
47 {
48     PrintServiceHelper helper;
49     helper.~PrintServiceHelper();
50 }
51 
52 /**
53 * @tc.name: PrintServiceHelperTest_0002
54 * @tc.desc: faultPrint
55 * @tc.type: FUNC
56 * @tc.require:
57 */
58 HWTEST_F(PrintServiceHelperTest, PrintServiceHelperTest_0002, TestSize.Level1)
59 {
60     PrintServiceHelper helper;
61     helper.CheckPermission("");
62 }
63 
64 /**
65 * @tc.name: PrintServiceHelperTest_0003
66 * @tc.desc: faultPrint
67 * @tc.type: FUNC
68 * @tc.require:
69 */
70 HWTEST_F(PrintServiceHelperTest, PrintServiceHelperTest_0003, TestSize.Level1)
71 {
72     PrintServiceHelper helper;
73     AAFwk::Want want;
74     helper.StartAbility(want);
75 }
76 
77 /**
78 * @tc.name: PrintServiceHelperTest_0004
79 * @tc.desc: faultPrint
80 * @tc.type: FUNC
81 * @tc.require:
82 */
83 HWTEST_F(PrintServiceHelperTest, PrintServiceHelperTest_0004, TestSize.Level1)
84 {
85     PrintServiceHelper helper;
86     AAFwk::Want want;
87     int32_t requestCode = 0;
88     helper.StartPrintServiceExtension(want, requestCode);
89 }
90 
91 /**
92 * @tc.name: PrintServiceHelperTest_0005
93 * @tc.desc: faultPrint
94 * @tc.type: FUNC
95 * @tc.require:
96 */
97 HWTEST_F(PrintServiceHelperTest, PrintServiceHelperTest_0005, TestSize.Level1)
98 {
99     PrintServiceHelper helper;
100     helper.GetBundleMgr();
101 }
102 
103 /**
104 * @tc.name: PrintServiceHelperTest_0006
105 * @tc.desc: faultPrint
106 * @tc.type: FUNC
107 * @tc.require:
108 */
109 HWTEST_F(PrintServiceHelperTest, PrintServiceHelperTest_0006, TestSize.Level1)
110 {
111     PrintServiceHelper helper;
112     std::vector<int> accountList;
113     helper.QueryAccounts(accountList);
114 }
115 
116 /**
117 * @tc.name: PrintServiceHelperTest_0007
118 * @tc.desc: faultPrint
119 * @tc.type: FUNC
120 * @tc.require:
121 */
122 HWTEST_F(PrintServiceHelperTest, PrintServiceHelperTest_0007, TestSize.Level1)
123 {
124     PrintServiceHelper helper;
125     std::vector<int> accountList = {};
126     helper.QueryAccounts(accountList);
127 }
128 
129 /**
130 * @tc.name: PrintServiceHelperTest_0008
131 * @tc.desc: faultPrint
132 * @tc.type: FUNC
133 * @tc.require:
134 */
135 HWTEST_F(PrintServiceHelperTest, PrintServiceHelperTest_0008, TestSize.Level1)
136 {
137     PrintServiceHelper helper;
138     sptr<AppExecFwk::IBundleMgr> mgr;
139     int userId = 0;
140     std::vector<AppExecFwk::ExtensionAbilityInfo> extensionInfos;
141     helper.QueryExtension(mgr, userId, extensionInfos);
142 }
143 
144 /**
145 * @tc.name: PrintServiceHelperTest_0009
146 * @tc.desc: faultPrint
147 * @tc.type: FUNC
148 * @tc.require:
149 */
150 HWTEST_F(PrintServiceHelperTest, PrintServiceHelperTest_0009, TestSize.Level1)
151 {
152     PrintServiceHelper helper;
153     sptr<AppExecFwk::IBundleMgr> mgr;
154     int userId = 0;
155     std::string userName;
156     helper.QueryNameForUid(mgr, userId, userName);
157 }
158 
159 /**
160 * @tc.name: PrintServiceHelperTest_0010
161 * @tc.desc: faultPrint
162 * @tc.type: FUNC
163 * @tc.require:
164 */
165 HWTEST_F(PrintServiceHelperTest, PrintServiceHelperTest_0010, TestSize.Level1)
166 {
167     PrintServiceHelper helper;
168     helper.IsSyncMode();
169 }
170 } // namespace Print
171 } // namespace OHOS