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

Unified Diff: cc/layers/contents_scaling_layer_unittest.cc

Issue 1057283003: Remove parts of //cc we aren't using (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/contents_scaling_layer.cc ('k') | cc/layers/delegated_frame_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/contents_scaling_layer_unittest.cc
diff --git a/cc/layers/contents_scaling_layer_unittest.cc b/cc/layers/contents_scaling_layer_unittest.cc
deleted file mode 100644
index 38385a06ad1160cd5689f696d34bacc3b82f616f..0000000000000000000000000000000000000000
--- a/cc/layers/contents_scaling_layer_unittest.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cc/layers/contents_scaling_layer.h"
-
-#include <vector>
-
-#include "cc/test/fake_layer_tree_host.h"
-#include "cc/test/geometry_test_utils.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cc {
-namespace {
-
-class MockContentsScalingLayer : public ContentsScalingLayer {
- public:
- MockContentsScalingLayer()
- : ContentsScalingLayer() {}
-
- void SetNeedsDisplayRect(const gfx::Rect& dirty_rect) override {
- last_needs_display_rect_ = dirty_rect;
- ContentsScalingLayer::SetNeedsDisplayRect(dirty_rect);
- }
-
- const gfx::Rect& LastNeedsDisplayRect() const {
- return last_needs_display_rect_;
- }
-
- private:
- ~MockContentsScalingLayer() override {}
-
- gfx::Rect last_needs_display_rect_;
-};
-
-static void CalcDrawProps(FakeLayerTreeHost* host, float device_scale_factor) {
- RenderSurfaceLayerList render_surface_layer_list;
- LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
- host->root_layer(), gfx::Size(500, 500), &render_surface_layer_list);
- inputs.device_scale_factor = device_scale_factor;
- LayerTreeHostCommon::CalculateDrawProperties(&inputs);
-}
-
-TEST(ContentsScalingLayerTest, CheckContentsBounds) {
- FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
- scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client);
-
- scoped_refptr<MockContentsScalingLayer> test_layer =
- make_scoped_refptr(new MockContentsScalingLayer());
-
- scoped_refptr<Layer> root = Layer::Create();
- root->AddChild(test_layer);
- host->SetRootLayer(root);
-
- test_layer->SetBounds(gfx::Size(320, 240));
-
- CalcDrawProps(host.get(), 1.f);
- EXPECT_FLOAT_EQ(1.f, test_layer->contents_scale_x());
- EXPECT_FLOAT_EQ(1.f, test_layer->contents_scale_y());
- EXPECT_EQ(320, test_layer->content_bounds().width());
- EXPECT_EQ(240, test_layer->content_bounds().height());
-
- CalcDrawProps(host.get(), 2.f);
- EXPECT_EQ(640, test_layer->content_bounds().width());
- EXPECT_EQ(480, test_layer->content_bounds().height());
-
- test_layer->SetBounds(gfx::Size(10, 20));
- CalcDrawProps(host.get(), 2.f);
- EXPECT_EQ(20, test_layer->content_bounds().width());
- EXPECT_EQ(40, test_layer->content_bounds().height());
-
- CalcDrawProps(host.get(), 1.33f);
- EXPECT_EQ(14, test_layer->content_bounds().width());
- EXPECT_EQ(27, test_layer->content_bounds().height());
-}
-
-} // namespace
-} // namespace cc
« no previous file with comments | « cc/layers/contents_scaling_layer.cc ('k') | cc/layers/delegated_frame_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698