• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef OHOS_FILEMANAGEMENT_USERFILEMGR_PHOTOALBUM_UNITTEST_H
17 #define OHOS_FILEMANAGEMENT_USERFILEMGR_PHOTOALBUM_UNITTEST_H
18 
19 #include <gtest/gtest.h>
20 #include <condition_variable>
21 #include "datashare_helper.h"
22 
23 namespace OHOS::Media {
24 class TestObserver : public DataShare::DataShareObserver  {
25 public:
TestObserver()26     TestObserver() {}
27 
28     ~TestObserver() = default;
29 
OnChange(const ChangeInfo & changeInfo)30     void OnChange(const ChangeInfo &changeInfo) override
31     {
32         changeInfo_ = changeInfo;
33         std::unique_lock<std::mutex> lock(mutex_);
34         condition_.notify_one();
35     }
36 
37     ChangeInfo changeInfo_;
38     std::mutex mutex_;
39     std::condition_variable condition_;
40 };
41 class NotifyTest : public testing::Test {
42 public:
43     static void SetUpTestCase();
44     static void TearDownTestCase();
45     void SetUp() override;
46     void TearDown() override;
47 };
48 } // namespace OHOS::Media
49 #endif // OHOS_FILEMANAGEMENT_USERFILEMGR_PHOTOALBUM_UNITTEST_H
50