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 #ifdef IPPOVERUSB_ENABLE
17 #include <gtest/gtest.h>
18 #define private public
19 #include "print_ipp_over_usb_manager.h"
20 #undef private
21
22 using namespace testing::ext;
23
24 namespace OHOS {
25 namespace Print {
26 class PrintIppOverUsbManagerTest : public testing::Test {
27 public:
28 static void SetUpTestCase(void);
29 static void TearDownTestCase(void);
30 void SetUp();
31 void TearDown();
32 };
33
SetUpTestCase(void)34 void PrintIppOverUsbManagerTest::SetUpTestCase(void)
35 {}
36
TearDownTestCase(void)37 void PrintIppOverUsbManagerTest::TearDownTestCase(void)
38 {}
39
SetUp(void)40 void PrintIppOverUsbManagerTest::SetUp(void)
41 {}
42
TearDown(void)43 void PrintIppOverUsbManagerTest::TearDown(void)
44 {}
45
46 /**
47 * @tc.name: PrintIppOverUsbManagerTest_002
48 * @tc.desc: Verify the ConnectPrinter function.
49 * @tc.type: FUNC
50 * @tc.require:
51 */
52 HWTEST_F(PrintIppOverUsbManagerTest, PrintIppOverUsbManagerTest_002, TestSize.Level1)
53 {
54 OHOS::Print::PrintIppOverUsbManager printIppOverUsbManager;
55 std::string printerId = "com.ohos.spooler:USB-PixLab V1-0159";
56 int32_t port = 60000;
57 printIppOverUsbManager.ConnectPrinter(printerId, port);
58 }
59
60 /**
61 * @tc.name: PrintIppOverUsbManagerTest_003
62 * @tc.desc: Verify the ConnectPrinter function.
63 * @tc.type: FUNC
64 * @tc.require:
65 */
66 HWTEST_F(PrintIppOverUsbManagerTest, PrintIppOverUsbManagerTest_003, TestSize.Level1)
67 {
68 OHOS::Print::PrintIppOverUsbManager printIppOverUsbManager;
69 std::string printerId = "com.ohos.spoolerUSB-PixLab V1-0159";
70 int32_t port = 60000;
71 printIppOverUsbManager.ConnectPrinter(printerId, port);
72 }
73
74 /**
75 * @tc.name: PrintIppOverUsbManagerTest_004
76 * @tc.desc: Verify the ConnectPrinter function.
77 * @tc.type: FUNC
78 * @tc.require:
79 */
80 HWTEST_F(PrintIppOverUsbManagerTest, PrintIppOverUsbManagerTest_004, TestSize.Level1)
81 {
82 OHOS::Print::PrintIppOverUsbManager printIppOverUsbManager;
83 std::string printerId = "com.ohos.test:USB-PixLab V1-0159";
84 int32_t port = 60000;
85 printIppOverUsbManager.ConnectPrinter(printerId, port);
86 }
87
88 /**
89 * @tc.name: PrintIppOverUsbManagerTest_005
90 * @tc.desc: Verify the ConnectPrinter function.
91 * @tc.type: FUNC
92 * @tc.require:
93 */
94 HWTEST_F(PrintIppOverUsbManagerTest, PrintIppOverUsbManagerTest_005, TestSize.Level1)
95 {
96 OHOS::Print::PrintIppOverUsbManager printIppOverUsbManager;
97 std::string printerId = "com.ohos.spooler:USB-PixLab V1-0159";
98 int32_t port = 60000;
99 printIppOverUsbManager.ConnectPrinter(printerId, port);
100 }
101
102 /**
103 * @tc.name: PrintIppOverUsbManagerTest_006
104 * @tc.desc: Verify the DisConnectPrinter function.
105 * @tc.type: FUNC
106 * @tc.require:
107 */
108 HWTEST_F(PrintIppOverUsbManagerTest, PrintIppOverUsbManagerTest_006, TestSize.Level1)
109 {
110 OHOS::Print::PrintIppOverUsbManager printIppOverUsbManager;
111 std::string printerId = "com.ohos.spooler:USB-PixLab V1-0159";
112 printIppOverUsbManager.DisConnectPrinter(printerId);
113 }
114
115 /**
116 * @tc.name: PrintIppOverUsbManagerTest_007
117 * @tc.desc: Verify the DisConnectPrinter function.
118 * @tc.type: FUNC
119 * @tc.require:
120 */
121 HWTEST_F(PrintIppOverUsbManagerTest, PrintIppOverUsbManagerTest_007, TestSize.Level1)
122 {
123 OHOS::Print::PrintIppOverUsbManager printIppOverUsbManager;
124 std::string printerId = "com.ohos.spoolerUSB-PixLab V1-0159";
125 printIppOverUsbManager.DisConnectPrinter(printerId);
126 }
127
128 /**
129 * @tc.name: PrintIppOverUsbManagerTest_008
130 * @tc.desc: Verify the DisConnectPrinter function.
131 * @tc.type: FUNC
132 * @tc.require:
133 */
134 HWTEST_F(PrintIppOverUsbManagerTest, PrintIppOverUsbManagerTest_008, TestSize.Level1)
135 {
136 OHOS::Print::PrintIppOverUsbManager printIppOverUsbManager;
137 std::string printerId = "com.ohos.test:USB-PixLab V1-0159";
138 printIppOverUsbManager.DisConnectPrinter(printerId);
139 }
140
141 /**
142 * @tc.name: PrintIppOverUsbManagerTest_009
143 * @tc.desc: Verify the DisConnectPrinter function.
144 * @tc.type: FUNC
145 * @tc.require:
146 */
147 HWTEST_F(PrintIppOverUsbManagerTest, PrintIppOverUsbManagerTest_009, TestSize.Level1)
148 {
149 OHOS::Print::PrintIppOverUsbManager printIppOverUsbManager;
150 std::string printerId = "com.ohos.spooler:USB-PixLab V1-0159";
151 printIppOverUsbManager.DisConnectPrinter(printerId);
152 }
153
154 } // namespace Print
155 } // namespace OHOS
156
157 #endif // IPPOVERUSB_ENABLE