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 <gtest/gtest.h>
17 #include <gmock/gmock.h>
18
19 #include "cloud_sync_asset_manager_impl.h"
20 #include "cloud_sync_service_proxy.h"
21 #include "dfs_error.h"
22 #include "utils_log.h"
23
24 namespace OHOS {
25 namespace FileManagement::CloudSync {
26 namespace Test {
27 using namespace testing;
28 using namespace testing::ext;
29 using namespace std;
30
31 class CloudSyncAssetManagerImplTest : public testing::Test {
32 public:
33 static void SetUpTestCase(void);
34 static void TearDownTestCase(void);
35 void SetUp();
36 void TearDown();
37 };
38
SetUpTestCase(void)39 void CloudSyncAssetManagerImplTest::SetUpTestCase(void)
40 {
41 std::cout << "SetUpTestCase" << std::endl;
42 }
43
TearDownTestCase(void)44 void CloudSyncAssetManagerImplTest::TearDownTestCase(void)
45 {
46 std::cout << "TearDownTestCase" << std::endl;
47 }
48
SetUp(void)49 void CloudSyncAssetManagerImplTest::SetUp(void)
50 {
51 std::cout << "SetUp" << std::endl;
52 }
53
TearDown(void)54 void CloudSyncAssetManagerImplTest::TearDown(void)
55 {
56 std::cout << "TearDown" << std::endl;
57 }
58
59 /**
60 * @tc.name: UploadAssetTest
61 * @tc.desc: Verify the UploadAsset function.
62 * @tc.type: FUNC
63 * @tc.require: I6H5MH
64 */
65 HWTEST_F(CloudSyncAssetManagerImplTest, UploadAssetTest, TestSize.Level1)
66 {
67 CloudSyncAssetManagerImpl assetManager;
68 int32_t userId = 100;
69 std::string request = "sample_request";
70 std::string result;
71 int32_t ret = assetManager.UploadAsset(userId, request, result);
72 EXPECT_EQ(ret, E_SA_LOAD_FAILED);
73 }
74
75 /**
76 * @tc.name: DownloadFileTest
77 * @tc.desc: Verify the DownloadFile function.
78 * @tc.type: FUNC
79 * @tc.require: I6H5MH
80 */
81 HWTEST_F(CloudSyncAssetManagerImplTest, DownloadFileTest, TestSize.Level1)
82 {
83 CloudSyncAssetManagerImpl assetManager;
84 int32_t userId = 100;
85 std::string request = "sample_request";
86 AssetInfo assetInfo;
87 int32_t ret = assetManager.DownloadFile(userId, request, assetInfo);
88 EXPECT_EQ(ret, E_SA_LOAD_FAILED);
89 }
90
91 } // namespace Test
92 } // namespace FileManagement::CloudSync
93 } // namespace OHOS
94