Index: cc/resources/resource_provider_unittest.cc |
diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc |
index dec66d645e9712392b5670a4ce99d8cfcf264568..16745aaf45776f980508731f10b64d649c3478cc 100644 |
--- a/cc/resources/resource_provider_unittest.cc |
+++ b/cc/resources/resource_provider_unittest.cc |
@@ -1197,6 +1197,56 @@ TEST_P(ResourceProviderTest, ManagedResource) { |
Mock::VerifyAndClearExpectations(context); |
} |
+TEST_P(ResourceProviderTest, TextureWrapMode) { |
+ // Sampling is only supported for GL textures. |
+ if (GetParam() != ResourceProvider::GLTexture) |
+ return; |
+ |
+ scoped_ptr<TextureStateTrackingContext> context_owned( |
+ new TextureStateTrackingContext); |
+ TextureStateTrackingContext* context = context_owned.get(); |
+ |
+ FakeOutputSurfaceClient output_surface_client; |
+ scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
+ context_owned.PassAs<TestWebGraphicsContext3D>())); |
+ CHECK(output_surface->BindToClient(&output_surface_client)); |
+ |
+ scoped_ptr<ResourceProvider> resource_provider( |
+ ResourceProvider::Create(output_surface.get(), 0)); |
+ |
+ gfx::Size size(1, 1); |
+ WGC3Denum format = GL_RGBA; |
+ int texture_id = 1; |
+ GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; |
+ |
+ for (int i = 0; i < 2; ++i) { |
+ GLint wrap_mode = i ? GL_CLAMP_TO_EDGE : GL_REPEAT; |
+ // Check that the texture gets created with the right sampler settings. |
+ ResourceProvider::ResourceId id = resource_provider->CreateGLTexture( |
+ size, format, texture_pool, wrap_mode, |
+ ResourceProvider::TextureUsageAny); |
+ EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)); |
+ EXPECT_CALL(*context, |
+ texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); |
+ EXPECT_CALL(*context, |
+ texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); |
+ EXPECT_CALL( |
+ *context, |
+ texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap_mode)); |
+ EXPECT_CALL( |
+ *context, |
+ texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_mode)); |
+ EXPECT_CALL(*context, |
+ texParameteri(GL_TEXTURE_2D, |
+ GL_TEXTURE_POOL_CHROMIUM, |
+ GL_TEXTURE_POOL_UNMANAGED_CHROMIUM)); |
+ resource_provider->CreateForTesting(id); |
+ EXPECT_NE(0u, id); |
+ |
+ Mock::VerifyAndClearExpectations(context); |
+ } |
+} |
+ |
static void EmptyReleaseCallback(unsigned sync_point, bool lost_resource) {} |
TEST_P(ResourceProviderTest, TextureMailbox_SharedMemory) { |