1 /* 2 * Copyright (C) 2021 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 MEDIASCANNER_UNIT_TEST_H 17 #define MEDIASCANNER_UNIT_TEST_H 18 19 #include <condition_variable> 20 #include <chrono> 21 #include <fstream> 22 #include <iostream> 23 #include <mutex> 24 #include <string> 25 #include <sys/stat.h> 26 #include <thread> 27 28 #include "gtest/gtest.h" 29 #include "imedia_scanner_callback.h" 30 31 namespace OHOS { 32 namespace Media { 33 class MediaScannerUnitTest : public testing::Test { 34 public: 35 static void SetUpTestCase(void); 36 static void TearDownTestCase(void); 37 void SetUp(); 38 void TearDown(); 39 static void WaitForCallback(); 40 }; 41 42 class ApplicationCallback : public IMediaScannerCallback { 43 public: 44 explicit ApplicationCallback(const std::string &testCaseName); 45 ~ApplicationCallback() = default; 46 47 int32_t OnScanFinished(const int32_t status, const std::string &uri, const std::string &path) override; 48 49 private: 50 std::string testCaseName_; 51 }; 52 } // namespace Media 53 } // namespace OHOS 54 #endif // MEDIASCANNER_UNIT_TEST_H 55