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

Side by Side Diff: Source/web/tests/GraphicsLayerTest.cpp

Issue 138453004: Pinch/Zoom Infrastructure & Plumbing CL (Prequel) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use setContentsRect() instead of directly accessing contentLayer bounds. 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
« no previous file with comments | « Source/web/PinchViewports.cpp ('k') | public/platform/WebLayer.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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 explicit GraphicsLayerForTesting(GraphicsLayerClient* client) 58 explicit GraphicsLayerForTesting(GraphicsLayerClient* client)
59 : GraphicsLayer(client) { }; 59 : GraphicsLayer(client) { };
60 60
61 virtual blink::WebLayer* contentsLayer() const { return GraphicsLayer::conte ntsLayer(); } 61 virtual blink::WebLayer* contentsLayer() const { return GraphicsLayer::conte ntsLayer(); }
62 }; 62 };
63 63
64 class GraphicsLayerTest : public testing::Test { 64 class GraphicsLayerTest : public testing::Test {
65 public: 65 public:
66 GraphicsLayerTest() 66 GraphicsLayerTest()
67 { 67 {
68 m_clipLayer = adoptPtr(new GraphicsLayerForTesting(&m_client));
68 m_graphicsLayer = adoptPtr(new GraphicsLayerForTesting(&m_client)); 69 m_graphicsLayer = adoptPtr(new GraphicsLayerForTesting(&m_client));
70 m_clipLayer->addChild(m_graphicsLayer.get());
71 m_graphicsLayer->platformLayer()->setScrollClipLayer(
72 m_clipLayer->platformLayer());
69 m_platformLayer = m_graphicsLayer->platformLayer(); 73 m_platformLayer = m_graphicsLayer->platformLayer();
70 m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->creat eLayerTreeViewForTesting(WebUnitTestSupport::TestViewTypeUnitTest)); 74 m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->creat eLayerTreeViewForTesting(WebUnitTestSupport::TestViewTypeUnitTest));
71 ASSERT(m_layerTreeView); 75 ASSERT(m_layerTreeView);
72 m_layerTreeView->setRootLayer(*m_platformLayer); 76 m_layerTreeView->setRootLayer(*m_clipLayer->platformLayer());
77 m_layerTreeView->registerViewportLayers(
78 m_clipLayer->platformLayer(), m_graphicsLayer->platformLayer(), 0);
73 m_layerTreeView->setViewportSize(WebSize(1, 1), WebSize(1, 1)); 79 m_layerTreeView->setViewportSize(WebSize(1, 1), WebSize(1, 1));
74 } 80 }
75 81
76 virtual ~GraphicsLayerTest() 82 virtual ~GraphicsLayerTest()
77 { 83 {
78 m_graphicsLayer.clear(); 84 m_graphicsLayer.clear();
79 m_layerTreeView.clear(); 85 m_layerTreeView.clear();
80 } 86 }
81 87
82 protected: 88 protected:
83 WebLayer* m_platformLayer; 89 WebLayer* m_platformLayer;
84 OwnPtr<GraphicsLayerForTesting> m_graphicsLayer; 90 OwnPtr<GraphicsLayerForTesting> m_graphicsLayer;
91 OwnPtr<GraphicsLayerForTesting> m_clipLayer;
85 92
86 private: 93 private:
87 OwnPtr<WebLayerTreeView> m_layerTreeView; 94 OwnPtr<WebLayerTreeView> m_layerTreeView;
88 MockGraphicsLayerClient m_client; 95 MockGraphicsLayerClient m_client;
89 }; 96 };
90 97
91 TEST_F(GraphicsLayerTest, updateLayerPreserves3DWithAnimations) 98 TEST_F(GraphicsLayerTest, updateLayerPreserves3DWithAnimations)
92 { 99 {
93 ASSERT_FALSE(m_platformLayer->hasActiveAnimation()); 100 ASSERT_FALSE(m_platformLayer->hasActiveAnimation());
94 101
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 EXPECT_FALSE(m_graphicsLayer->contentsLayer()); 172 EXPECT_FALSE(m_graphicsLayer->contentsLayer());
166 173
167 m_graphicsLayer->setContentsToSolidColor(Color::white); 174 m_graphicsLayer->setContentsToSolidColor(Color::white);
168 EXPECT_TRUE(m_graphicsLayer->contentsLayer()); 175 EXPECT_TRUE(m_graphicsLayer->contentsLayer());
169 176
170 m_graphicsLayer->setContentsToSolidColor(Color()); 177 m_graphicsLayer->setContentsToSolidColor(Color());
171 EXPECT_FALSE(m_graphicsLayer->contentsLayer()); 178 EXPECT_FALSE(m_graphicsLayer->contentsLayer());
172 } 179 }
173 180
174 } // namespace 181 } // namespace
OLDNEW
« no previous file with comments | « Source/web/PinchViewports.cpp ('k') | public/platform/WebLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698