• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 <memory>
18 #include <string>
19 
20 #include "bundle_used_record_parcel.h"
21 #include "parcel.h"
22 #include "parcel_utils.h"
23 #include "perm_active_response_parcel.h"
24 #include "permission_used_record_parcel.h"
25 #include "permission_used_request_parcel.h"
26 #include "permission_used_result_parcel.h"
27 #include "used_record_detail_parcel.h"
28 
29 using namespace testing::ext;
30 
31 namespace OHOS {
32 namespace Security {
33 namespace AccessToken {
34 namespace {
35 UsedRecordDetail g_accessRecord1 = {
36     .status = 0,
37     .timestamp = 0L,
38     .accessDuration = 0L,
39 };
40 
41 UsedRecordDetail g_accessRecord2 = {
42     .status = 1,
43     .timestamp = 1L,
44     .accessDuration = 1L,
45 };
46 
47 UsedRecordDetail g_rejectRecord1 = {
48     .status = 2,
49     .timestamp = 2L,
50     .accessDuration = 2L,
51 };
52 
53 UsedRecordDetail g_rejectRecord2 = {
54     .status = 3,
55     .timestamp = 3L,
56     .accessDuration = 3L,
57 };
58 
59 PermissionUsedRecord g_permissionRecord1 = {
60     .permissionName = "ohos.permission.CAMERA",
61     .accessCount = 2,
62     .rejectCount = 2,
63     .lastAccessTime = 0L,
64     .lastRejectTime = 0L,
65     .lastAccessDuration = 0L,
66 };
67 
68 PermissionUsedRecord g_permissionRecord2 = {
69     .permissionName = "ohos.permission.LOCATION",
70     .accessCount = 2,
71     .rejectCount = 2,
72     .lastAccessTime = 1L,
73     .lastRejectTime = 1L,
74     .lastAccessDuration = 1L,
75 };
76 
77 BundleUsedRecord g_bundleUsedRecord1 = {
78     .tokenId = 100,
79     .isRemote = false,
80     .deviceId = "you guess",
81     .bundleName = "com.ohos.test",
82 };
83 
84 BundleUsedRecord g_bundleUsedRecord2 = {
85     .tokenId = 101,
86     .isRemote = false,
87     .deviceId = "i want to know too",
88     .bundleName = "com.ohos.permissionmanager",
89 };
90 }
91 
92 class PrivacyParcelTest : public testing::Test  {
93 public:
94     static void SetUpTestCase();
95     static void TearDownTestCase();
96 
97     void SetUp();
98     void TearDown();
99 };
100 
SetUpTestCase()101 void PrivacyParcelTest::SetUpTestCase() {}
TearDownTestCase()102 void PrivacyParcelTest::TearDownTestCase() {}
SetUp()103 void PrivacyParcelTest::SetUp() {}
TearDown()104 void PrivacyParcelTest::TearDown() {}
105 
106 /**
107  * @tc.name: BundleUsedRecordParcel001
108  * @tc.desc: Verify the CreateHapTokenInfo add one hap token function.
109  * @tc.type: FUNC
110  * @tc.require: issueI5RUCC
111  */
112 HWTEST_F(PrivacyParcelTest, BundleUsedRecordParcel001, TestSize.Level1)
113 {
114     BundleUsedRecordParcel bundleUsedRecordParcel;
115 
116     bundleUsedRecordParcel.bundleRecord = {
117         .tokenId = 100,
118         .isRemote = false,
119         .deviceId = "device",
120         .bundleName = "com.ohos.permissionmanager",
121     };
122 
123     g_permissionRecord1.accessRecords.emplace_back(g_accessRecord1);
124     g_permissionRecord1.accessRecords.emplace_back(g_accessRecord2);
125     g_permissionRecord2.rejectRecords.emplace_back(g_rejectRecord1);
126     g_permissionRecord2.rejectRecords.emplace_back(g_rejectRecord2);
127 
128     bundleUsedRecordParcel.bundleRecord.permissionRecords.emplace_back(g_permissionRecord1);
129     bundleUsedRecordParcel.bundleRecord.permissionRecords.emplace_back(g_permissionRecord2);
130 
131     Parcel parcel;
132     EXPECT_EQ(true, bundleUsedRecordParcel.Marshalling(parcel));
133 
134     std::shared_ptr<BundleUsedRecordParcel> readedData(BundleUsedRecordParcel::Unmarshalling(parcel));
135     EXPECT_EQ(true, readedData != nullptr);
136 
137     EXPECT_EQ(bundleUsedRecordParcel.bundleRecord.tokenId, readedData->bundleRecord.tokenId);
138     EXPECT_EQ(bundleUsedRecordParcel.bundleRecord.isRemote, readedData->bundleRecord.isRemote);
139     EXPECT_EQ(bundleUsedRecordParcel.bundleRecord.deviceId, readedData->bundleRecord.deviceId);
140     EXPECT_EQ(bundleUsedRecordParcel.bundleRecord.bundleName, readedData->bundleRecord.bundleName);
141 }
142 
143 /**
144  * @tc.name: ActiveChangeResponseParcel001
145  * @tc.desc: Verify ActiveChangeResponseParcel Marshalling and Unmarshalling function.
146  * @tc.type: FUNC
147  * @tc.require: issueI5RRLJ
148  */
149 HWTEST_F(PrivacyParcelTest, ActiveChangeResponseParcel001, TestSize.Level1)
150 {
151     ActiveChangeResponseParcel activeChangeResponseParcel;
152 
153     activeChangeResponseParcel.changeResponse = {
154         .tokenID = 100,
155         .permissionName = "ohos.permission.CAMERA",
156         .deviceId = "device",
157         .type = PERM_INACTIVE,
158     };
159 
160     Parcel parcel;
161     EXPECT_EQ(true, activeChangeResponseParcel.Marshalling(parcel));
162 
163     std::shared_ptr<ActiveChangeResponseParcel> readedData(ActiveChangeResponseParcel::Unmarshalling(parcel));
164     EXPECT_EQ(true, readedData != nullptr);
165 
166     EXPECT_EQ(activeChangeResponseParcel.changeResponse.tokenID, readedData->changeResponse.tokenID);
167     EXPECT_EQ(activeChangeResponseParcel.changeResponse.permissionName, readedData->changeResponse.permissionName);
168     EXPECT_EQ(activeChangeResponseParcel.changeResponse.deviceId, readedData->changeResponse.deviceId);
169     EXPECT_EQ(activeChangeResponseParcel.changeResponse.type, readedData->changeResponse.type);
170 }
171 
172 /**
173  * @tc.name: PermissionUsedRecordParcel001
174  * @tc.desc: Verify the PermissionUsedRecordParcel Marshalling and Unmarshalling function.
175  * @tc.type: FUNC
176  * @tc.require: issueI5RUCC
177  */
178 HWTEST_F(PrivacyParcelTest, PermissionUsedRecordParcel001, TestSize.Level1)
179 {
180     PermissionUsedRecordParcel permissionUsedRecordParcel;
181 
182     permissionUsedRecordParcel.permissionRecord = {
183         .permissionName = "ohos.permission.CAMERA",
184         .accessCount = 2,
185         .rejectCount = 2,
186         .lastAccessTime = 0L,
187         .lastRejectTime = 0L,
188         .lastAccessDuration = 0L,
189     };
190     permissionUsedRecordParcel.permissionRecord.accessRecords.emplace_back(g_accessRecord1);
191     permissionUsedRecordParcel.permissionRecord.accessRecords.emplace_back(g_accessRecord2);
192     permissionUsedRecordParcel.permissionRecord.rejectRecords.emplace_back(g_rejectRecord1);
193     permissionUsedRecordParcel.permissionRecord.rejectRecords.emplace_back(g_rejectRecord2);
194 
195     Parcel parcel;
196     EXPECT_EQ(true, permissionUsedRecordParcel.Marshalling(parcel));
197 
198     std::shared_ptr<PermissionUsedRecordParcel> readedData(PermissionUsedRecordParcel::Unmarshalling(parcel));
199     EXPECT_EQ(true, readedData != nullptr);
200 
201     EXPECT_EQ(permissionUsedRecordParcel.permissionRecord.permissionName, readedData->permissionRecord.permissionName);
202     EXPECT_EQ(permissionUsedRecordParcel.permissionRecord.accessCount, readedData->permissionRecord.accessCount);
203     EXPECT_EQ(permissionUsedRecordParcel.permissionRecord.rejectCount, readedData->permissionRecord.rejectCount);
204     EXPECT_EQ(permissionUsedRecordParcel.permissionRecord.lastAccessTime, readedData->permissionRecord.lastAccessTime);
205     EXPECT_EQ(permissionUsedRecordParcel.permissionRecord.lastRejectTime, readedData->permissionRecord.lastRejectTime);
206     EXPECT_EQ(permissionUsedRecordParcel.permissionRecord.lastAccessDuration,
207         readedData->permissionRecord.lastAccessDuration);
208 
209     for (uint32_t i = 0; i < permissionUsedRecordParcel.permissionRecord.accessRecords.size(); i++) {
210         EXPECT_EQ(permissionUsedRecordParcel.permissionRecord.accessRecords[i].status,
211             readedData->permissionRecord.accessRecords[i].status);
212         EXPECT_EQ(permissionUsedRecordParcel.permissionRecord.accessRecords[i].timestamp,
213             readedData->permissionRecord.accessRecords[i].timestamp);
214         EXPECT_EQ(permissionUsedRecordParcel.permissionRecord.accessRecords[i].accessDuration,
215             readedData->permissionRecord.accessRecords[i].accessDuration);
216     }
217 
218     for (uint32_t i = 0; i < permissionUsedRecordParcel.permissionRecord.rejectRecords.size(); i++) {
219         EXPECT_EQ(permissionUsedRecordParcel.permissionRecord.rejectRecords[i].status,
220             readedData->permissionRecord.rejectRecords[i].status);
221         EXPECT_EQ(permissionUsedRecordParcel.permissionRecord.rejectRecords[i].timestamp,
222             readedData->permissionRecord.rejectRecords[i].timestamp);
223         EXPECT_EQ(permissionUsedRecordParcel.permissionRecord.rejectRecords[i].accessDuration,
224             readedData->permissionRecord.rejectRecords[i].accessDuration);
225     }
226 }
227 
228 /**
229  * @tc.name: PermissionUsedRequestParcel001
230  * @tc.desc: Verify the PermissionUsedRequestParcel Marshalling and Unmarshalling function.
231  * @tc.type: FUNC
232  * @tc.require: issueI5RUP1
233  */
234 HWTEST_F(PrivacyParcelTest, PermissionUsedRequestParcel001, TestSize.Level1)
235 {
236     PermissionUsedRequestParcel permissionUsedRequestParcel;
237 
238     permissionUsedRequestParcel.request = {
239         .tokenId = 100,
240         .isRemote = false,
241         .deviceId = "you guess",
242         .bundleName = "com.ohos.permissionmanager",
243         .beginTimeMillis = 0L,
244         .endTimeMillis = 0L,
245         .flag = FLAG_PERMISSION_USAGE_SUMMARY,
246     };
247     permissionUsedRequestParcel.request.permissionList.emplace_back("ohos.permission.CAMERA");
248     permissionUsedRequestParcel.request.permissionList.emplace_back("ohos.permission.LOCATION");
249 
250     Parcel parcel;
251     EXPECT_EQ(true, permissionUsedRequestParcel.Marshalling(parcel));
252 
253     std::shared_ptr<PermissionUsedRequestParcel> readedData(PermissionUsedRequestParcel::Unmarshalling(parcel));
254     EXPECT_EQ(true, readedData != nullptr);
255 
256     EXPECT_EQ(permissionUsedRequestParcel.request.tokenId, readedData->request.tokenId);
257     EXPECT_EQ(permissionUsedRequestParcel.request.isRemote, readedData->request.isRemote);
258     EXPECT_EQ(permissionUsedRequestParcel.request.deviceId, readedData->request.deviceId);
259     EXPECT_EQ(permissionUsedRequestParcel.request.bundleName, readedData->request.bundleName);
260     EXPECT_EQ(permissionUsedRequestParcel.request.beginTimeMillis, readedData->request.beginTimeMillis);
261     EXPECT_EQ(permissionUsedRequestParcel.request.endTimeMillis, readedData->request.endTimeMillis);
262     EXPECT_EQ(permissionUsedRequestParcel.request.flag, readedData->request.flag);
263 
264     for (uint32_t i = 0; i < permissionUsedRequestParcel.request.permissionList.size(); i++) {
265         EXPECT_EQ(permissionUsedRequestParcel.request.permissionList[i], readedData->request.permissionList[i]);
266     }
267 }
268 
269 /**
270  * @tc.name: PermissionUsedResultParcel001
271  * @tc.desc: Verify the PermissionUsedResultParcel Marshalling and Unmarshalling function.
272  * @tc.type: FUNC
273  * @tc.require: issueI5RWP4
274  */
275 HWTEST_F(PrivacyParcelTest, PermissionUsedResultParcel001, TestSize.Level1)
276 {
277     PermissionUsedResultParcel permissionUsedResultParcel;
278 
279     permissionUsedResultParcel.result = {
280         .beginTimeMillis = 0L,
281         .endTimeMillis = 0L,
282     };
283 
284     g_bundleUsedRecord1.permissionRecords.emplace_back(g_permissionRecord1);
285     g_bundleUsedRecord1.permissionRecords.emplace_back(g_permissionRecord2);
286     g_bundleUsedRecord2.permissionRecords.emplace_back(g_permissionRecord1);
287     g_bundleUsedRecord2.permissionRecords.emplace_back(g_permissionRecord2);
288 
289     permissionUsedResultParcel.result.bundleRecords.emplace_back(g_bundleUsedRecord1);
290     permissionUsedResultParcel.result.bundleRecords.emplace_back(g_bundleUsedRecord2);
291 
292     Parcel parcel;
293     EXPECT_EQ(true, permissionUsedResultParcel.Marshalling(parcel));
294 
295     std::shared_ptr<PermissionUsedResultParcel> readedData(PermissionUsedResultParcel::Unmarshalling(parcel));
296     EXPECT_EQ(true, readedData != nullptr);
297 
298     EXPECT_EQ(permissionUsedResultParcel.result.beginTimeMillis, readedData->result.beginTimeMillis);
299     EXPECT_EQ(permissionUsedResultParcel.result.endTimeMillis, readedData->result.endTimeMillis);
300 }
301 
302 /**
303  * @tc.name: UsedRecordDetailParcel001
304  * @tc.desc: Verify the UsedRecordDetailParcel Marshalling and Unmarshalling function.
305  * @tc.type: FUNC
306  * @tc.require: issueI5RWP4
307  */
308 HWTEST_F(PrivacyParcelTest, UsedRecordDetailParcel001, TestSize.Level1)
309 {
310     UsedRecordDetailParcel usedRecordDetailParcel;
311 
312     usedRecordDetailParcel.detail = {
313         .status = 0,
314         .timestamp = 0L,
315         .accessDuration = 0L,
316     };
317 
318     Parcel parcel;
319     EXPECT_EQ(true, usedRecordDetailParcel.Marshalling(parcel));
320 
321     std::shared_ptr<UsedRecordDetailParcel> readedData(UsedRecordDetailParcel::Unmarshalling(parcel));
322     EXPECT_EQ(true, readedData != nullptr);
323 
324     EXPECT_EQ(usedRecordDetailParcel.detail.status, readedData->detail.status);
325     EXPECT_EQ(usedRecordDetailParcel.detail.timestamp, readedData->detail.timestamp);
326     EXPECT_EQ(usedRecordDetailParcel.detail.accessDuration, readedData->detail.accessDuration);
327 }
328 
BundleUsedRecordData(Parcel & out,uint32_t size)329 void BundleUsedRecordData(Parcel& out, uint32_t size)
330 {
331     EXPECT_EQ(true, out.WriteUint32(100)); // 100: tokenid
332     EXPECT_EQ(true, out.WriteBool(false));
333     EXPECT_EQ(true, out.WriteString("device"));
334     EXPECT_EQ(true, out.WriteString("bundleName"));
335 
336     EXPECT_EQ(true, out.WriteUint32(size));
337 
338     g_permissionRecord1.accessRecords.emplace_back(g_accessRecord1);
339 
340     for (uint32_t i = 0; i < size; i++) {
341         PermissionUsedRecordParcel permRecordParcel;
342         permRecordParcel.permissionRecord = g_permissionRecord1;
343         out.WriteParcelable(&permRecordParcel);
344     }
345 }
346 /**
347  * @tc.name: BundleUsedRecordParcel002
348  * @tc.desc: Test BundleUsedRecordParcel Marshalling/Unmarshalling.
349  * @tc.type: FUNC
350  * @tc.require: issueI5QKZF
351  */
352 HWTEST_F(PrivacyParcelTest, BundleUsedRecordParcel002, TestSize.Level1)
353 {
354     Parcel parcel;
355     BundleUsedRecordData(parcel, MAX_RECORD_SIZE);
356     std::shared_ptr<BundleUsedRecordParcel> readedData(BundleUsedRecordParcel::Unmarshalling(parcel));
357     EXPECT_EQ(true, readedData != nullptr);
358 
359     Parcel parcel1;
360     BundleUsedRecordData(parcel1, MAX_RECORD_SIZE + 1);
361     std::shared_ptr<BundleUsedRecordParcel> readedData1(BundleUsedRecordParcel::Unmarshalling(parcel1));
362     EXPECT_EQ(true, readedData1 == nullptr);
363 }
364 
DataMarshalling(Parcel & out,uint32_t accessSize,uint32_t rejectSize)365 void DataMarshalling(Parcel& out, uint32_t accessSize, uint32_t rejectSize)
366 {
367     UsedRecordDetail detailIns = {0, 0L, 0L};
368     EXPECT_EQ(true, out.WriteString("permissionName"));
369     EXPECT_EQ(true, out.WriteInt32(1));
370     EXPECT_EQ(true, out.WriteInt32(1));
371     EXPECT_EQ(true, out.WriteInt64(0L));
372     EXPECT_EQ(true, out.WriteInt64(0L));
373     EXPECT_EQ(true, out.WriteInt64(0L));
374 
375     EXPECT_EQ(true, out.WriteUint32(accessSize));
376     for (uint32_t i = 0; i < accessSize; i++) {
377         UsedRecordDetailParcel detailParcel;
378         detailParcel.detail = detailIns;
379         out.WriteParcelable(&detailParcel);
380     }
381 
382     EXPECT_EQ(true, out.WriteUint32(rejectSize));
383     for (uint32_t i = 0; i < rejectSize; i++) {
384         UsedRecordDetailParcel detailParcel;
385         detailParcel.detail = detailIns;
386         out.WriteParcelable(&detailParcel);
387     }
388 }
389 
390 /**
391  * @tc.name: PermissionUsedRecordParcel002
392  * @tc.desc: Test PermissionUsedRecordParcel Marshalling/Unmarshalling.
393  * @tc.type: FUNC
394  * @tc.require: issueI5QKZF
395  */
396 HWTEST_F(PrivacyParcelTest, PermissionUsedRecordParcel002, TestSize.Level1)
397 {
398     Parcel parcel;
399     DataMarshalling(parcel, MAX_ACCESS_RECORD_SIZE, MAX_ACCESS_RECORD_SIZE);
400     std::shared_ptr<PermissionUsedRecordParcel> readedData(PermissionUsedRecordParcel::Unmarshalling(parcel));
401     EXPECT_EQ(true, readedData != nullptr);
402 
403     Parcel parcel1;
404     DataMarshalling(parcel1, MAX_ACCESS_RECORD_SIZE, MAX_ACCESS_RECORD_SIZE + 1);
405     std::shared_ptr<PermissionUsedRecordParcel> readedData1(PermissionUsedRecordParcel::Unmarshalling(parcel1));
406     EXPECT_EQ(true, readedData1 == nullptr);
407 
408     Parcel parcel2;
409     DataMarshalling(parcel2, MAX_ACCESS_RECORD_SIZE + 1, MAX_ACCESS_RECORD_SIZE);
410     std::shared_ptr<PermissionUsedRecordParcel> readedData2(PermissionUsedRecordParcel::Unmarshalling(parcel2));
411     EXPECT_EQ(true, readedData2 == nullptr);
412 }
413 
414 /**
415  * @tc.name: PermissionUsedRequestParcel002
416  * @tc.desc: Verify the PermissionUsedRequestParcel Marshalling and Unmarshalling function.
417  * @tc.type: FUNC
418  * @tc.require: issueI5RUP1
419  */
420 HWTEST_F(PrivacyParcelTest, PermissionUsedRequestParcel002, TestSize.Level1)
421 {
422     PermissionUsedRequestParcel permissionUsedRequestParcel;
423 
424     permissionUsedRequestParcel.request = {
425         .tokenId = 100,
426         .isRemote = false,
427         .deviceId = "deviceId",
428         .bundleName = "com.ohos.permissionmanager",
429         .beginTimeMillis = 0L,
430         .endTimeMillis = 0L,
431         .flag = FLAG_PERMISSION_USAGE_SUMMARY,
432     };
433     for (uint32_t i = 0; i < MAX_PERMLIST_SIZE; i++) {
434         permissionUsedRequestParcel.request.permissionList.emplace_back("ohos.permission.CAMERA");
435     }
436 
437     Parcel parcel;
438     EXPECT_EQ(true, permissionUsedRequestParcel.Marshalling(parcel));
439     std::shared_ptr<PermissionUsedRequestParcel> readedData(PermissionUsedRequestParcel::Unmarshalling(parcel));
440     EXPECT_NE(readedData, nullptr);
441 
442     permissionUsedRequestParcel.request.permissionList.emplace_back("ohos.permission.CAMERA");
443     Parcel parcel1;
444     EXPECT_EQ(true, permissionUsedRequestParcel.Marshalling(parcel1));
445     std::shared_ptr<PermissionUsedRequestParcel> readedData1(PermissionUsedRequestParcel::Unmarshalling(parcel1));
446     EXPECT_EQ(readedData1, nullptr);
447 }
448 
449 /**
450  * @tc.name: PermissionUsedResultParcel002
451  * @tc.desc: Verify the PermissionUsedResultParcel Marshalling and Unmarshalling function.
452  * @tc.type: FUNC
453  * @tc.require: issueI5RWP4
454  */
455 HWTEST_F(PrivacyParcelTest, PermissionUsedResultParcel002, TestSize.Level1)
456 {
457     PermissionUsedResultParcel permissionUsedResultParcel;
458 
459     permissionUsedResultParcel.result = {
460         .beginTimeMillis = 0L,
461         .endTimeMillis = 0L,
462     };
463 
464     g_bundleUsedRecord1.permissionRecords.emplace_back(g_permissionRecord1);
465     g_bundleUsedRecord1.permissionRecords.emplace_back(g_permissionRecord2);
466 
467     for (uint32_t i = 0; i < 1024; i++) {
468         permissionUsedResultParcel.result.bundleRecords.emplace_back(g_bundleUsedRecord1);
469     }
470 
471     Parcel parcel;
472     EXPECT_EQ(true, permissionUsedResultParcel.Marshalling(parcel));
473     auto* resultParcel = new (std::nothrow) PermissionUsedResultParcel();
474     ASSERT_NE(resultParcel, nullptr);
475     EXPECT_EQ(true, parcel.ReadInt64(resultParcel->result.beginTimeMillis));
476     EXPECT_EQ(true, parcel.ReadInt64(resultParcel->result.endTimeMillis));
477     uint32_t bundResponseSize = 0;
478     EXPECT_EQ(true, parcel.ReadUint32(bundResponseSize));
479     EXPECT_EQ(true, bundResponseSize <= MAX_RECORD_SIZE);
480     EXPECT_EQ(true, resultParcel != nullptr);
481     delete resultParcel;
482     permissionUsedResultParcel.result.bundleRecords.emplace_back(g_bundleUsedRecord1);
483 
484     Parcel parcel1;
485     EXPECT_EQ(true, permissionUsedResultParcel.Marshalling(parcel1));
486     auto* resultParcel2 = new (std::nothrow) PermissionUsedResultParcel();
487     ASSERT_NE(resultParcel2, nullptr);
488     EXPECT_EQ(true, parcel1.ReadInt64(resultParcel2->result.beginTimeMillis));
489     EXPECT_EQ(true, parcel1.ReadInt64(resultParcel2->result.endTimeMillis));
490     uint32_t bundResponseSize1 = 0;
491     EXPECT_EQ(true, parcel1.ReadUint32(bundResponseSize1));
492     GTEST_LOG_(INFO) << "bundResponseSize1 :" << bundResponseSize1;
493     EXPECT_EQ(true, bundResponseSize1 > MAX_RECORD_SIZE);
494     delete resultParcel2;
495 
496     Parcel parcel2;
497     EXPECT_EQ(true, permissionUsedResultParcel.Marshalling(parcel2));
498     std::shared_ptr<PermissionUsedResultParcel> readedData1(PermissionUsedResultParcel::Unmarshalling(parcel2));
499     EXPECT_EQ(readedData1, nullptr);
500 }
501 } // namespace AccessToken
502 } // namespace Security
503 } // namespace OHOS
504