Remove dependency to PerformanceEntryReporter singleton from RuntimeSchedulerTest (#46760)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46760

Changelog: [internal]

Relying on the singleton was causing issues in iOS tests for RuntimeScheduler. This fixes those issues.

Reviewed By: rshest

Differential Revision: D63702251

fbshipit-source-id: 42b98e673ffba6f45b52510cdb3eea410e55b894
This commit is contained in:
Rubén Norte 2024-10-02 03:13:24 -07:00 committed by Facebook GitHub Bot
parent 0fb3c24a82
commit b62ae0d02b

View File

@ -82,17 +82,17 @@ class RuntimeSchedulerTest : public testing::TestWithParam<bool> {
return stubClock_->getNow();
};
performanceEntryReporter_ = PerformanceEntryReporter::getInstance().get();
performanceEntryReporter_ = std::make_unique<PerformanceEntryReporter>();
runtimeScheduler_ =
std::make_unique<RuntimeScheduler>(runtimeExecutor, stubNow);
runtimeScheduler_->setPerformanceEntryReporter(performanceEntryReporter_);
runtimeScheduler_->setPerformanceEntryReporter(
performanceEntryReporter_.get());
}
void TearDown() override {
ReactNativeFeatureFlags::dangerouslyReset();
performanceEntryReporter_->clearEntries();
}
jsi::Function createHostFunctionFromLambda(
@ -119,7 +119,7 @@ class RuntimeSchedulerTest : public testing::TestWithParam<bool> {
std::unique_ptr<StubQueue> stubQueue_;
std::unique_ptr<RuntimeScheduler> runtimeScheduler_;
std::shared_ptr<StubErrorUtils> stubErrorUtils_;
PerformanceEntryReporter* performanceEntryReporter_{};
std::unique_ptr<PerformanceEntryReporter> performanceEntryReporter_{};
};
TEST_P(RuntimeSchedulerTest, now) {