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
3 // found in the LICENSE file.
5 #ifndef CONTENT_TEST_WEB_LAYER_TREE_VIEW_IMPL_FOR_TESTING_H_
6 #define CONTENT_TEST_WEB_LAYER_TREE_VIEW_IMPL_FOR_TESTING_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/trees/layer_tree_host_client.h"
10 #include "cc/trees/layer_tree_host_single_thread_client.h"
11 #include "third_party/WebKit/public/platform/WebLayerTreeView.h"
17 namespace blink
{ class WebLayer
; }
21 class WebLayerTreeViewImplForTesting
22 : public blink::WebLayerTreeView
,
23 public cc::LayerTreeHostClient
,
24 public cc::LayerTreeHostSingleThreadClient
{
26 WebLayerTreeViewImplForTesting();
27 virtual ~WebLayerTreeViewImplForTesting();
31 // blink::WebLayerTreeView implementation.
32 virtual void setSurfaceReady();
33 virtual void setRootLayer(const blink::WebLayer
& layer
);
34 virtual void clearRootLayer();
35 virtual void setViewportSize(const blink::WebSize
& unused_deprecated
,
36 const blink::WebSize
& device_viewport_size
);
37 virtual void setViewportSize(const blink::WebSize
& device_viewport_size
);
38 virtual blink::WebSize
layoutViewportSize() const;
39 virtual blink::WebSize
deviceViewportSize() const;
40 virtual void setDeviceScaleFactor(float scale_factor
);
41 virtual float deviceScaleFactor() const;
42 virtual void setBackgroundColor(blink::WebColor
);
43 virtual void setHasTransparentBackground(bool transparent
);
44 virtual void setVisible(bool visible
);
45 virtual void setPageScaleFactorAndLimits(float page_scale_factor
,
48 virtual void startPageScaleAnimation(const blink::WebPoint
& destination
,
52 virtual void setNeedsAnimate();
53 virtual bool commitRequested() const;
54 virtual void didStopFlinging();
55 virtual void finishAllRendering();
56 virtual void setDeferCommits(bool defer_commits
);
57 virtual void registerViewportLayers(
58 const blink::WebLayer
* pageScaleLayerLayer
,
59 const blink::WebLayer
* innerViewportScrollLayer
,
60 const blink::WebLayer
* outerViewportScrollLayer
) OVERRIDE
;
61 virtual void clearViewportLayers() OVERRIDE
;
62 virtual void registerSelection(
63 const blink::WebSelectionBound
& start
,
64 const blink::WebSelectionBound
& end
) OVERRIDE
;
65 virtual void clearSelection() OVERRIDE
;
67 // cc::LayerTreeHostClient implementation.
68 virtual void WillBeginMainFrame(int frame_id
) OVERRIDE
{}
69 virtual void DidBeginMainFrame() OVERRIDE
{}
70 virtual void BeginMainFrame(const cc::BeginFrameArgs
& args
) OVERRIDE
{}
71 virtual void Layout() OVERRIDE
;
72 virtual void ApplyViewportDeltas(const gfx::Vector2d
& inner_delta
,
73 const gfx::Vector2d
& outer_delta
,
75 float top_controls_delta
) OVERRIDE
;
76 virtual void ApplyViewportDeltas(const gfx::Vector2d
& scroll_delta
,
78 float top_controls_delta
) OVERRIDE
;
79 virtual void RequestNewOutputSurface(bool fallback
) OVERRIDE
;
80 virtual void DidInitializeOutputSurface() OVERRIDE
{}
81 virtual void WillCommit() OVERRIDE
{}
82 virtual void DidCommit() OVERRIDE
{}
83 virtual void DidCommitAndDrawFrame() OVERRIDE
{}
84 virtual void DidCompleteSwapBuffers() OVERRIDE
{}
86 // cc::LayerTreeHostSingleThreadClient implementation.
87 virtual void DidPostSwapBuffers() OVERRIDE
{}
88 virtual void DidAbortSwapBuffers() OVERRIDE
{}
91 scoped_ptr
<cc::LayerTreeHost
> layer_tree_host_
;
93 DISALLOW_COPY_AND_ASSIGN(WebLayerTreeViewImplForTesting
);
96 } // namespace content
98 #endif // CONTENT_TEST_WEB_LAYER_TREE_VIEW_IMPL_FOR_TESTING_H_