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/test/test_task_graph_runner.h"
10 #include "cc/trees/layer_tree_host_client.h"
11 #include "cc/trees/layer_tree_host_single_thread_client.h"
12 #include "third_party/WebKit/public/platform/WebLayerTreeView.h"
18 namespace blink
{ class WebLayer
; }
22 class WebLayerTreeViewImplForTesting
23 : public blink::WebLayerTreeView
,
24 public cc::LayerTreeHostClient
,
25 public cc::LayerTreeHostSingleThreadClient
{
27 WebLayerTreeViewImplForTesting();
28 virtual ~WebLayerTreeViewImplForTesting();
32 // blink::WebLayerTreeView implementation.
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 void setDeviceScaleFactor(float scale_factor
);
39 virtual float deviceScaleFactor() const;
40 virtual void setBackgroundColor(blink::WebColor
);
41 virtual void setHasTransparentBackground(bool transparent
);
42 virtual void setVisible(bool visible
);
43 virtual void setPageScaleFactorAndLimits(float page_scale_factor
,
46 virtual void startPageScaleAnimation(const blink::WebPoint
& destination
,
50 virtual void setNeedsAnimate();
51 virtual void didStopFlinging();
52 virtual void setDeferCommits(bool defer_commits
);
53 virtual void registerForAnimations(blink::WebLayer
* layer
);
54 virtual void registerViewportLayers(
55 const blink::WebLayer
* overscrollElasticityLayer
,
56 const blink::WebLayer
* pageScaleLayerLayer
,
57 const blink::WebLayer
* innerViewportScrollLayer
,
58 const blink::WebLayer
* outerViewportScrollLayer
) override
;
59 virtual void clearViewportLayers() override
;
60 virtual void registerSelection(const blink::WebSelection
& selection
) override
;
61 virtual void clearSelection() override
;
63 // cc::LayerTreeHostClient implementation.
64 void WillBeginMainFrame() override
{}
65 void DidBeginMainFrame() override
{}
66 void BeginMainFrame(const cc::BeginFrameArgs
& args
) override
{}
67 void BeginMainFrameNotExpectedSoon() override
{}
68 void Layout() override
;
69 void ApplyViewportDeltas(const gfx::Vector2dF
& inner_delta
,
70 const gfx::Vector2dF
& outer_delta
,
71 const gfx::Vector2dF
& elastic_overscroll_delta
,
73 float top_controls_delta
) override
;
74 void RequestNewOutputSurface() override
;
75 void DidInitializeOutputSurface() override
{}
76 void DidFailToInitializeOutputSurface() override
;
77 void WillCommit() override
{}
78 void DidCommit() override
{}
79 void DidCommitAndDrawFrame() override
{}
80 void DidCompleteSwapBuffers() override
{}
81 void DidCompletePageScaleAnimation() override
{}
82 void RecordFrameTimingEvents(
83 scoped_ptr
<cc::FrameTimingTracker::CompositeTimingSet
> composite_events
,
84 scoped_ptr
<cc::FrameTimingTracker::MainFrameTimingSet
> main_frame_events
)
87 // cc::LayerTreeHostSingleThreadClient implementation.
88 void DidPostSwapBuffers() override
{}
89 void DidAbortSwapBuffers() override
{}
92 cc::TestTaskGraphRunner task_graph_runner_
;
93 scoped_ptr
<cc::LayerTreeHost
> layer_tree_host_
;
95 DISALLOW_COPY_AND_ASSIGN(WebLayerTreeViewImplForTesting
);
98 } // namespace content
100 #endif // CONTENT_TEST_WEB_LAYER_TREE_VIEW_IMPL_FOR_TESTING_H_