MCPcopy Create free account
hub / github.com/Snapchat/Valdi / TEST

Method TEST

valdi/test/integration/Runtime_tests.cpp:7829–7851  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7827 auto messageHandler = makeShared<MockRuntimeMessageHandler>();
7828 wrapper.runtime->setRuntimeMessageHandler(messageHandler);
7829 wrapper.runtime->registerNativeModuleFactory(makeShared<NativeModuleReferenceTest>().toShared());
7830
7831 auto tree = wrapper.runtime->createViewNodeTreeAndContext(
7832 wrapper.standaloneRuntime->getViewManagerContext(),
7833 STRING_LITERAL("NativeModuleReference@test/src/NativeModuleReference"));
7834
7835 wrapper.waitUntilAllUpdatesCompleted();
7836
7837 auto callCallback1 = getJsModulePropertyAsUntypedFunction(
7838 wrapper.runtime, nullptr, "test/src/NativeModuleReference", "callCallback1");
7839 ASSERT_TRUE(callCallback1) << callCallback1.description();
7840
7841 auto callCallback2 = getJsModulePropertyAsUntypedFunction(
7842 wrapper.runtime, nullptr, "test/src/NativeModuleReference", "callCallback2");
7843 ASSERT_TRUE(callCallback2) << callCallback2.description();
7844
7845 Value retValue;
7846
7847 retValue = callCallback1.value()->call(ValueFunctionFlagsCallSync, {}).value();
7848
7849 ASSERT_EQ(Value(42.0), retValue);
7850
7851 retValue = callCallback2.value()->call(ValueFunctionFlagsCallSync, {}).value();
7852 ASSERT_EQ(Value(42.0), retValue);
7853
7854 // We now destroy our context, which should make callback2 unusable

Callers

nothing calls this directly

Calls 10

onIdleMethod · 0.80
beginBatchMethod · 0.80
endBatchMethod · 0.80
createFunction · 0.50
runNextTaskMethod · 0.45
dispatchMethod · 0.45
syncMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected