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 #include "ecmascript/js_array.h"
17 #include "ecmascript/js_tagged_value-inl.h"
18 #include "ecmascript/object_factory.h"
19 #include "ecmascript/tests/test_helper.h"
20 #include "ecmascript/tooling/base/pt_params.h"
21 #include "ecmascript/tooling/base/pt_returns.h"
22 #include "ecmascript/tooling/debugger_service.h"
23 #include "ecmascript/tooling/dispatcher.h"
24 #include "ecmascript/tooling/backend/js_debugger.h"
25
26 using namespace panda::ecmascript;
27 using namespace panda::ecmascript::tooling;
28
29 namespace panda::test {
30 class DebuggerCommandsTest : public testing::Test {
31 public:
SetUpTestCase()32 static void SetUpTestCase()
33 {
34 GTEST_LOG_(INFO) << "SetUpTestCase";
35 Logger::InitializeStdLogging(Logger::Level::FATAL, LoggerComponentMaskAll);
36 }
37
TearDownTestCase()38 static void TearDownTestCase()
39 {
40 Logger::InitializeStdLogging(Logger::Level::ERROR, LoggerComponentMaskAll);
41 GTEST_LOG_(INFO) << "TearDownCase";
42 }
43
SetUp()44 void SetUp() override
45 {
46 TestHelper::CreateEcmaVMWithScope(instance, thread, scope);
47 ecmaVm = EcmaVM::Cast(instance);
48 // Main logic is JSON parser, so not need trigger GC to decrease execute time
49 ecmaVm->SetEnableForceGC(false);
50 }
51
TearDown()52 void TearDown() override
53 {
54 TestHelper::DestroyEcmaVMWithScope(ecmaVm, scope);
55 }
56
57 protected:
58 EcmaVM *ecmaVm {nullptr};
59 PandaVM *instance {nullptr};
60 EcmaHandleScope *scope {nullptr};
61 JSThread *thread {nullptr};
62 };
63
HWTEST_F_L0(DebuggerCommandsTest,CreateDebuggerTest)64 HWTEST_F_L0(DebuggerCommandsTest, CreateDebuggerTest)
65 {
66 std::unique_ptr<JSDebugger> debugger = std::make_unique<JSDebugger>(ecmaVm);
67 ASSERT_NE(debugger, nullptr);
68 }
69 } // namespace panda::test