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

Unified Diff: cc/output/gl_renderer_unittest.cc

Issue 23601013: cc: Invalidate framebuffer contents when clearing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use arraysize. Created 7 years, 3 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/output/gl_renderer.cc ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/gl_renderer_unittest.cc
diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc
index 0e153c1ce9a97d6839518deb2f1b1ceff0bb53aa..7687b5533e35f47222243feb46902793aac462b5 100644
--- a/cc/output/gl_renderer_unittest.cc
+++ b/cc/output/gl_renderer_unittest.cc
@@ -702,14 +702,15 @@ TEST(GLRendererTest2, InitializationWithQuicklyLostContextDoesNotAssert) {
class ClearCountingContext : public TestWebGraphicsContext3D {
public:
- ClearCountingContext() : clear_(0) {}
-
- virtual void clear(WGC3Dbitfield) { clear_++; }
-
- int clear_count() const { return clear_; }
+ ClearCountingContext() {
+ test_capabilities_.discard_framebuffer = true;
+ }
- private:
- int clear_;
+ MOCK_METHOD3(discardFramebufferEXT,
+ void(WGC3Denum target,
+ WGC3Dsizei numAttachments,
+ const WGC3Denum* attachments));
+ MOCK_METHOD1(clear, void(WGC3Dbitfield mask));
};
TEST(GLRendererTest2, OpaqueBackground) {
@@ -732,15 +733,17 @@ TEST(GLRendererTest2, OpaqueBackground) {
EXPECT_TRUE(renderer.Initialize());
- renderer.DrawFrame(renderer_client.render_passes_in_draw_order(), NULL);
-
// On DEBUG builds, render passes with opaque background clear to blue to
// easily see regions that were not drawn on the screen.
+ EXPECT_CALL(*context, discardFramebufferEXT(GL_FRAMEBUFFER, 1, _))
+ .Times(1);
#ifdef NDEBUG
- EXPECT_EQ(0, context->clear_count());
+ EXPECT_CALL(*context, clear(_)).Times(0);
#else
- EXPECT_EQ(1, context->clear_count());
+ EXPECT_CALL(*context, clear(_)).Times(1);
#endif
+ renderer.DrawFrame(renderer_client.render_passes_in_draw_order(), NULL);
+ Mock::VerifyAndClearExpectations(context);
}
TEST(GLRendererTest2, TransparentBackground) {
@@ -763,9 +766,12 @@ TEST(GLRendererTest2, TransparentBackground) {
EXPECT_TRUE(renderer.Initialize());
+ EXPECT_CALL(*context, discardFramebufferEXT(GL_FRAMEBUFFER, 1, _))
+ .Times(1);
+ EXPECT_CALL(*context, clear(_)).Times(1);
renderer.DrawFrame(renderer_client.render_passes_in_draw_order(), NULL);
- EXPECT_EQ(1, context->clear_count());
+ Mock::VerifyAndClearExpectations(context);
}
class VisibilityChangeIsLastCallTrackingContext
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698