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_004, TestSize.Level1)
56 {
57 GTEST_LOG_(INFO) << "PluginLoaderTest_004 Start";
58 try {
59 PluginLoader::GetInstance().LoadCloudKitPlugin(false);
60 EXPECT_TRUE(true);
61 } catch (...) {
62 EXPECT_TRUE(false);
63 GTEST_LOG_(INFO) << "PluginLoaderTest_004 ERROR";
64 }
65 GTEST_LOG_(INFO) << "PluginLoaderTest_004 End";
66 }
67
68 HWTEST_F(PluginLoaderTest, PluginLoaderTest_005, TestSize.Level1)
69 {
70 GTEST_LOG_(INFO) << "PluginLoaderTest_005 Start";
71 try {
72 PluginLoader::GetInstance().LoadCloudKitPlugin();
73 EXPECT_TRUE(true);
74 } catch (...) {
75 EXPECT_TRUE(false);
76 GTEST_LOG_(INFO) << "PluginLoaderTest_005 ERROR";
77 }
78 GTEST_LOG_(INFO) << "PluginLoaderTest_005 End";
79 }
80 } // OHOS