File tree Expand file tree Collapse file tree 5 files changed +8
-10
lines changed
callinvoker/ReactCommon/tests
ReactCxxPlatform/react/io/tests
rn-tester/NativeCxxModuleExample/tests Expand file tree Collapse file tree 5 files changed +8
-10
lines changed Original file line number Diff line number Diff line change 10
10
#include < ReactCommon/CallInvoker.h>
11
11
#include < jsi/jsi.h>
12
12
#include < list>
13
- #include < memory>
14
13
15
14
namespace facebook ::react {
16
15
17
16
class TestCallInvoker : public CallInvoker {
18
17
public:
19
- explicit TestCallInvoker (std::shared_ptr< facebook::jsi::Runtime> runtime)
18
+ explicit TestCallInvoker (facebook::jsi::Runtime& runtime)
20
19
: runtime_(runtime) {}
21
20
22
21
void invokeAsync (CallFunc&& func) noexcept override {
23
22
queue_.push_back (std::move (func));
24
23
}
25
24
26
25
void invokeSync (CallFunc&& func) override {
27
- func (* runtime_);
26
+ func (runtime_);
28
27
}
29
28
30
29
void flushQueue () {
31
30
while (!queue_.empty ()) {
32
- queue_.front ()(* runtime_);
31
+ queue_.front ()(runtime_);
33
32
queue_.pop_front ();
34
- runtime_-> drainMicrotasks (); // Run microtasks every cycle.
33
+ runtime_. drainMicrotasks (); // Run microtasks every cycle.
35
34
}
36
35
}
37
36
@@ -40,8 +39,8 @@ class TestCallInvoker : public CallInvoker {
40
39
}
41
40
42
41
private:
42
+ facebook::jsi::Runtime& runtime_;
43
43
std::list<CallFunc> queue_{};
44
- std::shared_ptr<facebook::jsi::Runtime> runtime_{};
45
44
};
46
45
47
46
} // namespace facebook::react
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ class BridgingTest : public ::testing::Test {
31
31
.withMicrotaskQueue(true )
32
32
.build())),
33
33
rt(*runtime),
34
- invoker(std::make_shared<TestCallInvoker>(runtime)) {}
34
+ invoker(std::make_shared<TestCallInvoker>(* runtime)) {}
35
35
36
36
~BridgingTest () override {
37
37
LongLivedObjectCollection::get (rt).clear ();
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ class TurboModuleTestFixture : public ::testing::Test {
27
27
public:
28
28
explicit TurboModuleTestFixture (Args... args)
29
29
: runtime_(hermes::makeHermesRuntime()),
30
- jsInvoker_(std::make_shared<TestCallInvoker>(runtime_)),
30
+ jsInvoker_(std::make_shared<TestCallInvoker>(* runtime_)),
31
31
module_(std::make_shared<T>(jsInvoker_, std::forward<Args>(args)...)) {}
32
32
33
33
void SetUp () override {
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ class NetworkingModuleTests : public testing::Test {
25
25
protected:
26
26
void SetUp () override {
27
27
rt_ = facebook::hermes::makeHermesRuntime ();
28
- jsInvoker_ = std::make_shared<TestCallInvoker>(rt_);
28
+ jsInvoker_ = std::make_shared<TestCallInvoker>(* rt_);
29
29
}
30
30
31
31
static void verifyFormData (
Original file line number Diff line number Diff line change 6
6
*/
7
7
8
8
#include < NativeCxxModuleExample/NativeCxxModuleExample.h>
9
- #include < ReactCommon/TestCallInvoker.h>
10
9
#include < ReactCommon/TurboModuleTestFixture.h>
11
10
#include < gtest/gtest.h>
12
11
#include < list>
You can’t perform that action at this time.
0 commit comments