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

Unified Diff: cc/output/gl_renderer_unittest.cc

Issue 1469863003: Cleanup SurfaceVisibility code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase.. Created 5 years, 1 month 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/test/test_context_support.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 f50653ec1fad4e088d5155db8876731bc064f45c..6c66ae7f43b4b3aeb5106df2672a14c7503f483b 100644
--- a/cc/output/gl_renderer_unittest.cc
+++ b/cc/output/gl_renderer_unittest.cc
@@ -849,88 +849,6 @@ TEST_F(GLRendererTest, OffscreenOutputSurface) {
Mock::VerifyAndClearExpectations(context);
}
-class VisibilityChangeIsLastCallTrackingContext
- : public TestWebGraphicsContext3D {
- public:
- VisibilityChangeIsLastCallTrackingContext()
- : last_call_was_set_visibility_(false) {}
-
- // TestWebGraphicsContext3D methods.
- void flush() override { last_call_was_set_visibility_ = false; }
- void deleteTexture(GLuint) override { last_call_was_set_visibility_ = false; }
- void deleteFramebuffer(GLuint) override {
- last_call_was_set_visibility_ = false;
- }
- void deleteQueryEXT(GLuint) override {
- last_call_was_set_visibility_ = false;
- }
- void deleteRenderbuffer(GLuint) override {
- last_call_was_set_visibility_ = false;
- }
-
- // Methods added for test.
- void set_last_call_was_visibility(bool visible) {
- DCHECK(last_call_was_set_visibility_ == false);
- last_call_was_set_visibility_ = true;
- }
- bool last_call_was_set_visibility() const {
- return last_call_was_set_visibility_;
- }
-
- private:
- bool last_call_was_set_visibility_;
-};
-
-TEST_F(GLRendererTest, VisibilityChangeIsLastCall) {
- scoped_ptr<VisibilityChangeIsLastCallTrackingContext> context_owned(
- new VisibilityChangeIsLastCallTrackingContext);
- VisibilityChangeIsLastCallTrackingContext* context = context_owned.get();
-
- scoped_refptr<TestContextProvider> provider =
- TestContextProvider::Create(std::move(context_owned));
-
- provider->support()->SetSurfaceVisibleCallback(base::Bind(
- &VisibilityChangeIsLastCallTrackingContext::set_last_call_was_visibility,
- base::Unretained(context)));
-
- FakeOutputSurfaceClient output_surface_client;
- scoped_ptr<OutputSurface> output_surface(
- FakeOutputSurface::Create3d(provider));
- CHECK(output_surface->BindToClient(&output_surface_client));
-
- scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
- new TestSharedBitmapManager());
- scoped_ptr<ResourceProvider> resource_provider = FakeResourceProvider::Create(
- output_surface.get(), shared_bitmap_manager.get());
-
- RendererSettings settings;
- FakeRendererClient renderer_client;
- FakeRendererGL renderer(&renderer_client,
- &settings,
- output_surface.get(),
- resource_provider.get());
-
- gfx::Rect viewport_rect(1, 1);
- AddRenderPass(&render_passes_in_draw_order_,
- RenderPassId(1, 0),
- viewport_rect,
- gfx::Transform());
-
- // Ensure that the call to SetSurfaceVisible is the last call issue to the
- // GPU process, after glFlush is called, and after the RendererClient's
- // SetManagedMemoryPolicy is called. Plumb this tracking between both the
- // RenderClient and the Context by giving them both a pointer to a variable on
- // the stack.
- renderer.SetVisible(true);
- renderer.DrawFrame(&render_passes_in_draw_order_,
- 1.f,
- viewport_rect,
- viewport_rect,
- false);
- renderer.SetVisible(false);
- EXPECT_TRUE(context->last_call_was_set_visibility());
-}
-
class TextureStateTrackingContext : public TestWebGraphicsContext3D {
public:
TextureStateTrackingContext() : active_texture_(GL_INVALID_ENUM) {
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/test/test_context_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698