122 const uintptr_t kWarmUpBaton = 0xFFFFFFFF;
125 CFTimeInterval timestamp;
126 CFTimeInterval targetTimestamp;
129 __block std::vector<Entry> entries;
132 initWithDisplayLink:displayLink
133 block:^(CFTimeInterval timestamp, CFTimeInterval targetTimestamp,
135 entries.push_back({timestamp, targetTimestamp, baton});
136 if (baton == kWarmUpBaton) {
140 CFRunLoopStop(CFRunLoopGetCurrent());
143 __block CFTimeInterval expectedStartUntil;
147 [waiter waitForVSync:kWarmUpBaton];
148 [[NSRunLoop currentRunLoop] performBlock:^{
149 expectedStartUntil = CACurrentMediaTime();
153 CFTimeInterval now = CACurrentMediaTime();
157 EXPECT_EQ(displayLink.
paused, YES);
159 [waiter waitForVSync:1];
162 [waiter waitForVSync:2];
167 [waiter waitForVSync:3];
172 EXPECT_FALSE(displayLink.
paused);
177 CFTimeInterval start = CACurrentMediaTime();
178 while (!displayLink.
paused) {
180 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.02, NO);
181 if (CACurrentMediaTime() - start > 1.0) {
185 ASSERT_TRUE(displayLink.
paused);
187 EXPECT_EQ(entries.size(),
size_t(4));
190 EXPECT_TRUE(entries[0].timestamp <= expectedStartUntil);
191 EXPECT_TRUE(entries[0].targetTimestamp <= expectedStartUntil);
192 EXPECT_EQ(entries[0].baton, kWarmUpBaton);
196 EXPECT_EQ(entries[1].baton,
size_t(1));
199 EXPECT_EQ(entries[2].baton,
size_t(2));
202 EXPECT_EQ(entries[3].baton,
size_t(3));