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

Unified Diff: cc/resource_provider_unittest.cc

Issue 11548052: Identify evictable textures by GL texture parameter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resolve against head again Created 8 years 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') | no next file » | 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 3a90f6e01f5ac1e46b26177e6570559a3d9fb1ec..aee55ba8a68d588fb09aef006a5f3000e3a30a17 100644
--- a/cc/resource_provider_unittest.cc
+++ b/cc/resource_provider_unittest.cc
@@ -585,6 +585,7 @@ TEST_P(ResourceProviderTest, ScopedSampler)
EXPECT_CALL(*context, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
EXPECT_CALL(*context, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
EXPECT_CALL(*context, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
+ EXPECT_CALL(*context, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_POOL_CHROMIUM, GL_TEXTURE_POOL_UNMANAGED_CHROMIUM));
ResourceProvider::ResourceId id = resourceProvider->createResource(size, format, ResourceProvider::TextureUsageAny);
// Creating a sampler with the default filter should not change any texture
@@ -613,6 +614,32 @@ TEST_P(ResourceProviderTest, ScopedSampler)
Mock::VerifyAndClearExpectations(context);
}
+TEST_P(ResourceProviderTest, ManagedResource)
+{
+ // Sampling is only supported for GL textures.
+ if (GetParam() != ResourceProvider::GLTexture)
+ return;
+
+ scoped_ptr<OutputSurface> outputSurface(FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>(new TextureStateTrackingContext)));
+ TextureStateTrackingContext* context = static_cast<TextureStateTrackingContext*>(outputSurface->Context3D());
+ scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::create(outputSurface.get()));
+
+ gfx::Size size(1, 1);
+ WGC3Denum format = GL_RGBA;
+ int textureId = 1;
+
+ // Check that the texture gets created with the right sampler settings.
+ EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, textureId));
+ 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, GL_CLAMP_TO_EDGE));
+ EXPECT_CALL(*context, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
+ EXPECT_CALL(*context, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_POOL_CHROMIUM, GL_TEXTURE_POOL_MANAGED_CHROMIUM));
+ ResourceProvider::ResourceId id = resourceProvider->createManagedResource(size, format, ResourceProvider::TextureUsageAny);
+
+ Mock::VerifyAndClearExpectations(context);
+}
+
INSTANTIATE_TEST_CASE_P(ResourceProviderTests,
ResourceProviderTest,
::testing::Values(ResourceProvider::GLTexture,
« no previous file with comments | « cc/resource_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698