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

Unified Diff: cc/resource_provider_unittest.cc

Issue 12321053: cc: Complete pending tile uploads if they are needed for tree activation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased after managed_tile_state refactoring. Created 7 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/resource_provider.cc ('k') | cc/tile_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resource_provider_unittest.cc
diff --git a/cc/resource_provider_unittest.cc b/cc/resource_provider_unittest.cc
index a0dac057fc7ef46e89d3ab12707c51f75e4d74c5..9f4b4e448464cb902dbeb1e079a4b58c7e200abc 100644
--- a/cc/resource_provider_unittest.cc
+++ b/cc/resource_provider_unittest.cc
@@ -879,6 +879,7 @@ public:
MOCK_METHOD9(asyncTexSubImage2DCHROMIUM, void(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset,
WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format,
WGC3Denum type, const void* pixels));
+ MOCK_METHOD1(waitAsyncTexImage2DCHROMIUM, void(WGC3Denum target));
};
TEST_P(ResourceProviderTest, TextureAllocation)
@@ -948,6 +949,68 @@ TEST_P(ResourceProviderTest, TextureAllocation)
Mock::VerifyAndClearExpectations(context);
}
+TEST_P(ResourceProviderTest, ForcingAsyncUploadToComplete)
+{
+ // Only for GL textures.
+ if (GetParam() != ResourceProvider::GLTexture)
+ return;
+ scoped_ptr<WebKit::WebGraphicsContext3D> mock_context(
+ static_cast<WebKit::WebGraphicsContext3D*>(new NiceMock<AllocationTrackingContext3D>));
+ scoped_ptr<OutputSurface> outputSurface(FakeOutputSurface::Create3d(mock_context.Pass()));
+
+ gfx::Size size(2, 2);
+ WGC3Denum format = GL_RGBA;
+ ResourceProvider::ResourceId id = 0;
+ int textureId = 123;
+
+ AllocationTrackingContext3D* context = static_cast<AllocationTrackingContext3D*>(outputSurface->context3d());
+ scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::Create(outputSurface.get()));
+
+ EXPECT_CALL(*context, createTexture()).WillOnce(Return(textureId));
+ EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, textureId)).Times(3);
+ EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_,_,_,2,2,_,_,_,_)).Times(1);
+ EXPECT_CALL(*context, waitAsyncTexImage2DCHROMIUM(GL_TEXTURE_2D)).Times(1);
+ EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, 0)).Times(1);
+ id = resourceProvider->CreateResource(size, format, ResourceProvider::TextureUsageAny);
+ resourceProvider->AcquirePixelBuffer(id);
+ resourceProvider->BeginSetPixels(id);
+ resourceProvider->ForceSetPixelsToComplete(id);
+ resourceProvider->ReleasePixelBuffer(id);
+ Mock::VerifyAndClearExpectations(context);
+}
+
+TEST_P(ResourceProviderTest, AbortForcedAsyncUpload)
+{
+ // Only for GL textures.
+ if (GetParam() != ResourceProvider::GLTexture)
+ return;
+ scoped_ptr<WebKit::WebGraphicsContext3D> mock_context(
+ static_cast<WebKit::WebGraphicsContext3D*>(new NiceMock<AllocationTrackingContext3D>));
+ scoped_ptr<OutputSurface> outputSurface(FakeOutputSurface::Create3d(mock_context.Pass()));
+
+ gfx::Size size(2, 2);
+ WGC3Denum format = GL_RGBA;
+ ResourceProvider::ResourceId id = 0;
+ int textureId = 123;
+
+ AllocationTrackingContext3D* context = static_cast<AllocationTrackingContext3D*>(outputSurface->context3d());
+ scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::Create(outputSurface.get()));
+
+ EXPECT_CALL(*context, createTexture()).WillRepeatedly(Return(textureId));
+ EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, textureId)).Times(4);
+ EXPECT_CALL(*context, asyncTexImage2DCHROMIUM(_,_,_,2,2,_,_,_,_)).Times(1);
+ EXPECT_CALL(*context, waitAsyncTexImage2DCHROMIUM(GL_TEXTURE_2D)).Times(1);
+ EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, 0)).Times(1);
+ EXPECT_CALL(*context, deleteTexture(_)).Times(1);
+ id = resourceProvider->CreateResource(size, format, ResourceProvider::TextureUsageAny);
+ resourceProvider->AcquirePixelBuffer(id);
+ resourceProvider->BeginSetPixels(id);
+ resourceProvider->ForceSetPixelsToComplete(id);
+ resourceProvider->AbortSetPixels(id);
+ resourceProvider->ReleasePixelBuffer(id);
+ Mock::VerifyAndClearExpectations(context);
+}
+
INSTANTIATE_TEST_CASE_P(ResourceProviderTests,
ResourceProviderTest,
::testing::Values(ResourceProvider::GLTexture,
« no previous file with comments | « cc/resource_provider.cc ('k') | cc/tile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698