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 ab1224ef1f9a28ba9193145db3f7db77a852633a..6b3339c768923ca6633dbacf3afb29bfa16b46b3 100644 |
--- a/cc/trees/layer_tree_host_unittest.cc |
+++ b/cc/trees/layer_tree_host_unittest.cc |
@@ -2147,6 +2147,7 @@ TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) { |
NULL, |
settings, |
base::MessageLoopProxy::current(), |
+ nullptr, |
nullptr); |
client.SetLayerTreeHost(host.get()); |
host->Composite(base::TimeTicks::Now()); |
@@ -2170,6 +2171,7 @@ TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { |
NULL, |
settings, |
base::MessageLoopProxy::current(), |
+ nullptr, |
nullptr); |
client.SetLayerTreeHost(host.get()); |
host->Composite(base::TimeTicks::Now()); |
@@ -2193,6 +2195,7 @@ TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { |
NULL, |
settings, |
base::MessageLoopProxy::current(), |
+ nullptr, |
nullptr); |
client.SetLayerTreeHost(host.get()); |
host->Composite(base::TimeTicks::Now()); |
@@ -2217,6 +2220,7 @@ TEST(LayerTreeHostTest, |
NULL, |
settings, |
base::MessageLoopProxy::current(), |
+ nullptr, |
nullptr); |
client.SetLayerTreeHost(host.get()); |
host->Composite(base::TimeTicks::Now()); |
@@ -5289,10 +5293,22 @@ class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest { |
MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
+class TestBeginFrameObserver : public BeginFrameObserverMixIn { |
+ public: |
+ TestBeginFrameObserver() {} |
+ ~TestBeginFrameObserver() override {} |
+ |
+ protected: |
+ bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override { |
+ return true; |
+ } |
+}; |
+ |
class LayerTreeHostTestSendBeginFramesToChildren : public LayerTreeHostTest { |
public: |
LayerTreeHostTestSendBeginFramesToChildren() |
: begin_frame_sent_to_children_(false) { |
+ begin_frame_observer_.reset(new TestBeginFrameObserver); |
} |
void InitializeSettings(LayerTreeSettings* settings) override { |
@@ -5310,18 +5326,20 @@ class LayerTreeHostTestSendBeginFramesToChildren : public LayerTreeHostTest { |
} |
void DidBeginMainFrame() override { |
- // Children requested BeginFrames. |
- layer_tree_host()->SetChildrenNeedBeginFrames(true); |
+ // Add observer will trigger BeginFrame. |
+ proxy_begin_frame_source()->AddObserver(begin_frame_observer_.get()); |
} |
void AfterTest() override { |
// Ensure that BeginFrame message is sent to children during parent |
// scheduler handles its BeginFrame. |
EXPECT_TRUE(begin_frame_sent_to_children_); |
+ proxy_begin_frame_source()->RemoveObserver(begin_frame_observer_.get()); |
} |
private: |
bool begin_frame_sent_to_children_; |
+ scoped_ptr<TestBeginFrameObserver> begin_frame_observer_; |
}; |
SINGLE_THREAD_TEST_F(LayerTreeHostTestSendBeginFramesToChildren); |
@@ -5331,6 +5349,7 @@ class LayerTreeHostTestSendBeginFramesToChildrenWithExternalBFS |
public: |
LayerTreeHostTestSendBeginFramesToChildrenWithExternalBFS() |
: begin_frame_sent_to_children_(false) { |
+ begin_frame_observer_.reset(new TestBeginFrameObserver); |
} |
void InitializeSettings(LayerTreeSettings* settings) override { |
@@ -5349,18 +5368,20 @@ class LayerTreeHostTestSendBeginFramesToChildrenWithExternalBFS |
} |
void DidBeginMainFrame() override { |
- // Children requested BeginFrames. |
- layer_tree_host()->SetChildrenNeedBeginFrames(true); |
+ // Add observer will trigger BeginFrame. |
+ proxy_begin_frame_source()->AddObserver(begin_frame_observer_.get()); |
} |
void AfterTest() override { |
// Ensure that BeginFrame message is sent to children during parent |
// scheduler handles its BeginFrame. |
EXPECT_TRUE(begin_frame_sent_to_children_); |
+ proxy_begin_frame_source()->RemoveObserver(begin_frame_observer_.get()); |
} |
private: |
bool begin_frame_sent_to_children_; |
+ scoped_ptr<TestBeginFrameObserver> begin_frame_observer_; |
}; |
SINGLE_THREAD_TEST_F(LayerTreeHostTestSendBeginFramesToChildrenWithExternalBFS); |