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 PANDA_TOOLING_INSPECTOR_TEST_TEST_METHOD_H 17 #define PANDA_TOOLING_INSPECTOR_TEST_TEST_METHOD_H 18 19 #include <functional> 20 21 namespace panda { 22 class Method; 23 } // namespace panda 24 25 namespace panda::tooling::inspector::test { 26 class Client; 27 class InstructionPointer; 28 class TestDebugger; 29 30 class TestMethod { 31 public: TestMethod(TestDebugger & debugger,Client & client)32 TestMethod(TestDebugger &debugger, Client &client) : debugger_(debugger), client_(client) {} 33 Get()34 Method *Get() const 35 { 36 return method_; 37 } 38 Set(Method * method)39 void Set(Method *method) 40 { 41 method_ = method; 42 } 43 44 void Call(const std::function<void(InstructionPointer &)> &body = [](auto & /* ip */) {}); 45 46 private: 47 TestDebugger &debugger_; 48 Client &client_; 49 Method *method_ {nullptr}; 50 }; 51 } // namespace panda::tooling::inspector::test 52 53 #endif // PANDA_TOOLING_INSPECTOR_TEST_TEST_METHOD_H 54