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

Unified Diff: cc/surfaces/surface_aggregator_unittest.cc

Issue 732423002: Update from chromium https://crrev.com/304586 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/surfaces/surface_aggregator.cc ('k') | cc/test/fake_layer_tree_host_impl_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_aggregator_unittest.cc
diff --git a/cc/surfaces/surface_aggregator_unittest.cc b/cc/surfaces/surface_aggregator_unittest.cc
index 4771c823b291db5b3981c8c62de2cbfd2576d31c..521332725de51b9a33dd366540cd135a507316c3 100644
--- a/cc/surfaces/surface_aggregator_unittest.cc
+++ b/cc/surfaces/surface_aggregator_unittest.cc
@@ -1242,6 +1242,41 @@ TEST_F(SurfaceAggregatorWithResourcesTest, TakeResourcesOneSurface) {
factory.Destroy(surface_id);
}
+TEST_F(SurfaceAggregatorWithResourcesTest, TwoSurfaces) {
+ ResourceTrackingSurfaceFactoryClient client;
+ SurfaceFactory factory(&manager_, &client);
+ SurfaceId surface_id(7u);
+ factory.Create(surface_id, SurfaceSize());
+ SurfaceId surface_id2(8u);
+ factory.Create(surface_id2, SurfaceSize());
+
+ ResourceProvider::ResourceId ids[] = {11, 12, 13};
+ SubmitFrameWithResources(ids, arraysize(ids), &factory, surface_id);
+ ResourceProvider::ResourceId ids2[] = {14, 15, 16};
+ SubmitFrameWithResources(ids2, arraysize(ids2), &factory, surface_id2);
+
+ scoped_ptr<CompositorFrame> frame = aggregator_->Aggregate(surface_id);
+
+ SubmitFrameWithResources(NULL, 0, &factory, surface_id);
+
+ // Nothing should be available to be returned yet.
+ EXPECT_TRUE(client.returned_resources().empty());
+
+ frame = aggregator_->Aggregate(surface_id2);
+
+ // surface_id wasn't referenced, so its resources should be returned.
+ ASSERT_EQ(3u, client.returned_resources().size());
+ ResourceProvider::ResourceId returned_ids[3];
+ for (size_t i = 0; i < 3; ++i) {
+ returned_ids[i] = client.returned_resources()[i].id;
+ }
+ EXPECT_THAT(returned_ids,
+ testing::WhenSorted(testing::ElementsAreArray(ids)));
+ EXPECT_EQ(3u, resource_provider_->num_resources());
+ factory.Destroy(surface_id);
+ factory.Destroy(surface_id2);
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/surfaces/surface_aggregator.cc ('k') | cc/test/fake_layer_tree_host_impl_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698