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

Method waitForValue

valdi/test/integration/JSIntegrationTests.cpp:885–896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

883public:
884 TestSemaphore(T initialValue) : _lastValue(std::move(initialValue)) {}
885 void waitForValue(T expectedValue) {
886 // Flush the queue first before trying to compare the values
887 while (_taskQueue.runNextTask()) {
888 }
889
890 while (_lastValue != expectedValue) {
891 auto success = _taskQueue.runNextTask(std::chrono::steady_clock::now() + std::chrono::seconds(5));
892 if (!success) {
893 throw Exception(STRING_FORMAT("Failed to wait until value becomes {}", expectedValue));
894 }
895 }
896 }
897
898 void setValue(T value) {
899 _taskQueue.enqueue([this, value]() {

Callers 2

setJsQueuePausedFunction · 0.80
TEST_PFunction · 0.80

Calls 3

nowFunction · 0.50
ExceptionClass · 0.50
runNextTaskMethod · 0.45

Tested by

no test coverage detected