• 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 <gmock/gmock.h>
17 #include <gtest/gtest.h>
18 
19 #include "dk_asset_read_session.h"
20 
21 namespace OHOS::FileManagement::CloudSync::Test {
22 using namespace testing;
23 using namespace testing::ext;
24 using namespace std;
25 
26 class DkAssetReadSessionTest : public testing::Test {
27 public:
28     static void SetUpTestCase(void);
29     static void TearDownTestCase(void);
30     void SetUp();
31     void TearDown();
32 };
SetUpTestCase(void)33 void DkAssetReadSessionTest::SetUpTestCase(void)
34 {
35     GTEST_LOG_(INFO) << "SetUpTestCase";
36 }
37 
TearDownTestCase(void)38 void DkAssetReadSessionTest::TearDownTestCase(void)
39 {
40     GTEST_LOG_(INFO) << "TearDownTestCase";
41 }
42 
SetUp(void)43 void DkAssetReadSessionTest::SetUp(void)
44 {
45     GTEST_LOG_(INFO) << "SetUp";
46 }
47 
TearDown(void)48 void DkAssetReadSessionTest::TearDown(void)
49 {
50     GTEST_LOG_(INFO) << "TearDown";
51 }
52 
53 /**
54  * @tc.name: Read
55  * @tc.desc: Verify the DKAssetReadSession::Read function
56  * @tc.type: FUNC
57  * @tc.require: SR000HRKKA
58  */
59 HWTEST_F(DkAssetReadSessionTest, Read, TestSize.Level1)
60 {
61     DriveKit::DKAssetReadSession mDkSession;
62     int64_t size = 0;
63     char *buffer = nullptr;
64     DriveKit::DKError error;
65     int64_t ret = mDkSession.Read(size, buffer, error);
66     EXPECT_EQ(ret, int64_t());
67 }
68 
69 /**
70  * @tc.name: PRead
71  * @tc.desc: Verify the DKAssetReadSession::PRead function
72  * @tc.type: FUNC
73  * @tc.require: SR000HRKKA
74  */
75 HWTEST_F(DkAssetReadSessionTest, PRead, TestSize.Level1)
76 {
77     DriveKit::DKAssetReadSession mDkSession;
78     int64_t size = 0, offset = 0;
79     char *buffer = nullptr;
80     DriveKit::DKError error;
81     int64_t ret = mDkSession.PRead(offset, size, buffer, error);
82     EXPECT_EQ(ret, int64_t());
83 }
84 } // namespace OHOS::FileManagement::CloudSync::Test
85