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