1 /* 2 * Copyright (c) 2021-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 CONTACTSDATAABILITY_BASE_TEST_H 17 #define CONTACTSDATAABILITY_BASE_TEST_H 18 19 #include <gtest/gtest.h> 20 21 #include "calllog_ability.h" 22 #include "contacts_data_ability.h" 23 #include "data_ability_result.h" 24 #include "datashare_values_bucket.h" 25 #include "hilog_wrapper.h" 26 #include "voicemail_ability.h" 27 28 namespace Contacts { 29 namespace Test { 30 class BaseTest : public testing::Test { 31 public: 32 BaseTest(); 33 ~BaseTest(); 34 OHOS::AbilityRuntime::CallLogAbility calllogAbility; 35 OHOS::AbilityRuntime::VoiceMailAbility voicemailAbility; 36 OHOS::AbilityRuntime::ContactsDataAbility contactsDataAbility; 37 void CheckResultSet(OHOS::DataShare::DataShareValuesBucket &rawContactValues, 38 const std::shared_ptr<OHOS::DataShare::DataShareResultSet> &resultSet, std::string testName); 39 void CheckData(OHOS::DataShare::DataShareValuesBucket &rawContactValues, 40 const std::shared_ptr<OHOS::DataShare::DataShareResultSet> &resultSet, std::string &columnName, 41 std::string testName); 42 void CheckResultSetList(std::vector<OHOS::DataShare::DataShareValuesBucket> &valuesVector, 43 std::shared_ptr<OHOS::DataShare::DataShareResultSet> &resultSet, std::string testName); 44 OHOS::DataShare::DataShareValuesBucket GetAllColumnsValues( 45 std::vector<std::string> &columnsInt, std::vector<std::string> &columnsStr); 46 int ContactsRand(); 47 void InitAbility(); 48 }; 49 } // namespace Test 50 } // namespace Contacts 51 #endif // CONTACTSDATAABILITY_BASE_TEST_H 52