1 /*
2 * Copyright (c) 2024 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 <gmock/gmock.h>
16 #include <gtest/gtest.h>
17
18 #include "plugin_loader.h"
19
20 namespace OHOS::FileManagement::CloudFile::Test {
21 using namespace std;
22 using namespace OHOS;
23 using namespace testing::ext;
24
25 class PluginLoaderTest : public testing::Test {
26 public:
27 static void SetUpTestCase(void);
28 static void TearDownTestCase(void);
29 void SetUp();
30 void TearDown();
31 };
32
SetUpTestCase(void)33 void PluginLoaderTest::SetUpTestCase(void) {}
34
TearDownTestCase(void)35 void PluginLoaderTest::TearDownTestCase(void) {}
36
SetUp(void)37 void PluginLoaderTest::SetUp(void) {}
38
TearDown(void)39 void PluginLoaderTest::TearDown(void) {}
40
41 HWTEST_F(PluginLoaderTest, PluginLoaderTest_001, TestSize.Level1)
42 {
43 GTEST_LOG_(INFO) << "PluginLoaderTest_001 Start";
44 try {
45 PluginLoader pluginLoader;
46 pluginLoader.GetInstance();
47 EXPECT_TRUE(true);
48 } catch (...) {
49 EXPECT_TRUE(false);
50 GTEST_LOG_(INFO) << "PluginLoaderTest_001 ERROR";
51 }
52 GTEST_LOG_(INFO) << "PluginLoaderTest_001 End";
53 }
54
55 HWTEST_F(PluginLoaderTest, PluginLoaderTest_003, TestSize.Level1)
56 {
57 GTEST_LOG_(INFO) << "PluginLoaderTest_003 Start";
58 try {
59 PluginLoader pluginLoader;
60 bool isSupportCloudSync = false;
61 pluginLoader.LoadCloudKitPlugin(isSupportCloudSync);
62 EXPECT_TRUE(true);
63 } catch (...) {
64 EXPECT_TRUE(false);
65 GTEST_LOG_(INFO) << "PluginLoaderTest_003 ERROR";
66 }
67 GTEST_LOG_(INFO) << "PluginLoaderTest_003 End";
68 }
69
70 HWTEST_F(PluginLoaderTest, PluginLoaderTest_004, TestSize.Level1)
71 {
72 GTEST_LOG_(INFO) << "PluginLoaderTest_004 Start";
73 try {
74 PluginLoader::GetInstance().LoadCloudKitPlugin(true);
75 EXPECT_TRUE(true);
76 } catch (...) {
77 EXPECT_TRUE(false);
78 GTEST_LOG_(INFO) << "PluginLoaderTest_004 ERROR";
79 }
80 GTEST_LOG_(INFO) << "PluginLoaderTest_004 End";
81 }
82
83 HWTEST_F(PluginLoaderTest, PluginLoaderTest_005, TestSize.Level1)
84 {
85 GTEST_LOG_(INFO) << "PluginLoaderTest_005 Start";
86 try {
87 PluginLoader::GetInstance().LoadCloudKitPlugin();
88 EXPECT_TRUE(true);
89 } catch (...) {
90 EXPECT_TRUE(false);
91 GTEST_LOG_(INFO) << "PluginLoaderTest_005 ERROR";
92 }
93 GTEST_LOG_(INFO) << "PluginLoaderTest_005 End";
94 }
95 } // OHOS