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

Side by Side Diff: cc/output/gl_renderer_unittest.cc

Issue 132163004: Remove WebGraphicsContext3D getter from cc::ContextProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/output/compositor_frame_metadata.h" 10 #include "cc/output/compositor_frame_metadata.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 using GLRenderer::IsBackbufferDiscarded; 172 using GLRenderer::IsBackbufferDiscarded;
173 using GLRenderer::DoDrawQuad; 173 using GLRenderer::DoDrawQuad;
174 using GLRenderer::BeginDrawingFrame; 174 using GLRenderer::BeginDrawingFrame;
175 using GLRenderer::FinishDrawingQuadList; 175 using GLRenderer::FinishDrawingQuadList;
176 using GLRenderer::stencil_enabled; 176 using GLRenderer::stencil_enabled;
177 }; 177 };
178 178
179 class GLRendererWithDefaultHarnessTest : public GLRendererTest { 179 class GLRendererWithDefaultHarnessTest : public GLRendererTest {
180 protected: 180 protected:
181 GLRendererWithDefaultHarnessTest() { 181 GLRendererWithDefaultHarnessTest() {
182 output_surface_ = FakeOutputSurface::Create3d( 182 output_surface_ =
183 TestWebGraphicsContext3D::Create()).Pass(); 183 FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create()).Pass();
184 CHECK(output_surface_->BindToClient(&output_surface_client_)); 184 CHECK(output_surface_->BindToClient(&output_surface_client_));
185 185
186 resource_provider_ = ResourceProvider::Create( 186 resource_provider_ = ResourceProvider::Create(
187 output_surface_.get(), NULL, 0, false, 1).Pass(); 187 output_surface_.get(), NULL, 0, false, 1).Pass();
188 renderer_ = make_scoped_ptr(new FakeRendererGL(&renderer_client_, 188 renderer_ = make_scoped_ptr(new FakeRendererGL(&renderer_client_,
189 &settings_, 189 &settings_,
190 output_surface_.get(), 190 output_surface_.get(),
191 resource_provider_.get())); 191 resource_provider_.get()));
192 } 192 }
193 193
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 Mock::VerifyAndClearExpectations(context); 738 Mock::VerifyAndClearExpectations(context);
739 } 739 }
740 740
741 class VisibilityChangeIsLastCallTrackingContext 741 class VisibilityChangeIsLastCallTrackingContext
742 : public TestWebGraphicsContext3D { 742 : public TestWebGraphicsContext3D {
743 public: 743 public:
744 VisibilityChangeIsLastCallTrackingContext() 744 VisibilityChangeIsLastCallTrackingContext()
745 : last_call_was_set_visibility_(false) {} 745 : last_call_was_set_visibility_(false) {}
746 746
747 // WebGraphicsContext3D methods. 747 // WebGraphicsContext3D methods.
748 virtual void flush() { 748 virtual void flush() { last_call_was_set_visibility_ = false; }
749 last_call_was_set_visibility_ = false; 749 virtual void deleteTexture(WebGLId) { last_call_was_set_visibility_ = false; }
750 }
751 virtual void deleteTexture(WebGLId) {
752 last_call_was_set_visibility_ = false;
753 }
754 virtual void deleteFramebuffer(WebGLId) { 750 virtual void deleteFramebuffer(WebGLId) {
755 last_call_was_set_visibility_ = false; 751 last_call_was_set_visibility_ = false;
756 } 752 }
757 virtual void deleteQueryEXT(WebGLId) { 753 virtual void deleteQueryEXT(WebGLId) {
758 last_call_was_set_visibility_ = false; 754 last_call_was_set_visibility_ = false;
759 } 755 }
760 virtual void deleteRenderbuffer(WebGLId) { 756 virtual void deleteRenderbuffer(WebGLId) {
761 last_call_was_set_visibility_ = false; 757 last_call_was_set_visibility_ = false;
762 } 758 }
763 759
(...skipping 16 matching lines...) Expand all
780 VisibilityChangeIsLastCallTrackingContext* context = context_owned.get(); 776 VisibilityChangeIsLastCallTrackingContext* context = context_owned.get();
781 777
782 scoped_refptr<TestContextProvider> provider = TestContextProvider::Create( 778 scoped_refptr<TestContextProvider> provider = TestContextProvider::Create(
783 context_owned.PassAs<TestWebGraphicsContext3D>()); 779 context_owned.PassAs<TestWebGraphicsContext3D>());
784 780
785 provider->support()->SetSurfaceVisibleCallback(base::Bind( 781 provider->support()->SetSurfaceVisibleCallback(base::Bind(
786 &VisibilityChangeIsLastCallTrackingContext::set_last_call_was_visibility, 782 &VisibilityChangeIsLastCallTrackingContext::set_last_call_was_visibility,
787 base::Unretained(context))); 783 base::Unretained(context)));
788 784
789 FakeOutputSurfaceClient output_surface_client; 785 FakeOutputSurfaceClient output_surface_client;
790 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( 786 scoped_ptr<OutputSurface> output_surface(
791 provider)); 787 FakeOutputSurface::Create3d(provider));
792 CHECK(output_surface->BindToClient(&output_surface_client)); 788 CHECK(output_surface->BindToClient(&output_surface_client));
793 789
794 scoped_ptr<ResourceProvider> resource_provider( 790 scoped_ptr<ResourceProvider> resource_provider(
795 ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1)); 791 ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1));
796 792
797 LayerTreeSettings settings; 793 LayerTreeSettings settings;
798 FakeRendererClient renderer_client; 794 FakeRendererClient renderer_client;
799 FakeRendererGL renderer(&renderer_client, 795 FakeRendererGL renderer(&renderer_client,
800 &settings, 796 &settings,
801 output_surface.get(), 797 output_surface.get(),
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 viewport_rect, 1688 viewport_rect,
1693 viewport_rect, 1689 viewport_rect,
1694 true, 1690 true,
1695 false); 1691 false);
1696 1692
1697 TestSolidColorProgramAA(); 1693 TestSolidColorProgramAA();
1698 } 1694 }
1699 1695
1700 class OutputSurfaceMockContext : public TestWebGraphicsContext3D { 1696 class OutputSurfaceMockContext : public TestWebGraphicsContext3D {
1701 public: 1697 public:
1702 OutputSurfaceMockContext() { 1698 OutputSurfaceMockContext() { test_capabilities_.post_sub_buffer = true; }
1703 test_capabilities_.post_sub_buffer = true;
1704 }
1705 1699
1706 // Specifically override methods even if they are unused (used in conjunction 1700 // Specifically override methods even if they are unused (used in conjunction
1707 // with StrictMock). We need to make sure that GLRenderer does not issue 1701 // with StrictMock). We need to make sure that GLRenderer does not issue
1708 // framebuffer-related GL calls directly. Instead these are supposed to go 1702 // framebuffer-related GL calls directly. Instead these are supposed to go
1709 // through the OutputSurface abstraction. 1703 // through the OutputSurface abstraction.
1710 MOCK_METHOD2(bindFramebuffer, void(WGC3Denum target, WebGLId framebuffer)); 1704 MOCK_METHOD2(bindFramebuffer, void(WGC3Denum target, WebGLId framebuffer));
1711 MOCK_METHOD3(reshapeWithScaleFactor, 1705 MOCK_METHOD3(reshapeWithScaleFactor,
1712 void(int width, int height, float scale_factor)); 1706 void(int width, int height, float scale_factor));
1713 MOCK_METHOD4(drawElements, 1707 MOCK_METHOD4(drawElements,
1714 void(WGC3Denum mode, 1708 void(WGC3Denum mode,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 NULL, 1769 NULL,
1776 device_scale_factor, 1770 device_scale_factor,
1777 device_viewport_rect, 1771 device_viewport_rect,
1778 device_viewport_rect, 1772 device_viewport_rect,
1779 true, 1773 true,
1780 false); 1774 false);
1781 } 1775 }
1782 1776
1783 OutputSurfaceMockContext* Context() { 1777 OutputSurfaceMockContext* Context() {
1784 return static_cast<OutputSurfaceMockContext*>( 1778 return static_cast<OutputSurfaceMockContext*>(
1785 output_surface_.context_provider()->Context3d()); 1779 static_cast<TestContextProvider*>(
1780 output_surface_.context_provider().get())->TestContext3d());
1786 } 1781 }
1787 1782
1788 LayerTreeSettings settings_; 1783 LayerTreeSettings settings_;
1789 FakeOutputSurfaceClient output_surface_client_; 1784 FakeOutputSurfaceClient output_surface_client_;
1790 StrictMock<MockOutputSurface> output_surface_; 1785 StrictMock<MockOutputSurface> output_surface_;
1791 scoped_ptr<ResourceProvider> resource_provider_; 1786 scoped_ptr<ResourceProvider> resource_provider_;
1792 FakeRendererClient renderer_client_; 1787 FakeRendererClient renderer_client_;
1793 scoped_ptr<FakeRendererGL> renderer_; 1788 scoped_ptr<FakeRendererGL> renderer_;
1794 }; 1789 };
1795 1790
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 base::MessageLoop::current()->Run(); 1890 base::MessageLoop::current()->Run();
1896 1891
1897 // The sync point should have happened. 1892 // The sync point should have happened.
1898 EXPECT_EQ(1, sync_point_callback_count); 1893 EXPECT_EQ(1, sync_point_callback_count);
1899 EXPECT_EQ(1, other_callback_count); 1894 EXPECT_EQ(1, other_callback_count);
1900 } 1895 }
1901 #endif // OS_ANDROID 1896 #endif // OS_ANDROID
1902 1897
1903 } // namespace 1898 } // namespace
1904 } // namespace cc 1899 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698