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

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

Issue 2128113002: Use a cc::Display for WebView resourceless software draws. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: displaywebview: mojom Created 4 years, 5 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
« no previous file with comments | « cc/output/direct_renderer.cc ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 return other == sync_token; 59 return other == sync_token;
60 } 60 }
61 61
62 class GLRendererTest : public testing::Test { 62 class GLRendererTest : public testing::Test {
63 protected: 63 protected:
64 RenderPass* root_render_pass() { 64 RenderPass* root_render_pass() {
65 return render_passes_in_draw_order_.back().get(); 65 return render_passes_in_draw_order_.back().get();
66 } 66 }
67 void DrawFrame(Renderer* renderer, const gfx::Rect& viewport_rect) { 67 void DrawFrame(Renderer* renderer, const gfx::Rect& viewport_rect) {
68 renderer->DrawFrame(&render_passes_in_draw_order_, 1.f, gfx::ColorSpace(), 68 renderer->DrawFrame(&render_passes_in_draw_order_, 1.f, gfx::ColorSpace(),
69 viewport_rect, viewport_rect, false); 69 viewport_rect, viewport_rect);
70 } 70 }
71 void DrawFrame(Renderer* renderer, 71 void DrawFrame(Renderer* renderer,
72 const gfx::Rect& viewport_rect, 72 const gfx::Rect& viewport_rect,
73 const gfx::Rect& clip_rect) { 73 const gfx::Rect& clip_rect) {
74 renderer->DrawFrame(&render_passes_in_draw_order_, 1.f, gfx::ColorSpace(), 74 renderer->DrawFrame(&render_passes_in_draw_order_, 1.f, gfx::ColorSpace(),
75 viewport_rect, clip_rect, false); 75 viewport_rect, clip_rect);
76 } 76 }
77 77
78 RenderPassList render_passes_in_draw_order_; 78 RenderPassList render_passes_in_draw_order_;
79 }; 79 };
80 80
81 #define EXPECT_PROGRAM_VALID(program_binding) \ 81 #define EXPECT_PROGRAM_VALID(program_binding) \
82 do { \ 82 do { \
83 EXPECT_TRUE((program_binding)->program()); \ 83 EXPECT_TRUE((program_binding)->program()); \
84 EXPECT_TRUE((program_binding)->initialized()); \ 84 EXPECT_TRUE((program_binding)->initialized()); \
85 } while (false) 85 } while (false)
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 1686
1687 MOCK_METHOD0(EnsureBackbuffer, void()); 1687 MOCK_METHOD0(EnsureBackbuffer, void());
1688 MOCK_METHOD0(DiscardBackbuffer, void()); 1688 MOCK_METHOD0(DiscardBackbuffer, void());
1689 MOCK_METHOD4(Reshape, 1689 MOCK_METHOD4(Reshape,
1690 void(const gfx::Size& size, 1690 void(const gfx::Size& size,
1691 float scale_factor, 1691 float scale_factor,
1692 const gfx::ColorSpace& color_space, 1692 const gfx::ColorSpace& color_space,
1693 bool has_alpha)); 1693 bool has_alpha));
1694 MOCK_METHOD0(BindFramebuffer, void()); 1694 MOCK_METHOD0(BindFramebuffer, void());
1695 MOCK_METHOD0(GetFramebufferCopyTextureFormat, GLenum()); 1695 MOCK_METHOD0(GetFramebufferCopyTextureFormat, GLenum());
1696 MOCK_METHOD1(SwapBuffers_, void(CompositorFrame& frame)); 1696 MOCK_METHOD1(SwapBuffers_, void(CompositorFrame& frame)); // NOLINT
1697 void SwapBuffers(CompositorFrame frame) override { SwapBuffers_(frame); } 1697 void SwapBuffers(CompositorFrame frame) override { SwapBuffers_(frame); }
1698 }; 1698 };
1699 1699
1700 class MockOutputSurfaceTest : public GLRendererTest { 1700 class MockOutputSurfaceTest : public GLRendererTest {
1701 protected: 1701 protected:
1702 virtual void SetUp() { 1702 virtual void SetUp() {
1703 FakeOutputSurfaceClient output_surface_client_; 1703 FakeOutputSurfaceClient output_surface_client_;
1704 CHECK(output_surface_.BindToClient(&output_surface_client_)); 1704 CHECK(output_surface_.BindToClient(&output_surface_client_));
1705 1705
1706 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); 1706 shared_bitmap_manager_.reset(new TestSharedBitmapManager());
(...skipping 25 matching lines...) Expand all
1732 .Times(1); 1732 .Times(1);
1733 1733
1734 EXPECT_CALL(output_surface_, BindFramebuffer()).Times(1); 1734 EXPECT_CALL(output_surface_, BindFramebuffer()).Times(1);
1735 1735
1736 EXPECT_CALL(*Context(), drawElements(_, _, _, _)).Times(1); 1736 EXPECT_CALL(*Context(), drawElements(_, _, _, _)).Times(1);
1737 1737
1738 renderer_->DecideRenderPassAllocationsForFrame( 1738 renderer_->DecideRenderPassAllocationsForFrame(
1739 render_passes_in_draw_order_); 1739 render_passes_in_draw_order_);
1740 renderer_->DrawFrame(&render_passes_in_draw_order_, device_scale_factor, 1740 renderer_->DrawFrame(&render_passes_in_draw_order_, device_scale_factor,
1741 gfx::ColorSpace(), device_viewport_rect, 1741 gfx::ColorSpace(), device_viewport_rect,
1742 device_viewport_rect, false); 1742 device_viewport_rect);
1743 } 1743 }
1744 1744
1745 OutputSurfaceMockContext* Context() { 1745 OutputSurfaceMockContext* Context() {
1746 return static_cast<OutputSurfaceMockContext*>( 1746 return static_cast<OutputSurfaceMockContext*>(
1747 static_cast<TestContextProvider*>(output_surface_.context_provider()) 1747 static_cast<TestContextProvider*>(output_surface_.context_provider())
1748 ->TestContext3d()); 1748 ->TestContext3d());
1749 } 1749 }
1750 1750
1751 RendererSettings settings_; 1751 RendererSettings settings_;
1752 FakeOutputSurfaceClient output_surface_client_; 1752 FakeOutputSurfaceClient output_surface_client_;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
2063 EXPECT_CALL(*context, waitSyncToken(MatchesSyncToken(sync_token))).Times(1); 2063 EXPECT_CALL(*context, waitSyncToken(MatchesSyncToken(sync_token))).Times(1);
2064 EXPECT_CALL(overlay_scheduler, 2064 EXPECT_CALL(overlay_scheduler,
2065 Schedule(1, gfx::OVERLAY_TRANSFORM_NONE, _, viewport_rect, 2065 Schedule(1, gfx::OVERLAY_TRANSFORM_NONE, _, viewport_rect,
2066 BoundingRect(uv_top_left, uv_bottom_right))).Times(1); 2066 BoundingRect(uv_top_left, uv_bottom_right))).Times(1);
2067 2067
2068 DrawFrame(&renderer, viewport_rect); 2068 DrawFrame(&renderer, viewport_rect);
2069 } 2069 }
2070 2070
2071 } // namespace 2071 } // namespace
2072 } // namespace cc 2072 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/direct_renderer.cc ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698