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

Unified Diff: cc/resources/resource_provider_unittest.cc

Issue 210413003: Drop software resources sent to a GL delegated renderer. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_provider_unittest.cc
diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc
index cca0c5b9241ca1bc2c07295671d9bae46ac2a96c..b82dd5fe38e097c87f9a5cf752d2ee5d4bd596b5 100644
--- a/cc/resources/resource_provider_unittest.cc
+++ b/cc/resources/resource_provider_unittest.cc
@@ -1167,6 +1167,65 @@ TEST_P(ResourceProviderTest, TransferGLToSoftware) {
EXPECT_FALSE(returned_to_child[0].lost);
}
+TEST_P(ResourceProviderTest, TransferSoftwareToGL) {
+ if (GetParam() != ResourceProvider::GLTexture)
+ return;
+
+ scoped_ptr<ResourceProviderContext> child_context_owned(
+ ResourceProviderContext::Create(shared_data_.get()));
+
+ FakeOutputSurfaceClient child_output_surface_client;
+ scoped_ptr<FakeOutputSurface> child_output_surface =
+ FakeOutputSurface::CreateSoftware(
+ make_scoped_ptr(new SoftwareOutputDevice));
+ FakeOutputSurfaceClient parent_output_surface_client;
+ CHECK(child_output_surface->BindToClient(&child_output_surface_client));
+
+ scoped_ptr<ResourceProvider> child_resource_provider(ResourceProvider::Create(
+ child_output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1));
+
+ gfx::Size size(1, 1);
+ ResourceFormat format = RGBA_8888;
+ size_t pixel_size = TextureSizeBytes(size, format);
+ ASSERT_EQ(4U, pixel_size);
+
+ ResourceProvider::ResourceId id1 = child_resource_provider->CreateResource(
+ size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ uint8_t data1[4] = {1, 2, 3, 4};
+ gfx::Rect rect(size);
+ child_resource_provider->SetPixels(id1, data1, rect, rect, gfx::Vector2d());
+
+ ReturnedResourceArray returned_to_child;
+ int child_id =
+ resource_provider_->CreateChild(GetReturnCallback(&returned_to_child));
+ {
+ ResourceProvider::ResourceIdArray resource_ids_to_transfer;
+ resource_ids_to_transfer.push_back(id1);
+ TransferableResourceArray list;
+ child_resource_provider->PrepareSendToParent(resource_ids_to_transfer,
+ &list);
+ ASSERT_EQ(1u, list.size());
+ EXPECT_EQ(0u, list[0].mailbox_holder.sync_point);
+ EXPECT_EQ(0u, list[0].mailbox_holder.texture_target);
+ EXPECT_TRUE(child_resource_provider->InUseByConsumer(id1));
+ resource_provider_->ReceiveFromChild(child_id, list);
+ }
+
+ EXPECT_EQ(0u, resource_provider_->num_resources());
danakj 2014/03/25 21:12:47 Can you throw a comment in at each step in the tes
+ ASSERT_EQ(1u, returned_to_child.size());
+ EXPECT_EQ(returned_to_child[0].id, id1);
+ ResourceProvider::ResourceIdMap resource_map =
+ resource_provider_->GetChildToParentMap(child_id);
+ ResourceProvider::ResourceId mapped_id1 = resource_map[id1];
+ EXPECT_EQ(0u, mapped_id1);
+
+ resource_provider_->DestroyChild(child_id);
+ EXPECT_EQ(0u, resource_provider_->num_resources());
+
+ ASSERT_EQ(1u, returned_to_child.size());
+ EXPECT_FALSE(returned_to_child[0].lost);
+}
+
TEST_P(ResourceProviderTest, TransferInvalidSoftware) {
if (GetParam() != ResourceProvider::Bitmap)
return;
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698