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

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 645853008: Standardize usage of virtual/override/final in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted Created 6 years, 2 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/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 20 matching lines...) Expand all
31 #include "ui/gfx/rect_conversions.h" 31 #include "ui/gfx/rect_conversions.h"
32 #include "ui/gfx/size_conversions.h" 32 #include "ui/gfx/size_conversions.h"
33 33
34 namespace cc { 34 namespace cc {
35 namespace { 35 namespace {
36 36
37 class MockCanvas : public SkCanvas { 37 class MockCanvas : public SkCanvas {
38 public: 38 public:
39 explicit MockCanvas(int w, int h) : SkCanvas(w, h) {} 39 explicit MockCanvas(int w, int h) : SkCanvas(w, h) {}
40 40
41 virtual void drawRect(const SkRect& rect, const SkPaint& paint) override { 41 void drawRect(const SkRect& rect, const SkPaint& paint) override {
42 // Capture calls before SkCanvas quickReject() kicks in. 42 // Capture calls before SkCanvas quickReject() kicks in.
43 rects_.push_back(rect); 43 rects_.push_back(rect);
44 } 44 }
45 45
46 std::vector<SkRect> rects_; 46 std::vector<SkRect> rects_;
47 }; 47 };
48 48
49 class NoLowResTilingsSettings : public ImplSidePaintingSettings {}; 49 class NoLowResTilingsSettings : public ImplSidePaintingSettings {};
50 50
51 class LowResTilingsSettings : public ImplSidePaintingSettings { 51 class LowResTilingsSettings : public ImplSidePaintingSettings {
(...skipping 2263 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 pending_layer_->MinimumContentsScale()); 2315 pending_layer_->MinimumContentsScale());
2316 2316
2317 SetContentsScaleOnBothLayers(contents_scale, 1.f, page_scale, 1.f, false); 2317 SetContentsScaleOnBothLayers(contents_scale, 1.f, page_scale, 1.f, false);
2318 ASSERT_GE(pending_layer_->num_tilings(), 0u); 2318 ASSERT_GE(pending_layer_->num_tilings(), 0u);
2319 EXPECT_FLOAT_EQ(pending_layer_->MinimumContentsScale(), 2319 EXPECT_FLOAT_EQ(pending_layer_->MinimumContentsScale(),
2320 pending_layer_->HighResTiling()->contents_scale()); 2320 pending_layer_->HighResTiling()->contents_scale());
2321 } 2321 }
2322 2322
2323 class DeferredInitPictureLayerImplTest : public PictureLayerImplTest { 2323 class DeferredInitPictureLayerImplTest : public PictureLayerImplTest {
2324 public: 2324 public:
2325 virtual void InitializeRenderer() override { 2325 void InitializeRenderer() override {
2326 bool delegated_rendering = false; 2326 bool delegated_rendering = false;
2327 host_impl_.InitializeRenderer(FakeOutputSurface::CreateDeferredGL( 2327 host_impl_.InitializeRenderer(FakeOutputSurface::CreateDeferredGL(
2328 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice), 2328 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice),
2329 delegated_rendering)); 2329 delegated_rendering));
2330 } 2330 }
2331 2331
2332 virtual void SetUp() override { 2332 virtual void SetUp() override {
2333 PictureLayerImplTest::SetUp(); 2333 PictureLayerImplTest::SetUp();
2334 2334
2335 // Create some default active and pending trees. 2335 // Create some default active and pending trees.
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
3636 3636
3637 EXPECT_FALSE(pending_mask_content->tilings()); 3637 EXPECT_FALSE(pending_mask_content->tilings());
3638 host_impl_.pending_tree()->UpdateDrawProperties(); 3638 host_impl_.pending_tree()->UpdateDrawProperties();
3639 EXPECT_NE(0u, pending_mask_content->num_tilings()); 3639 EXPECT_NE(0u, pending_mask_content->num_tilings());
3640 } 3640 }
3641 3641
3642 class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest { 3642 class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest {
3643 public: 3643 public:
3644 PictureLayerImplTestWithDelegatingRenderer() : PictureLayerImplTest() {} 3644 PictureLayerImplTestWithDelegatingRenderer() : PictureLayerImplTest() {}
3645 3645
3646 virtual void InitializeRenderer() override { 3646 void InitializeRenderer() override {
3647 host_impl_.InitializeRenderer(FakeOutputSurface::CreateDelegating3d()); 3647 host_impl_.InitializeRenderer(FakeOutputSurface::CreateDelegating3d());
3648 } 3648 }
3649 }; 3649 };
3650 3650
3651 TEST_F(PictureLayerImplTestWithDelegatingRenderer, 3651 TEST_F(PictureLayerImplTestWithDelegatingRenderer,
3652 DelegatingRendererWithTileOOM) { 3652 DelegatingRendererWithTileOOM) {
3653 // This test is added for crbug.com/402321, where quad should be produced when 3653 // This test is added for crbug.com/402321, where quad should be produced when
3654 // raster on demand is not allowed and tile is OOM. 3654 // raster on demand is not allowed and tile is OOM.
3655 gfx::Size tile_size = host_impl_.settings().default_tile_size; 3655 gfx::Size tile_size = host_impl_.settings().default_tile_size;
3656 gfx::Size layer_bounds(1000, 1000); 3656 gfx::Size layer_bounds(1000, 1000);
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
4550 result = layer->CalculateTileSize(gfx::Size(447, 400)); 4550 result = layer->CalculateTileSize(gfx::Size(447, 400));
4551 EXPECT_EQ(result.width(), 448); 4551 EXPECT_EQ(result.width(), 448);
4552 EXPECT_EQ(result.height(), 448); 4552 EXPECT_EQ(result.height(), 448);
4553 result = layer->CalculateTileSize(gfx::Size(500, 499)); 4553 result = layer->CalculateTileSize(gfx::Size(500, 499));
4554 EXPECT_EQ(result.width(), 512); 4554 EXPECT_EQ(result.width(), 512);
4555 EXPECT_EQ(result.height(), 500 + 2); 4555 EXPECT_EQ(result.height(), 500 + 2);
4556 } 4556 }
4557 4557
4558 } // namespace 4558 } // namespace
4559 } // namespace cc 4559 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698