• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 ECMASCRIPT_TOOLING_TEST_UTILS_TEST_CHANNEL_H
17 #define ECMASCRIPT_TOOLING_TEST_UTILS_TEST_CHANNEL_H
18 
19 #include "tooling/protocol_channel.h"
20 
21 namespace panda::ecmascript::tooling {
22 class TestChannel : public ProtocolChannel {
23 public:
24     TestChannel() = default;
25     virtual ~TestChannel() override = default;
26 
WaitForDebugger()27     void WaitForDebugger() override
28     {
29         std::cout << "TestChannel: WaitForDebugger" << std::endl;
30     }
RunIfWaitingForDebugger()31     void RunIfWaitingForDebugger() override
32     {
33         std::cout << "TestChannel: RunIfWaitingForDebugger" << std::endl;
34     }
SendResponse(const DispatchRequest & request,const DispatchResponse & response,const PtBaseReturns & result)35     void SendResponse([[maybe_unused]] const DispatchRequest &request,
36                       [[maybe_unused]] const DispatchResponse &response,
37                       const PtBaseReturns &result) override
38     {
39         std::string str = result.ToJson()->Stringify();
40         std::cout << "TestChannel: SendResponse:\n" << str << std::endl;
41     }
SendNotification(const PtBaseEvents & events)42     void SendNotification(const PtBaseEvents &events) override
43     {
44         std::string str = events.ToJson()->Stringify();
45         std::cout << "TestChannel: SendNotification:\n" << str << std::endl;
46     }
47 
48 private:
49     NO_COPY_SEMANTIC(TestChannel);
50     NO_MOVE_SEMANTIC(TestChannel);
51 };
52 }  // namespace panda::ecmascript::tooling
53 
54 #endif  // ECMASCRIPT_TOOLING_TEST_UTILS_TEST_CHANNEL_H