OLD | NEW |
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 24 matching lines...) Expand all Loading... |
35 #include "public/platform/WebFloatAnimationCurve.h" | 35 #include "public/platform/WebFloatAnimationCurve.h" |
36 #include "public/platform/WebGraphicsContext3D.h" | 36 #include "public/platform/WebGraphicsContext3D.h" |
37 #include "public/platform/WebLayer.h" | 37 #include "public/platform/WebLayer.h" |
38 #include "public/platform/WebLayerTreeView.h" | 38 #include "public/platform/WebLayerTreeView.h" |
39 #include "public/platform/WebUnitTestSupport.h" | 39 #include "public/platform/WebUnitTestSupport.h" |
40 #include "wtf/PassOwnPtr.h" | 40 #include "wtf/PassOwnPtr.h" |
41 | 41 |
42 #include <gtest/gtest.h> | 42 #include <gtest/gtest.h> |
43 | 43 |
44 using namespace blink; | 44 using namespace blink; |
45 using namespace blink; | |
46 | 45 |
47 namespace { | 46 namespace { |
48 | 47 |
49 class MockGraphicsLayerClient : public GraphicsLayerClient { | 48 class MockGraphicsLayerClient : public GraphicsLayerClient { |
50 public: | 49 public: |
51 virtual void notifyAnimationStarted(const GraphicsLayer*, double monotonicTi
me) OVERRIDE { } | 50 virtual void notifyAnimationStarted(const GraphicsLayer*, double monotonicTi
me) OVERRIDE { } |
52 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsL
ayerPaintingPhase, const IntRect& inClip) OVERRIDE { } | 51 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsL
ayerPaintingPhase, const IntRect& inClip) OVERRIDE { } |
53 virtual String debugName(const GraphicsLayer*) OVERRIDE { return String(); } | 52 virtual String debugName(const GraphicsLayer*) OVERRIDE { return String(); } |
54 }; | 53 }; |
55 | 54 |
56 class GraphicsLayerForTesting : public GraphicsLayer { | 55 class GraphicsLayerForTesting : public GraphicsLayer { |
57 public: | 56 public: |
58 explicit GraphicsLayerForTesting(GraphicsLayerClient* client) | 57 explicit GraphicsLayerForTesting(GraphicsLayerClient* client) |
59 : GraphicsLayer(client) { }; | 58 : GraphicsLayer(client) { }; |
60 | 59 |
61 virtual blink::WebLayer* contentsLayer() const { return GraphicsLayer::conte
ntsLayer(); } | 60 virtual WebLayer* contentsLayer() const { return GraphicsLayer::contentsLaye
r(); } |
62 }; | 61 }; |
63 | 62 |
64 class GraphicsLayerTest : public testing::Test { | 63 class GraphicsLayerTest : public testing::Test { |
65 public: | 64 public: |
66 GraphicsLayerTest() | 65 GraphicsLayerTest() |
67 { | 66 { |
68 m_clipLayer = adoptPtr(new GraphicsLayerForTesting(&m_client)); | 67 m_clipLayer = adoptPtr(new GraphicsLayerForTesting(&m_client)); |
69 m_graphicsLayer = adoptPtr(new GraphicsLayerForTesting(&m_client)); | 68 m_graphicsLayer = adoptPtr(new GraphicsLayerForTesting(&m_client)); |
70 m_clipLayer->addChild(m_graphicsLayer.get()); | 69 m_clipLayer->addChild(m_graphicsLayer.get()); |
71 m_graphicsLayer->platformLayer()->setScrollClipLayer( | 70 m_graphicsLayer->platformLayer()->setScrollClipLayer( |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 m_graphicsLayer->setScrollableArea(&scrollableArea, false); | 158 m_graphicsLayer->setScrollableArea(&scrollableArea, false); |
160 | 159 |
161 WebPoint scrollPosition(7, 9); | 160 WebPoint scrollPosition(7, 9); |
162 m_platformLayer->setScrollPosition(scrollPosition); | 161 m_platformLayer->setScrollPosition(scrollPosition); |
163 m_graphicsLayer->didScroll(); | 162 m_graphicsLayer->didScroll(); |
164 | 163 |
165 EXPECT_EQ(scrollPosition, WebPoint(scrollableArea.scrollPosition())); | 164 EXPECT_EQ(scrollPosition, WebPoint(scrollableArea.scrollPosition())); |
166 } | 165 } |
167 | 166 |
168 } // namespace | 167 } // namespace |
OLD | NEW |