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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 12674030: cc: Hook vsync time source to output surface (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Review tweaks. Created 7 years, 9 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/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 90041681bb0a6a3c122ed82b26cc8130e7c1a5b4..d890f818aff5a37050825f5d19b0efef41293139 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -2349,5 +2349,56 @@ private:
SINGLE_THREAD_TEST_F(LayerTreeHostTestLCDNotification)
+// Verify that the vsync notification is used to initiate rendering.
+class LayerTreeHostTestVSyncNotification : public LayerTreeHostTest {
+ public:
+ virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ settings->render_vsync_notification_enabled = true;
+ }
+
+ virtual void BeginTest() OVERRIDE {
+ PostSetNeedsCommitToMainThread();
+ }
+
+ virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ FakeOutputSurface* fake_output_surface =
+ reinterpret_cast<FakeOutputSurface*>(host_impl->output_surface());
+
+ // The vsync notification is turned off now but will get enabled once we
+ // return, so post a task to trigger it.
+ ASSERT_FALSE(fake_output_surface->vsync_notification_enabled());
+ PostVSyncOnImplThread(fake_output_surface);
+ }
+
+ void PostVSyncOnImplThread(FakeOutputSurface* fake_output_surface) {
+ DCHECK(ImplThread());
+ ImplThread()->PostTask(
+ base::Bind(&LayerTreeHostTestVSyncNotification::DidVSync,
+ base::Unretained(this),
+ base::Unretained(fake_output_surface)));
+ }
+
+ void DidVSync(FakeOutputSurface* fake_output_surface) {
+ ASSERT_TRUE(fake_output_surface->vsync_notification_enabled());
+ fake_output_surface->DidVSync(frame_time_);
+ }
+
+ virtual bool PrepareToDrawOnThread(
+ LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame,
+ bool result) OVERRIDE {
+ EndTest();
+ return true;
+ }
+
+ virtual void AfterTest() OVERRIDE {
+ }
+
+ private:
+ base::TimeTicks frame_time_;
+};
+
+MULTI_THREAD_TEST_F(LayerTreeHostTestVSyncNotification);
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698