From 4f10f3069fff9090d700d9bcfbf49da1aa85f272 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Wed, 13 Mar 2024 01:06:50 -0700 Subject: [PATCH] Update test to validate Debugger domain persistence (#43446) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43446 ## Context We are migrating to the new Hermes `CDPAgent` and `CDPDebugAPI` APIs in the modern CDP server (previously `HermesCDPHandler`). ## This diff Following D54712525, add a test case that validates `"Debugger.enable"` is persisted between reloads. This has been actioned by creating a further test group, `ModernHermesVariants`, and scoping the existing `ResolveBreakpointAfterReload` to this, with the removed second `"Debugger.enable"` message. Changelog: [Internal] Reviewed By: motiz88 Differential Revision: D54808212 fbshipit-source-id: 0775beb85a0907cca4dccbc77ec461d9515ab078 --- .../tests/JsiIntegrationTest.cpp | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp b/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp index 6aea1c35a0b..e9ccbe96c7c 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp @@ -179,6 +179,8 @@ using AllHermesVariants = Types< JsiIntegrationTestHermesEngineAdapter, JsiIntegrationTestHermesWithCDPAgentEngineAdapter>; +using ModernHermesVariants = + Types; using LegacyHermesVariants = Types; TYPED_TEST_SUITE(JsiIntegrationPortableTest, AllEngines); @@ -192,7 +194,12 @@ using JsiIntegrationHermesLegacyTest = JsiIntegrationPortableTest; TYPED_TEST_SUITE(JsiIntegrationHermesLegacyTest, LegacyHermesVariants); -#pragma region JsiIntegrationPortableTest +template +using JsiIntegrationHermesModernTest = + JsiIntegrationPortableTest; +TYPED_TEST_SUITE(JsiIntegrationHermesModernTest, ModernHermesVariants); + +#pragma region AllEngines TYPED_TEST(JsiIntegrationPortableTest, ConnectWithoutCrashing) { this->connect(); @@ -472,8 +479,8 @@ TYPED_TEST(JsiIntegrationPortableTest, ExceptionDuringAddBindingIsIgnored) { EXPECT_TRUE(this->eval("globalThis.foo === 42").getBool()); } -#pragma endregion -#pragma region JsiIntegrationHermesTest +#pragma endregion // AllEngines +#pragma region AllHermesVariants TYPED_TEST(JsiIntegrationHermesTest, EvaluateExpression) { this->connect(); @@ -559,7 +566,10 @@ TYPED_TEST(JsiIntegrationHermesTest, EvaluateExpressionInExecutionContext) { std::to_string(executionContextId))); } -TYPED_TEST(JsiIntegrationHermesTest, ResolveBreakpointAfterReload) { +#pragma endregion // AllHermesVariants +#pragma region ModernHermesVariants + +TYPED_TEST(JsiIntegrationHermesModernTest, ResolveBreakpointAfterReload) { this->connect(); InSequence s; @@ -610,6 +620,6 @@ TYPED_TEST(JsiIntegrationHermesTest, ResolveBreakpointAfterReload) { scriptInfo->value()["params"]["scriptId"]); } -#pragma endregion +#pragma endregion // ModernHermesVariants } // namespace facebook::react::jsinspector_modern