@@ -37,22 +37,21 @@ class TestAT_CellularDevice : public testing::Test {
37
37
38
38
TEST_F (TestAT_CellularDevice, Create)
39
39
{
40
- EventQueue que ;
41
- AT_CellularDevice dev (que );
40
+ FileHandle_stub fh1 ;
41
+ AT_CellularDevice dev (&fh1 );
42
42
43
- CellularDevice *dev2 = new AT_CellularDevice (que );
43
+ CellularDevice *dev2 = new AT_CellularDevice (&fh1 );
44
44
45
45
EXPECT_TRUE (dev2 != NULL );
46
46
delete dev2;
47
47
}
48
48
49
49
TEST_F (TestAT_CellularDevice, test_AT_CellularDevice_get_at_handler)
50
50
{
51
- EventQueue que;
52
- AT_CellularDevice dev (que);
53
51
FileHandle_stub fh1;
54
52
FileHandle_stub fh2;
55
53
FileHandle_stub fh3;
54
+ AT_CellularDevice dev (&fh1);
56
55
57
56
EXPECT_TRUE (dev.open_network (&fh1));
58
57
EXPECT_TRUE (dev.open_sms (&fh2));
@@ -66,9 +65,8 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_get_at_handler)
66
65
67
66
TEST_F (TestAT_CellularDevice, test_AT_CellularDevice_open_network)
68
67
{
69
- EventQueue que;
70
- AT_CellularDevice dev (que);
71
68
FileHandle_stub fh1;
69
+ AT_CellularDevice dev (&fh1);
72
70
73
71
CellularNetwork *nw = dev.open_network (NULL );
74
72
CellularNetwork *nw1 = dev.open_network (&fh1);
@@ -80,9 +78,8 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_open_network)
80
78
81
79
TEST_F (TestAT_CellularDevice, test_AT_CellularDevice_open_sms)
82
80
{
83
- EventQueue que;
84
- AT_CellularDevice dev (que);
85
81
FileHandle_stub fh1;
82
+ AT_CellularDevice dev (&fh1);
86
83
87
84
CellularSMS *sms = dev.open_sms (NULL );
88
85
CellularSMS *sms1 = dev.open_sms (&fh1);
@@ -94,9 +91,8 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_open_sms)
94
91
95
92
TEST_F (TestAT_CellularDevice, test_AT_CellularDevice_open_power)
96
93
{
97
- EventQueue que;
98
- AT_CellularDevice dev (que);
99
94
FileHandle_stub fh1;
95
+ AT_CellularDevice dev (&fh1);
100
96
101
97
CellularPower *pwr = dev.open_power (NULL );
102
98
CellularPower *pwr1 = dev.open_power (&fh1);
@@ -108,9 +104,8 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_open_power)
108
104
109
105
TEST_F (TestAT_CellularDevice, test_AT_CellularDevice_open_sim)
110
106
{
111
- EventQueue que;
112
- AT_CellularDevice dev (que);
113
107
FileHandle_stub fh1;
108
+ AT_CellularDevice dev (&fh1);
114
109
115
110
CellularSIM *sim = dev.open_sim (NULL );
116
111
CellularSIM *sim1 = dev.open_sim (&fh1);
@@ -122,9 +117,8 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_open_sim)
122
117
123
118
TEST_F (TestAT_CellularDevice, test_AT_CellularDevice_open_information)
124
119
{
125
- EventQueue que;
126
- AT_CellularDevice dev (que);
127
120
FileHandle_stub fh1;
121
+ AT_CellularDevice dev (&fh1);
128
122
129
123
CellularInformation *info = dev.open_information (NULL );
130
124
CellularInformation *info1 = dev.open_information (&fh1);
@@ -136,9 +130,8 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_open_information)
136
130
137
131
TEST_F (TestAT_CellularDevice, test_AT_CellularDevice_close_network)
138
132
{
139
- EventQueue que;
140
- AT_CellularDevice dev (que);
141
133
FileHandle_stub fh1;
134
+ AT_CellularDevice dev (&fh1);
142
135
ATHandler_stub::ref_count = 0 ;
143
136
144
137
EXPECT_TRUE (dev.open_network (&fh1));
@@ -151,9 +144,8 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_network)
151
144
152
145
TEST_F (TestAT_CellularDevice, test_AT_CellularDevice_close_sms)
153
146
{
154
- EventQueue que;
155
- AT_CellularDevice dev (que);
156
147
FileHandle_stub fh1;
148
+ AT_CellularDevice dev (&fh1);
157
149
ATHandler_stub::ref_count = 0 ;
158
150
159
151
EXPECT_TRUE (dev.open_sms (&fh1));
@@ -166,9 +158,8 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_sms)
166
158
167
159
TEST_F (TestAT_CellularDevice, test_AT_CellularDevice_close_power)
168
160
{
169
- EventQueue que;
170
- AT_CellularDevice dev (que);
171
161
FileHandle_stub fh1;
162
+ AT_CellularDevice dev (&fh1);
172
163
ATHandler_stub::ref_count = 0 ;
173
164
174
165
EXPECT_TRUE (dev.open_power (&fh1));
@@ -181,9 +172,8 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_power)
181
172
182
173
TEST_F (TestAT_CellularDevice, test_AT_CellularDevice_close_sim)
183
174
{
184
- EventQueue que;
185
- AT_CellularDevice dev (que);
186
175
FileHandle_stub fh1;
176
+ AT_CellularDevice dev (&fh1);
187
177
ATHandler_stub::ref_count = 0 ;
188
178
int ana = 0 ;
189
179
@@ -202,9 +192,8 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_sim)
202
192
203
193
TEST_F (TestAT_CellularDevice, test_AT_CellularDevice_close_information)
204
194
{
205
- EventQueue que;
206
- AT_CellularDevice dev (que);
207
195
FileHandle_stub fh1;
196
+ AT_CellularDevice dev (&fh1);
208
197
ATHandler_stub::int_value = 0 ;
209
198
210
199
EXPECT_TRUE (dev.open_information (&fh1));
@@ -213,6 +202,7 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_information)
213
202
AT_CellularBase_stub::handler_value = NULL ;
214
203
dev.close_information ();
215
204
205
+ EventQueue que;
216
206
ATHandler_stub::fh_value = &fh1;
217
207
ATHandler at (&fh1, que, 0 , " ," );
218
208
AT_CellularBase_stub::handler_value = &at;
@@ -228,9 +218,8 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_close_information)
228
218
229
219
TEST_F (TestAT_CellularDevice, test_AT_CellularDevice_set_timeout)
230
220
{
231
- EventQueue que;
232
- AT_CellularDevice dev (que);
233
221
FileHandle_stub fh1;
222
+ AT_CellularDevice dev (&fh1);
234
223
ATHandler_stub::timeout = 0 ;
235
224
ATHandler_stub::default_timeout = false ;
236
225
@@ -251,9 +240,8 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_set_timeout)
251
240
252
241
TEST_F (TestAT_CellularDevice, test_AT_CellularDevice_modem_debug_on)
253
242
{
254
- EventQueue que;
255
- AT_CellularDevice dev (que);
256
243
FileHandle_stub fh1;
244
+ AT_CellularDevice dev (&fh1);
257
245
ATHandler_stub::debug_on = false ;
258
246
259
247
// no interfaces open so debug toggling should not affect
@@ -271,14 +259,14 @@ TEST_F(TestAT_CellularDevice, test_AT_CellularDevice_modem_debug_on)
271
259
272
260
TEST_F (TestAT_CellularDevice, test_AT_CellularDevice_get_send_delay)
273
261
{
274
- EventQueue que ;
275
- AT_CellularDevice dev (que );
262
+ FileHandle_stub fh1 ;
263
+ AT_CellularDevice dev (&fh1 );
276
264
EXPECT_TRUE (0 == dev.get_send_delay ());
277
265
}
278
266
279
267
TEST_F (TestAT_CellularDevice, test_AT_CellularDevice_init_module)
280
268
{
281
- EventQueue que ;
282
- AT_CellularDevice dev (que );
283
- EXPECT_TRUE (NSAPI_ERROR_OK == dev.init_module (NULL ));
269
+ FileHandle_stub fh1 ;
270
+ AT_CellularDevice dev (&fh1 );
271
+ EXPECT_TRUE (NSAPI_ERROR_OK == dev.init_module ());
284
272
}
0 commit comments