Get foreground tab on Android
[chromium-blink-merge.git] / content / test / web_layer_tree_view_impl_for_testing.h
blob8adc5593c6c2a03995cbff023f25b2a6979bdd1b
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"
13 namespace cc {
14 class LayerTreeHost;
17 namespace blink { class WebLayer; }
19 namespace webkit {
21 class WebLayerTreeViewImplForTesting
22 : public blink::WebLayerTreeView,
23 public cc::LayerTreeHostClient,
24 public cc::LayerTreeHostSingleThreadClient {
25 public:
26 WebLayerTreeViewImplForTesting();
27 virtual ~WebLayerTreeViewImplForTesting();
29 bool Initialize();
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 blink::WebSize layoutViewportSize() const;
38 virtual blink::WebSize deviceViewportSize() const;
39 virtual void setDeviceScaleFactor(float scale_factor);
40 virtual float deviceScaleFactor() const;
41 virtual void setBackgroundColor(blink::WebColor);
42 virtual void setHasTransparentBackground(bool transparent);
43 virtual void setVisible(bool visible);
44 virtual void setPageScaleFactorAndLimits(float page_scale_factor,
45 float minimum,
46 float maximum);
47 virtual void startPageScaleAnimation(const blink::WebPoint& destination,
48 bool use_anchor,
49 float new_page_scale,
50 double duration_sec);
51 virtual void setNeedsAnimate();
52 // Merged into setNeedsAnimate. Staged for removal.
53 virtual void setNeedsRedraw();
54 virtual bool commitRequested() const;
55 virtual void composite();
56 virtual void didStopFlinging();
57 virtual bool compositeAndReadback(void* pixels, const blink::WebRect& rect);
58 virtual void finishAllRendering();
59 virtual void setDeferCommits(bool defer_commits);
60 virtual void renderingStats(
61 blink::WebRenderingStats& stats) const; // NOLINT(runtime/references)
63 // cc::LayerTreeHostClient implementation.
64 virtual void WillBeginMainFrame(int frame_id) OVERRIDE {}
65 virtual void DidBeginMainFrame() OVERRIDE {}
66 virtual void Animate(double frame_begin_time) OVERRIDE {}
67 virtual void Layout() OVERRIDE;
68 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, float page_scale)
69 OVERRIDE;
70 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback)
71 OVERRIDE;
72 virtual void DidInitializeOutputSurface(bool success) OVERRIDE {}
73 virtual void WillCommit() OVERRIDE {}
74 virtual void DidCommit() OVERRIDE {}
75 virtual void DidCommitAndDrawFrame() OVERRIDE {}
76 virtual void DidCompleteSwapBuffers() OVERRIDE {}
77 virtual scoped_refptr<cc::ContextProvider>
78 OffscreenContextProvider() OVERRIDE;
80 // cc::LayerTreeHostSingleThreadClient implementation.
81 virtual void ScheduleComposite() OVERRIDE {}
82 virtual void ScheduleAnimation() OVERRIDE {}
83 virtual void DidPostSwapBuffers() OVERRIDE {}
84 virtual void DidAbortSwapBuffers() OVERRIDE {}
86 private:
87 scoped_ptr<cc::LayerTreeHost> layer_tree_host_;
89 DISALLOW_COPY_AND_ASSIGN(WebLayerTreeViewImplForTesting);
92 } // namespace webkit
94 #endif // CONTENT_TEST_WEB_LAYER_TREE_VIEW_IMPL_FOR_TESTING_H_