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

Unified Diff: cc/trees/layer_tree_host_unittest_copyrequest.cc

Issue 1493013002: cc: Force commit on the frame after a copy request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move to LayerTreeHost Created 5 years 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_unittest_copyrequest.cc
diff --git a/cc/trees/layer_tree_host_unittest_copyrequest.cc b/cc/trees/layer_tree_host_unittest_copyrequest.cc
index 86c7dc282727ad0502208347df9ebbdab710c9e1..7f31e63b3afd248040925a81e03e9a7e22813007 100644
--- a/cc/trees/layer_tree_host_unittest_copyrequest.cc
+++ b/cc/trees/layer_tree_host_unittest_copyrequest.cc
@@ -175,6 +175,64 @@ TEST_F(LayerTreeHostCopyRequestTestMultipleRequests,
RunTest(true, false);
}
+class LayerTreeHostCopyRequestCompletionCausesCommit
danakj 2015/12/02 23:07:52 can you leave a comment to the bug here too so it'
+ : public LayerTreeHostCopyRequestTest {
+ protected:
+ void SetupTree() override {
+ root_ = FakePictureLayer::Create(layer_settings(), &client_);
+ root_->SetBounds(gfx::Size(20, 20));
+
+ layer_ = FakePictureLayer::Create(layer_settings(), &client_);
+ layer_->SetBounds(gfx::Size(15, 15));
+ root_->AddChild(layer_);
+
+ layer_tree_host()->SetRootLayer(root_);
+ LayerTreeHostCopyRequestTest::SetupTree();
+ client_.set_bounds(root_->bounds());
+ }
+
+ void BeginTest() override {
+ callback_count_ = 0;
+ PostSetNeedsCommitToMainThread();
+ }
+
+ void DidCommit() override {
+ int frame = layer_tree_host()->source_frame_number();
+ switch (frame) {
+ case 1:
+ layer_->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest(
+ base::Bind(&LayerTreeHostCopyRequestCompletionCausesCommit::
+ CopyOutputCallback,
+ base::Unretained(this))));
+ EXPECT_EQ(0, callback_count_);
+ break;
+ case 2:
+ // This commit was triggered by the copy request.
+ break;
+ case 3:
+ // This commit was triggered by the completion of the copy request.
+ EXPECT_EQ(1, callback_count_);
+ EndTest();
+ break;
+ }
+ }
+
+ void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {
+ EXPECT_FALSE(result->IsEmpty());
+ ++callback_count_;
+ }
+
+ void AfterTest() override {}
+
+ int callback_count_;
+ FakeContentLayerClient client_;
+ scoped_refptr<FakePictureLayer> root_;
+ scoped_refptr<FakePictureLayer> layer_;
+};
+
+SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
+ LayerTreeHostCopyRequestCompletionCausesCommit);
+
class LayerTreeHostCopyRequestTestLayerDestroyed
: public LayerTreeHostCopyRequestTest {
protected:
@@ -427,8 +485,13 @@ class LayerTreeHostTestHiddenSurfaceNotAllocatedForSubtreeCopyRequest
// |copy_layer| should have been rendered to a texture since it was needed
// for a copy request.
- EXPECT_TRUE(renderer->HasAllocatedResourcesForTesting(
- copy_layer->render_surface()->GetRenderPassId()));
+ if (did_draw_) {
+ // Ignore the extra frame that occurs due to copy completion.
+ EXPECT_FALSE(copy_layer->render_surface());
+ } else {
+ EXPECT_TRUE(renderer->HasAllocatedResourcesForTesting(
+ copy_layer->render_surface()->GetRenderPassId()));
+ }
did_draw_ = true;
}
« 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