| Index: cc/layer_tree_host_unittest.cc
|
| diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc
|
| index 63799bf0579bce80023eab9f5d3674762b14a277..4e2f7377ab291c81376cb99c6575b569346df79e 100644
|
| --- a/cc/layer_tree_host_unittest.cc
|
| +++ b/cc/layer_tree_host_unittest.cc
|
| @@ -2104,5 +2104,58 @@ TEST_F(LayerTreeHostTestMaxPendingFrames, GLRenderer)
|
| runTest(true);
|
| }
|
|
|
| +// Verify that the vsync notification is used to initiate rendering.
|
| +class LayerTreeHostTestVSyncNotification : public LayerTreeHostTest {
|
| +public:
|
| + LayerTreeHostTestVSyncNotification()
|
| + {
|
| + m_settings.renderVSyncNotificationEnabled = true;
|
| + }
|
| +
|
| + virtual void beginTest() OVERRIDE
|
| + {
|
| + postSetNeedsCommitToMainThread();
|
| + }
|
| +
|
| + virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE
|
| + {
|
| + FakeOutputSurface* fakeOutputSurface =
|
| + reinterpret_cast<FakeOutputSurface*>(impl->outputSurface());
|
| +
|
| + // The vsync notification is turned off now but will get enabled once we
|
| + // return, so post a task to trigger it.
|
| + ASSERT_FALSE(fakeOutputSurface->vsync_notification_enabled());
|
| + postVSyncOnImplThread(fakeOutputSurface);
|
| + }
|
| +
|
| + void postVSyncOnImplThread(FakeOutputSurface* fakeOutputSurface)
|
| + {
|
| + DCHECK(implThread());
|
| + implThread()->postTask(base::Bind(&LayerTreeHostTestVSyncNotification::DidVSync,
|
| + base::Unretained(this), base::Unretained(fakeOutputSurface)));
|
| + }
|
| +
|
| + void DidVSync(FakeOutputSurface* fakeOutputSurface)
|
| + {
|
| + ASSERT_TRUE(fakeOutputSurface->vsync_notification_enabled());
|
| + fakeOutputSurface->DidVSync(m_frameTime);
|
| + }
|
| +
|
| + virtual bool prepareToDrawOnThread(LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result) OVERRIDE
|
| + {
|
| + endTest();
|
| + return true;
|
| + }
|
| +
|
| + virtual void afterTest() OVERRIDE
|
| + {
|
| + }
|
| +
|
| +private:
|
| + base::TimeTicks m_frameTime;
|
| +};
|
| +
|
| +MULTI_THREAD_TEST_F(LayerTreeHostTestVSyncNotification);
|
| +
|
| } // namespace
|
| } // namespace cc
|
|
|