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

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

Issue 2194013002: cc: Delete the Renderer base class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dcheck-delegating
Patch Set: delete-renderer-base-class: rebase Created 4 years, 4 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/gl_renderer.cc ('k') | cc/output/renderer.h » ('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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 gpu::SyncToken other; 57 gpu::SyncToken other;
58 memcpy(&other, arg, sizeof(other)); 58 memcpy(&other, arg, sizeof(other));
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(GLRenderer* 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); 69 viewport_rect, viewport_rect);
70 } 70 }
71 void DrawFrame(Renderer* renderer, 71 void DrawFrame(GLRenderer* 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); 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) \
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2102 base::MakeUnique<GLRenderer>(&settings_, output_surface_.get(), 2102 base::MakeUnique<GLRenderer>(&settings_, output_surface_.get(),
2103 resource_provider_.get(), nullptr, 0); 2103 resource_provider_.get(), nullptr, 0);
2104 } 2104 }
2105 2105
2106 RendererSettings settings_; 2106 RendererSettings settings_;
2107 FakeOutputSurfaceClient output_surface_client_; 2107 FakeOutputSurfaceClient output_surface_client_;
2108 MockContextSupport* context_support_ptr_; 2108 MockContextSupport* context_support_ptr_;
2109 scoped_refptr<MockContextProvider> context_provider_; 2109 scoped_refptr<MockContextProvider> context_provider_;
2110 std::unique_ptr<OutputSurface> output_surface_; 2110 std::unique_ptr<OutputSurface> output_surface_;
2111 std::unique_ptr<ResourceProvider> resource_provider_; 2111 std::unique_ptr<ResourceProvider> resource_provider_;
2112 std::unique_ptr<Renderer> renderer_; 2112 std::unique_ptr<GLRenderer> renderer_;
2113 }; 2113 };
2114 2114
2115 TEST_F(GLRendererWithMockContextTest, 2115 TEST_F(GLRendererWithMockContextTest,
2116 ContextPurgedWhenRendererBecomesInvisible) { 2116 ContextPurgedWhenRendererBecomesInvisible) {
2117 // Ensure our expectations run in order. 2117 // Ensure our expectations run in order.
2118 ::testing::InSequence s; 2118 ::testing::InSequence s;
2119 2119
2120 EXPECT_CALL(*context_support_ptr_, SetClientVisible(0, true)); 2120 EXPECT_CALL(*context_support_ptr_, SetClientVisible(0, true));
2121 EXPECT_CALL(*context_support_ptr_, AnyClientsVisible()) 2121 EXPECT_CALL(*context_support_ptr_, AnyClientsVisible())
2122 .WillOnce(Return(true)); 2122 .WillOnce(Return(true));
2123 EXPECT_CALL(*context_support_ptr_, SetAggressivelyFreeResources(false)); 2123 EXPECT_CALL(*context_support_ptr_, SetAggressivelyFreeResources(false));
2124 renderer_->SetVisible(true); 2124 renderer_->SetVisible(true);
2125 Mock::VerifyAndClearExpectations(context_support_ptr_); 2125 Mock::VerifyAndClearExpectations(context_support_ptr_);
2126 2126
2127 EXPECT_TRUE(renderer_->visible());
2128
2129 EXPECT_CALL(*context_support_ptr_, SetClientVisible(0, false)); 2127 EXPECT_CALL(*context_support_ptr_, SetClientVisible(0, false));
2130 EXPECT_CALL(*context_support_ptr_, AnyClientsVisible()) 2128 EXPECT_CALL(*context_support_ptr_, AnyClientsVisible())
2131 .WillOnce(Return(false)); 2129 .WillOnce(Return(false));
2132 EXPECT_CALL(*context_provider_, DeleteCachedResources()); 2130 EXPECT_CALL(*context_provider_, DeleteCachedResources());
2133 EXPECT_CALL(*context_support_ptr_, SetAggressivelyFreeResources(true)); 2131 EXPECT_CALL(*context_support_ptr_, SetAggressivelyFreeResources(true));
2134 renderer_->SetVisible(false); 2132 renderer_->SetVisible(false);
2135 Mock::VerifyAndClearExpectations(context_support_ptr_); 2133 Mock::VerifyAndClearExpectations(context_support_ptr_);
2136
2137 EXPECT_FALSE(renderer_->visible());
2138 } 2134 }
2139 2135
2140 } // namespace 2136 } // namespace
2141 } // namespace cc 2137 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/output/renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698