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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 845393002: cc: Create ProxyBeginFrameSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 11 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
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);

Powered by Google App Engine
This is Rietveld 408576698