1 /* 2 * Copyright (c) 2020 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 #ifndef OHOS_ACELITE_JSTEST_MODULE_H 16 #define OHOS_ACELITE_JSTEST_MODULE_H 17 18 #include "acelite_config.h" 19 #include "non_copyable.h" 20 #if ((JSFWK_TEST == 1) && (OHOS_ACELITE_PRODUCT_WATCH == 1)) 21 #include "presets/preset_module.h" 22 namespace OHOS { 23 namespace ACELite { 24 class JSTestModule final : public PresetModule { 25 public: 26 /** 27 * @fn JSTestModule::JSTestModule() 28 * 29 * @brief Constructor. 30 */ JSTestModule()31 JSTestModule() : PresetModule(nullptr) {} 32 33 /** 34 * @fn JSTestModule::~JSTestModule() 35 * 36 * @brief Constructor. 37 */ 38 ~JSTestModule() = default; 39 40 void Init() override; 41 42 private: 43 static jerry_value_t JSTestPrint(const jerry_value_t func, 44 const jerry_value_t context, 45 const jerry_value_t *args, 46 const jerry_length_t argsNum); 47 }; 48 } // namespace ACELite 49 } // namespace OHOS 50 #endif 51 namespace OHOS { 52 namespace ACELite { 53 class JsTestModule final { 54 public: 55 ACE_DISALLOW_COPY_AND_MOVE(JsTestModule); 56 JsTestModule() = default; 57 ~JsTestModule() = default; Load()58 static void Load() 59 { 60 #if ((JSFWK_TEST == 1) && (OHOS_ACELITE_PRODUCT_WATCH == 1)) 61 JSTestModule jsTestModule; 62 jsTestModule.Init(); 63 #endif 64 } 65 }; 66 } // namespace ACELite 67 } // namespace OHOS 68 #endif // OHOS_ACELITE_JSTEST_MODULE_H 69