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
16 #include "ringtone_dualfw_restore_test.h"
17
18 #define private public
19 #define protected public
20 #include "ringtone_dualfw_restore.h"
21 #undef protected
22 #undef private
23 #include "ringtone_errno.h"
24 #include "ringtone_log.h"
25
26 using namespace std;
27 using namespace testing::ext;
28
29 namespace OHOS {
30 namespace Media {
31 const string TEST_BACKUP_PATH = "/data/test/backup";
32 unique_ptr<RingtoneDualfwRestore> restoreDualfwService = nullptr;
33
SetUpTestCase(void)34 void RingtoneDualfwRestoreTest::SetUpTestCase(void)
35 {
36 restoreDualfwService = std::make_unique<RingtoneDualfwRestore>();
37 int32_t res = restoreDualfwService->Init(TEST_BACKUP_PATH);
38 ASSERT_EQ(res, Media::E_OK);
39 }
40
TearDownTestCase(void)41 void RingtoneDualfwRestoreTest::TearDownTestCase(void)
42 {
43 restoreDualfwService = nullptr;
44 }
45
SetUp()46 void RingtoneDualfwRestoreTest::SetUp() {}
47
TearDown()48 void RingtoneDualfwRestoreTest::TearDown() {}
49
50 HWTEST_F(RingtoneDualfwRestoreTest, ringtone_dualfw_restore_test_0001, TestSize.Level0)
51 {
52 RINGTONE_INFO_LOG("ringtone_dualfw_restore_test_0001 start");
53 EXPECT_NE(restoreDualfwService->dualfwSetting_, nullptr);
54 EXPECT_NE(restoreDualfwService->mediaDataShare_, nullptr);
55 RINGTONE_INFO_LOG("ringtone_dualfw_restore_test_0001 end");
56 }
57 } // namespace Media
58 } // namespace OHOS