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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 1113283002: cc: Send BeginFrame to VideoFrameController when added if we're inside a frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests. Created 5 years, 8 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
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 073d5ae1a08814c6621a8e232da88117f927d3a4..50707eabf5462d2de146379577e44d16ee84332c 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -7886,5 +7886,47 @@ TEST_F(LayerTreeHostImplTest, DoNotRemoveEmptyRootRenderPass) {
EXPECT_EQ(0u, pass1->quad_list.size());
}
+class FakeVideoFrameController : public VideoFrameController {
+ public:
+ void OnBeginFrame(const BeginFrameArgs& args) override {
+ begin_frame_args_ = args;
+ }
+
+ const BeginFrameArgs& begin_frame_args() { return begin_frame_args_; }
+
+ private:
+ BeginFrameArgs begin_frame_args_;
+};
+
+TEST_F(LayerTreeHostImplTest, AddVideoFrameControllerInsideFrame) {
+ BeginFrameArgs begin_frame_args =
+ CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE);
+ FakeVideoFrameController controller;
+
+ host_impl_->WillBeginImplFrame(begin_frame_args);
+ EXPECT_FALSE(controller.begin_frame_args().IsValid());
+ host_impl_->AddVideoFrameController(&controller);
+ EXPECT_TRUE(controller.begin_frame_args().IsValid());
+ host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
+}
+
+TEST_F(LayerTreeHostImplTest, AddVideoFrameControllerOutsideFrame) {
+ BeginFrameArgs begin_frame_args =
+ CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE);
+ FakeVideoFrameController controller;
+
+ host_impl_->WillBeginImplFrame(begin_frame_args);
+ host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
+
+ EXPECT_FALSE(controller.begin_frame_args().IsValid());
+ host_impl_->AddVideoFrameController(&controller);
+ EXPECT_FALSE(controller.begin_frame_args().IsValid());
+
+ begin_frame_args = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE);
+ EXPECT_FALSE(controller.begin_frame_args().IsValid());
+ host_impl_->WillBeginImplFrame(begin_frame_args);
+ EXPECT_TRUE(controller.begin_frame_args().IsValid());
+}
+
} // namespace
} // namespace cc
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698