1 /*
2  * Copyright (C) 2022 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 #ifndef MEDIA_DATASHARE_UNIT_TEST_H
17 #define MEDIA_DATASHARE_UNIT_TEST_H
18 
19 #include <gtest/gtest.h>
20 #include <condition_variable>
21 #include "data_ability_observer_interface.h"
22 #include "datashare_helper.h"
23 #include "data_ability_observer_stub.h"
24 
25 namespace OHOS {
26 namespace DataShare {
27 using ChangeInfo = DataShareObserver::ChangeInfo;
28 using Value = std::variant<std::monostate, int64_t, double, std::string, bool, std::vector<uint8_t>>;
29 using VBucket = std::map<std::string, Value>;
30 using VBuckets = std::vector<VBucket>;
31 class MediaDataShareUnitTest : public testing::Test {
32 public:
33     /* SetUpTestCase:The preset action of the test suite is executed before the first TestCase */
34     static void SetUpTestCase(void);
35 
36     /* TearDownTestCase:The test suite cleanup action is executed after the last TestCase */
37     static void TearDownTestCase(void);
38 
39     /* SetUp:Execute before each test case */
40     void SetUp();
41 
42     /* TearDown:Execute after each test case */
43     void TearDown();
44     bool UrisEqual(std::list<Uri> uri1, std::list<Uri> uri2);
45     bool ValueBucketEqual(const VBuckets& vb1, const VBuckets& vb2);
46     bool ChangeInfoEqual(const ChangeInfo &changeInfo, const ChangeInfo &expectChangeInfo);
47 };
48 
49 class IDataAbilityObserverTest : public AAFwk::DataAbilityObserverStub {
50 public:
51     IDataAbilityObserverTest();
~IDataAbilityObserverTest()52     ~IDataAbilityObserverTest()
53     {}
54 
OnChange()55     void OnChange()
56     {
57         GTEST_LOG_(INFO) << "OnChange enter";
58     }
59 };
60 
61 } // namespace Media
62 } // namespace OHOS
63 
64 #endif  // MEDIA_DATASHARE_UNIT_TEST_H
65