Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Unified Diff: cc/layer_tree_host_unittest.cc

Issue 11833009: Provide a vsync notification to the renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layer_tree_host_impl_unittest.cc ('k') | cc/output_surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « cc/layer_tree_host_impl_unittest.cc ('k') | cc/output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698