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 #include "first_use_dialog_test.h"
16
17 #include <cstdio>
18 #include "accesstoken_kit.h"
19 #include "location_button.h"
20 #include "save_button.h"
21 #include "sec_comp_log.h"
22 #include "sec_comp_err.h"
23 #include "sec_event_handler.h"
24
25 using namespace testing::ext;
26 using namespace OHOS;
27 using namespace OHOS::Security::SecurityComponent;
28 using namespace OHOS::Security::AccessToken;
29
30 namespace {
31 static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {
32 LOG_CORE, SECURITY_DOMAIN_SECURITY_COMPONENT, "FirstUseDialogTest"};
33 static const std::string SEC_COMP_SRV_CFG_PATH = "/data/service/el1/public/security_component_service";
34 static const std::string SEC_COMP_SRV_CFG_FILE = SEC_COMP_SRV_CFG_PATH + "/" + "first_use_record.json";
35 static const std::string SEC_COMP_SRV_CFG_BACK_FILE = SEC_COMP_SRV_CFG_PATH + "/" + "first_use_record.json.bak";
36 constexpr uint64_t LOCATION_BUTTON_FIRST_USE = 1 << 0;
37 constexpr uint64_t SAVE_BUTTON_FIRST_USE = 1 << 1;
38 }
39
SetUpTestCase()40 void FirstUseDialogTest::SetUpTestCase()
41 {
42 }
43
TearDownTestCase()44 void FirstUseDialogTest::TearDownTestCase()
45 {
46 struct stat fstatJson = {};
47 if (stat(SEC_COMP_SRV_CFG_FILE.c_str(), &fstatJson) != 0) {
48 return;
49 }
50 // if json file is created by root, delete it
51 if (fstatJson.st_uid == 0) {
52 std::string cmdline = "rm -f " + SEC_COMP_SRV_CFG_FILE;
53 system(cmdline.c_str());
54 }
55 struct stat fstatDir = {};
56 if (stat(SEC_COMP_SRV_CFG_PATH.c_str(), &fstatDir) != 0) {
57 return;
58 }
59 if (fstatDir.st_uid == 0) {
60 std::string cmdline = "chown security_component:security_component " + SEC_COMP_SRV_CFG_PATH;
61 system(cmdline.c_str());
62 }
63 }
64
SetUp()65 void FirstUseDialogTest::SetUp()
66 {
67 SC_LOG_INFO(LABEL, "setup");
68 struct stat fstat = {};
69 if (stat(SEC_COMP_SRV_CFG_FILE.c_str(), &fstat) != 0) {
70 return;
71 }
72 std::string cmdline = "mv " + SEC_COMP_SRV_CFG_FILE + " " + SEC_COMP_SRV_CFG_BACK_FILE;
73 system(cmdline.c_str());
74 }
75
TearDown()76 void FirstUseDialogTest::TearDown()
77 {
78 struct stat fstat = {};
79 if (stat(SEC_COMP_SRV_CFG_BACK_FILE.c_str(), &fstat) != 0) {
80 return;
81 }
82 std::string cmdline = "mv " + SEC_COMP_SRV_CFG_BACK_FILE + " " + SEC_COMP_SRV_CFG_FILE;
83 system(cmdline.c_str());
84 }
85
86 /**
87 * @tc.name: LoadFirstUseRecord001
88 * @tc.desc: Test cfg file not exist
89 * @tc.type: FUNC
90 * @tc.require:
91 */
92 HWTEST_F(FirstUseDialogTest, LoadFirstUseRecord001, TestSize.Level1)
93 {
94 FirstUseDialog diag;
95 diag.LoadFirstUseRecord();
96 ASSERT_EQ(0, static_cast<int32_t>(diag.firstUseMap_.size()));
97 }
98
99 /**
100 * @tc.name: LoadFirstUseRecord002
101 * @tc.desc: Test cfg file too large
102 * @tc.type: FUNC
103 * @tc.require:
104 */
105 HWTEST_F(FirstUseDialogTest, LoadFirstUseRecord002, TestSize.Level1)
106 {
107 std::string cmdline = "dd if=/dev/random of=" + SEC_COMP_SRV_CFG_FILE + " bs=101k count=1";
108 system(cmdline.c_str());
109 FirstUseDialog diag;
110 diag.LoadFirstUseRecord();
111 ASSERT_EQ(0, static_cast<int32_t>(diag.firstUseMap_.size()));
112 }
113
114 /**
115 * @tc.name: LoadFirstUseRecord003
116 * @tc.desc: Test cfg file is not json
117 * @tc.type: FUNC
118 * @tc.require:
119 */
120 HWTEST_F(FirstUseDialogTest, LoadFirstUseRecord003, TestSize.Level1)
121 {
122 std::string cmdline = "echo {x=\\\' > " + SEC_COMP_SRV_CFG_FILE;
123 system(cmdline.c_str());
124 FirstUseDialog diag;
125 diag.LoadFirstUseRecord();
126 ASSERT_EQ(0, static_cast<int32_t>(diag.firstUseMap_.size()));
127 }
128
129 /**
130 * @tc.name: LoadFirstUseRecord004
131 * @tc.desc: Test cfg file has no tag named FIRST_USE_RECORD_TAG
132 * @tc.type: FUNC
133 * @tc.require:
134 */
135 HWTEST_F(FirstUseDialogTest, LoadFirstUseRecord004, TestSize.Level1)
136 {
137 std::string cmdline = "echo {\\\"x\\\":1} > " + SEC_COMP_SRV_CFG_FILE;
138 system(cmdline.c_str());
139 FirstUseDialog diag;
140 diag.LoadFirstUseRecord();
141 ASSERT_EQ(0, static_cast<int32_t>(diag.firstUseMap_.size()));
142 }
143
144 /**
145 * @tc.name: LoadFirstUseRecord005
146 * @tc.desc: Test cfg file has no tag named TOKEN_ID_TAG
147 * @tc.type: FUNC
148 * @tc.require:
149 */
150 HWTEST_F(FirstUseDialogTest, LoadFirstUseRecord005, TestSize.Level1)
151 {
152 std::string cmdline = "echo {\\\"FirstUseRecord\\\":[{\\\"CompType\\\":1}]} > "
153 + SEC_COMP_SRV_CFG_FILE;
154 system(cmdline.c_str());
155 FirstUseDialog diag;
156 diag.LoadFirstUseRecord();
157 ASSERT_EQ(0, static_cast<int32_t>(diag.firstUseMap_.size()));
158 }
159
160 /**
161 * @tc.name: LoadFirstUseRecord006
162 * @tc.desc: Test cfg file TOKEN_ID_TAG is not number
163 * @tc.type: FUNC
164 * @tc.require:
165 */
166 HWTEST_F(FirstUseDialogTest, LoadFirstUseRecord006, TestSize.Level1)
167 {
168 std::string cmdline = "echo {\\\"FirstUseRecord\\\":[{\\\"CompType\\\":1,\\\"TokenId\\\":\\\"kk\\\"}]} > "
169 + SEC_COMP_SRV_CFG_FILE;
170 system(cmdline.c_str());
171 FirstUseDialog diag;
172 diag.LoadFirstUseRecord();
173 ASSERT_EQ(0, static_cast<int32_t>(diag.firstUseMap_.size()));
174 }
175
176 /**
177 * @tc.name: LoadFirstUseRecord007
178 * @tc.desc: Test cfg file TOKEN_ID_TAG value is 0
179 * @tc.type: FUNC
180 * @tc.require:
181 */
182 HWTEST_F(FirstUseDialogTest, LoadFirstUseRecord007, TestSize.Level1)
183 {
184 std::string cmdline = "echo {\\\"FirstUseRecord\\\":[{\\\"CompType\\\":1,\\\"TokenId\\\":0}]} > "
185 + SEC_COMP_SRV_CFG_FILE;
186 system(cmdline.c_str());
187 FirstUseDialog diag;
188 diag.LoadFirstUseRecord();
189 ASSERT_EQ(0, static_cast<int32_t>(diag.firstUseMap_.size()));
190 }
191
192 /**
193 * @tc.name: LoadFirstUseRecord008
194 * @tc.desc: Test cfg file COMP_TYPE_TAG is not exist
195 * @tc.type: FUNC
196 * @tc.require:
197 */
198 HWTEST_F(FirstUseDialogTest, LoadFirstUseRecord008, TestSize.Level1)
199 {
200 std::string cmdline = "echo {\\\"FirstUseRecord\\\":[{\\\"TokenId\\\":1}]} > "
201 + SEC_COMP_SRV_CFG_FILE;
202 system(cmdline.c_str());
203 FirstUseDialog diag;
204 diag.LoadFirstUseRecord();
205 ASSERT_EQ(0, static_cast<int32_t>(diag.firstUseMap_.size()));
206 }
207
208 /**
209 * @tc.name: LoadFirstUseRecord009
210 * @tc.desc: Test cfg file COMP_TYPE_TAG is number
211 * @tc.type: FUNC
212 * @tc.require:
213 */
214 HWTEST_F(FirstUseDialogTest, LoadFirstUseRecord009, TestSize.Level1)
215 {
216 std::string cmdline = "echo {\\\"FirstUseRecord\\\":[{\\\"CompType\\\":\\\"k\\\",\\\"TokenId\\\":1}]} > "
217 + SEC_COMP_SRV_CFG_FILE;
218 system(cmdline.c_str());
219 FirstUseDialog diag;
220 diag.LoadFirstUseRecord();
221 ASSERT_EQ(0, static_cast<int32_t>(diag.firstUseMap_.size()));
222 }
223
224 /**
225 * @tc.name: LoadFirstUseRecord010
226 * @tc.desc: Test cfg file is success
227 * @tc.type: FUNC
228 * @tc.require:
229 */
230 HWTEST_F(FirstUseDialogTest, LoadFirstUseRecord010, TestSize.Level1)
231 {
232 std::string cmdline = "echo {\\\"FirstUseRecord\\\":[{\\\"CompType\\\":1,\\\"TokenId\\\":1}]} > "
233 + SEC_COMP_SRV_CFG_FILE;
234 system(cmdline.c_str());
235 FirstUseDialog diag;
236 diag.LoadFirstUseRecord();
237 ASSERT_EQ(1, static_cast<int32_t>(diag.firstUseMap_.size()));
238 ASSERT_EQ(1, static_cast<int32_t>(diag.firstUseMap_[1]));
239 }
240
241 /**
242 * @tc.name: SaveFirstUseRecord001
243 * @tc.desc: Test cfg dir is not exist
244 * @tc.type: FUNC
245 * @tc.require:
246 */
247 HWTEST_F(FirstUseDialogTest, SaveFirstUseRecord001, TestSize.Level1)
248 {
249 std::string cmdline = "rm " + SEC_COMP_SRV_CFG_PATH + " -rf";
250 system(cmdline.c_str());
251 FirstUseDialog diag;
252 diag.firstUseMap_[1] = 1;
253 diag.SaveFirstUseRecord();
254 diag.firstUseMap_.clear();
255 diag.LoadFirstUseRecord();
256 EXPECT_EQ(0, static_cast<int32_t>(diag.firstUseMap_.size()));
257 std::string cmdline1 = "mkdir " + SEC_COMP_SRV_CFG_PATH + " 0750 security_component security_component";
258 system(cmdline1.c_str());
259 }
260
261 /**
262 * @tc.name: SaveFirstUseRecord002
263 * @tc.desc: Test cfg dir is not dir
264 * @tc.type: FUNC
265 * @tc.require:
266 */
267 HWTEST_F(FirstUseDialogTest, SaveFirstUseRecord002, TestSize.Level1)
268 {
269 std::string cmdline = "rm " + SEC_COMP_SRV_CFG_PATH + " -rf && touch " + SEC_COMP_SRV_CFG_PATH;
270 system(cmdline.c_str());
271 FirstUseDialog diag;
272 diag.firstUseMap_[1] = 1;
273 diag.SaveFirstUseRecord();
274 diag.firstUseMap_.clear();
275 diag.LoadFirstUseRecord();
276 EXPECT_EQ(0, static_cast<int32_t>(diag.firstUseMap_.size()));
277 std::string cmdline1 = "rm " + SEC_COMP_SRV_CFG_PATH + " && mkdir " +
278 SEC_COMP_SRV_CFG_PATH + " 0750 security_component security_component";
279 system(cmdline1.c_str());
280 }
281
282 /**
283 * @tc.name: SaveFirstUseRecord003
284 * @tc.desc: Test cfg file is not exist, tokenid is invalid.
285 * @tc.type: FUNC
286 * @tc.require:
287 */
288 HWTEST_F(FirstUseDialogTest, SaveFirstUseRecord003, TestSize.Level1)
289 {
290 FirstUseDialog diag;
291 OHOS::Security::AccessToken::AccessTokenKit::getHapTokenInfoRes = -1;
292 diag.firstUseMap_[1] = 1;
293 diag.SaveFirstUseRecord();
294 diag.firstUseMap_.clear();
295 diag.LoadFirstUseRecord();
296 EXPECT_EQ(0, static_cast<int32_t>(diag.firstUseMap_.size()));
297 OHOS::Security::AccessToken::AccessTokenKit::getHapTokenInfoRes = 0;
298 }
299
300 /**
301 * @tc.name: SaveFirstUseRecord004
302 * @tc.desc: Test cfg file is exist, save ok
303 * @tc.type: FUNC
304 * @tc.require:
305 */
306 HWTEST_F(FirstUseDialogTest, SaveFirstUseRecord004, TestSize.Level1)
307 {
308 FirstUseDialog diag;
309 diag.firstUseMap_[1] = 1;
310 diag.SaveFirstUseRecord();
311 diag.firstUseMap_.clear();
312 diag.LoadFirstUseRecord();
313 EXPECT_EQ(1, static_cast<int32_t>(diag.firstUseMap_.size()));
314 EXPECT_EQ(1, static_cast<int32_t>(diag.firstUseMap_[1]));
315 }
316
317 class TestRemoteObject : public IRemoteObject {
318 public:
TestRemoteObject(std::u16string descriptor)319 explicit TestRemoteObject(std::u16string descriptor) : IRemoteObject(descriptor)
320 {
321 };
322
323 ~TestRemoteObject() = default;
324
IsProxyObject() const325 bool IsProxyObject() const override
326 {
327 return false;
328 };
329
GetObjectRefCount()330 int32_t GetObjectRefCount() override
331 {
332 return 0;
333 };
334
Dump(int fd,const std::vector<std::u16string> & args)335 int Dump(int fd, const std::vector<std::u16string>& args) override
336 {
337 return 0;
338 };
339
SendRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)340 int SendRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override
341 {
342 return -1;
343 };
344
AddDeathRecipient(const sptr<DeathRecipient> & recipient)345 bool AddDeathRecipient(const sptr<DeathRecipient>& recipient) override
346 {
347 return false;
348 };
349
RemoveDeathRecipient(const sptr<DeathRecipient> & recipient)350 bool RemoveDeathRecipient(const sptr<DeathRecipient>& recipient) override
351 {
352 return false;
353 };
354 };
355
356 /*
357 * @tc.name: SetFirstUseMap001
358 * @tc.desc: Test SetFirstUseMap
359 * @tc.type: FUNC
360 * @tc.require:
361 */
362 HWTEST_F(FirstUseDialogTest, SetFirstUseMap001, TestSize.Level1)
363 {
364 FirstUseDialog diag;
365 std::shared_ptr<SecCompEntity> entity = std::make_shared<SecCompEntity>(nullptr, 0, 0, 0, 0);
366
367 std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create(true);
368 ASSERT_NE(nullptr, runner);
369 std::shared_ptr<SecEventHandler> handler = std::make_shared<SecEventHandler>(runner);
370 diag.secHandler_ = handler;
371
372 // no entity
373 EXPECT_EQ(diag.SetFirstUseMap(nullptr), false);
374
375 // type invalid
376 EXPECT_EQ(diag.SetFirstUseMap(entity), false);
377
378 // first use location button
379 entity->componentInfo_ = std::make_shared<LocationButton>();
380 entity->componentInfo_->type_ = LOCATION_COMPONENT;
381 entity->tokenId_ = 0;
382 EXPECT_EQ(diag.SetFirstUseMap(entity), true);
383 EXPECT_EQ(LOCATION_BUTTON_FIRST_USE, static_cast<uint64_t>(diag.firstUseMap_[0]));
384
385 // first use save button
386 entity->componentInfo_->type_ = SAVE_COMPONENT;
387 EXPECT_EQ(diag.SetFirstUseMap(entity), true);
388 EXPECT_EQ(LOCATION_BUTTON_FIRST_USE | SAVE_BUTTON_FIRST_USE, static_cast<uint64_t>(diag.firstUseMap_[0]));
389
390 // second use save button
391 EXPECT_EQ(diag.SetFirstUseMap(entity), true);
392 EXPECT_EQ(LOCATION_BUTTON_FIRST_USE | SAVE_BUTTON_FIRST_USE, static_cast<uint64_t>(diag.firstUseMap_[0]));
393
394 // wait for event handler done
395 sleep(3);
396 }
397
398 /*
399 * @tc.name: NotifyFirstUseDialog001
400 * @tc.desc: Test NotifyFirstUseDialog
401 * @tc.type: FUNC
402 * @tc.require:
403 */
404 HWTEST_F(FirstUseDialogTest, NotifyFirstUseDialog001, TestSize.Level1)
405 {
406 FirstUseDialog diag;
407 diag.secHandler_ = nullptr;
408
409 // no entity
410 EXPECT_EQ(diag.NotifyFirstUseDialog(nullptr, nullptr, nullptr), SC_SERVICE_ERROR_VALUE_INVALID);
411
412 std::shared_ptr<SecCompEntity> entity = std::make_shared<SecCompEntity>(nullptr, 0, 0, 0, 0);
413 // no handler
414 EXPECT_EQ(diag.NotifyFirstUseDialog(entity, nullptr, nullptr), SC_SERVICE_ERROR_VALUE_INVALID);
415
416 // no calltoken
417 std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create(true);
418 ASSERT_NE(nullptr, runner);
419 std::shared_ptr<SecEventHandler> handler = std::make_shared<SecEventHandler>(runner);
420 diag.secHandler_ = handler;
421 EXPECT_EQ(diag.NotifyFirstUseDialog(entity, nullptr, nullptr), SC_SERVICE_ERROR_VALUE_INVALID);
422
423 // no dialogCallback
424 sptr<TestRemoteObject> testRemoteObject = new TestRemoteObject(std::u16string());
425 EXPECT_EQ(diag.NotifyFirstUseDialog(entity, testRemoteObject, nullptr), SC_SERVICE_ERROR_VALUE_INVALID);
426
427 // type invalid
428 EXPECT_EQ(diag.NotifyFirstUseDialog(entity, testRemoteObject, testRemoteObject), SC_OK);
429
430 // first use location button
431 entity->componentInfo_ = std::make_shared<LocationButton>();
432 entity->componentInfo_->type_ = LOCATION_COMPONENT;
433 entity->tokenId_ = 0;
434 EXPECT_EQ(diag.NotifyFirstUseDialog(entity, testRemoteObject, testRemoteObject),
435 SC_SERVICE_ERROR_WAIT_FOR_DIALOG_CLOSE);
436 EXPECT_EQ(0, static_cast<uint64_t>(diag.firstUseMap_[0]));
437
438 // first use save button
439 entity->componentInfo_->type_ = SAVE_COMPONENT;
440 EXPECT_EQ(diag.NotifyFirstUseDialog(entity, testRemoteObject, testRemoteObject),
441 SC_SERVICE_ERROR_WAIT_FOR_DIALOG_CLOSE);
442 EXPECT_EQ(0, static_cast<uint64_t>(diag.firstUseMap_[0]));
443
444 // second use save button
445 EXPECT_EQ(diag.NotifyFirstUseDialog(entity, testRemoteObject, testRemoteObject),
446 SC_SERVICE_ERROR_WAIT_FOR_DIALOG_CLOSE);
447 EXPECT_EQ(0, static_cast<uint64_t>(diag.firstUseMap_[0]));
448
449 diag.StartDialogAbility(entity, testRemoteObject, testRemoteObject);
450
451 // wait for event handler done
452 sleep(3);
453 }
454
455 /*
456 * @tc.name: GrantDialogWaitEntity001
457 * @tc.desc: Test GrantDialogWaitEntity
458 * @tc.type: FUNC
459 * @tc.require:
460 */
461 HWTEST_F(FirstUseDialogTest, GrantDialogWaitEntity001, TestSize.Level1)
462 {
463 FirstUseDialog diag;
464 EXPECT_EQ(diag.GrantDialogWaitEntity(0), SC_SERVICE_ERROR_COMPONENT_NOT_EXIST);
465
466 diag.dialogWaitMap_[0] = nullptr;
467 EXPECT_EQ(diag.GrantDialogWaitEntity(0), SC_SERVICE_ERROR_COMPONENT_NOT_EXIST);
468
469 std::shared_ptr<SecCompEntity> entity = std::make_shared<SecCompEntity>(nullptr, 1, 0, 0, 0);
470 diag.dialogWaitMap_[0] = entity;
471 EXPECT_EQ(diag.GrantDialogWaitEntity(0), SC_SERVICE_ERROR_PERMISSION_OPER_FAIL);
472
473 std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create(true);
474 ASSERT_NE(runner, nullptr);
475
476 std::shared_ptr<SecEventHandler> handler = std::make_shared<SecEventHandler>(runner);
477 SecCompPermManager::GetInstance().InitEventHandler(handler);
478 entity->componentInfo_ = std::make_shared<SaveButton>();
479 entity->componentInfo_->type_ = SAVE_COMPONENT;
480 diag.dialogWaitMap_[1] = entity;
481 EXPECT_EQ(diag.GrantDialogWaitEntity(1), SC_OK);
482 }
483
484 /*
485 * @tc.name: RemoveDialogWaitEntitys001
486 * @tc.desc: Test RemoveDialogWaitEntitys
487 * @tc.type: FUNC
488 * @tc.require:
489 */
490 HWTEST_F(FirstUseDialogTest, RemoveDialogWaitEntitys001, TestSize.Level1)
491 {
492 FirstUseDialog diag;
493 std::shared_ptr<SecCompEntity> entity = std::make_shared<SecCompEntity>(nullptr, 0, 0, 0, 0);
494 std::shared_ptr<SecCompEntity> entity1 = std::make_shared<SecCompEntity>(nullptr, 0, 0, 1, 0);
495 diag.dialogWaitMap_[0] = entity;
496 diag.dialogWaitMap_[1] = entity1;
497 diag.RemoveDialogWaitEntitys(1);
498 EXPECT_EQ(diag.dialogWaitMap_.count(1), 0);
499 }
500
501 /*
502 * @tc.name: SecCompDialogSrvCallback001
503 * @tc.desc: Test SecCompDialogSrvCallback
504 * @tc.type: FUNC
505 * @tc.require:
506 */
507 HWTEST_F(FirstUseDialogTest, SecCompDialogSrvCallback001, TestSize.Level1)
508 {
509 SecCompDialogSrvCallback *call = new (std::nothrow)SecCompDialogSrvCallback(0, nullptr, nullptr);
510 sptr<SecCompDialogSrvCallback> srvCallback = call;
511
512 MessageParcel data;
513 MessageParcel reply;
514 MessageOption option;
515 EXPECT_EQ(srvCallback->OnRemoteRequest(ISecCompDialogCallback::ON_DIALOG_CLOSED, data, reply, option),
516 SC_SERVICE_ERROR_IPC_REQUEST_FAIL);
517
518 data.WriteInterfaceToken(ISecCompDialogCallback::GetDescriptor());
519 EXPECT_EQ(srvCallback->OnRemoteRequest(ISecCompDialogCallback::ON_DIALOG_CLOSED, data, reply, option),
520 SC_SERVICE_ERROR_IPC_REQUEST_FAIL);
521
522 MessageParcel data1;
523 data1.WriteInterfaceToken(ISecCompDialogCallback::GetDescriptor());
524 data1.WriteInt32(0);
525 EXPECT_EQ(srvCallback->OnRemoteRequest(ISecCompDialogCallback::ON_DIALOG_CLOSED, data1, reply, option),
526 0);
527
528 MessageParcel data2;
529 data2.WriteInterfaceToken(ISecCompDialogCallback::GetDescriptor());
530 EXPECT_NE(srvCallback->OnRemoteRequest(-1, data2, reply, option), 0);
531 }
532