Chromium Code Reviews| Index: cc/resources/resource_provider_unittest.cc |
| diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc |
| index a23af0b577c7f5ce3ed255ff2881055eac99f8ff..6bdbfec589d79d32dd585264bba160800a41db9d 100644 |
| --- a/cc/resources/resource_provider_unittest.cc |
| +++ b/cc/resources/resource_provider_unittest.cc |
| @@ -1144,6 +1144,52 @@ 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<OutputSurface> output_surface( |
| + FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( |
| + new TextureStateTrackingContext))); |
| + TextureStateTrackingContext* context = |
| + static_cast<TextureStateTrackingContext*>(output_surface->context3d()); |
| + 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); |
|
enne (OOO)
2013/08/07 20:57:52
Can you put this inside the loop? I think these e
ccameron
2013/08/31 00:37:58
Done.
|
| +} |
| + |
| static void EmptyReleaseCallback(unsigned sync_point, bool lost_resource) {} |
| TEST_P(ResourceProviderTest, TextureMailbox_SharedMemory) { |