Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / test / web_layer_tree_view_impl_for_testing.cc
index 8c83e22..c8dd325 100644 (file)
@@ -8,12 +8,12 @@
 #include "base/strings/string_number_conversions.h"
 #include "base/synchronization/lock.h"
 #include "cc/base/switches.h"
+#include "cc/blink/web_layer_impl.h"
 #include "cc/input/input_handler.h"
 #include "cc/layers/layer.h"
 #include "cc/output/output_surface.h"
 #include "cc/test/test_context_provider.h"
 #include "cc/trees/layer_tree_host.h"
-#include "content/test/test_context_provider_factory.h"
 #include "content/test/test_webkit_platform_support.h"
 #include "third_party/WebKit/public/platform/Platform.h"
 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
 #include "third_party/WebKit/public/platform/WebLayerTreeView.h"
 #include "third_party/WebKit/public/platform/WebSize.h"
 #include "ui/gfx/frame_time.h"
-#include "webkit/renderer/compositor_bindings/web_layer_impl.h"
 
 using blink::WebColor;
 using blink::WebGraphicsContext3D;
 using blink::WebRect;
 using blink::WebSize;
-using webkit::WebLayerImpl;
 
 namespace content {
 
@@ -44,8 +42,8 @@ void WebLayerTreeViewImplForTesting::Initialize() {
 
   // Accelerated animations are enabled for unit tests.
   settings.accelerated_animation_enabled = true;
-  layer_tree_host_ =
-      cc::LayerTreeHost::CreateSingleThreaded(this, this, NULL, settings);
+  layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded(
+      this, this, NULL, settings, base::MessageLoopProxy::current());
   DCHECK(layer_tree_host_);
 }
 
@@ -56,7 +54,7 @@ void WebLayerTreeViewImplForTesting::setSurfaceReady() {
 void WebLayerTreeViewImplForTesting::setRootLayer(
     const blink::WebLayer& root) {
   layer_tree_host_->SetRootLayer(
-      static_cast<const WebLayerImpl*>(&root)->layer());
+      static_cast<const cc_blink::WebLayerImpl*>(&root)->layer());
 }
 
 void WebLayerTreeViewImplForTesting::clearRootLayer() {
@@ -69,6 +67,11 @@ void WebLayerTreeViewImplForTesting::setViewportSize(
   layer_tree_host_->SetViewportSize(device_viewport_size);
 }
 
+void WebLayerTreeViewImplForTesting::setViewportSize(
+    const WebSize& device_viewport_size) {
+  layer_tree_host_->SetViewportSize(device_viewport_size);
+}
+
 WebSize WebLayerTreeViewImplForTesting::layoutViewportSize() const {
   return layer_tree_host_->device_viewport_size();
 }
@@ -123,12 +126,6 @@ bool WebLayerTreeViewImplForTesting::commitRequested() const {
 
 void WebLayerTreeViewImplForTesting::didStopFlinging() {}
 
-bool WebLayerTreeViewImplForTesting::compositeAndReadback(
-    void* pixels, const WebRect& rect_in_device_viewport) {
-  return layer_tree_host_->CompositeAndReadback(pixels,
-                                                rect_in_device_viewport);
-}
-
 void WebLayerTreeViewImplForTesting::finishAllRendering() {
   layer_tree_host_->FinishAllRendering();
 }
@@ -140,21 +137,15 @@ void WebLayerTreeViewImplForTesting::setDeferCommits(bool defer_commits) {
 void WebLayerTreeViewImplForTesting::Layout() {
 }
 
-void WebLayerTreeViewImplForTesting::ApplyScrollAndScale(
+void WebLayerTreeViewImplForTesting::ApplyViewportDeltas(
     const gfx::Vector2d& scroll_delta,
-    float page_scale) {}
+    float page_scale,
+    float top_controls_delta) {}
 
-scoped_ptr<cc::OutputSurface>
-WebLayerTreeViewImplForTesting::CreateOutputSurface(bool fallback) {
-  return make_scoped_ptr(
-      new cc::OutputSurface(cc::TestContextProvider::Create()));
-}
-
-scoped_refptr<cc::ContextProvider>
-WebLayerTreeViewImplForTesting::OffscreenContextProvider() {
-  // Unit tests only run in single threaded mode.
-  return content::TestContextProviderFactory::GetInstance()->
-      OffscreenContextProviderForMainThread();
+void WebLayerTreeViewImplForTesting::RequestNewOutputSurface(
+    bool fallback) {
+  layer_tree_host_->SetOutputSurface(make_scoped_ptr(
+      new cc::OutputSurface(cc::TestContextProvider::Create())));
 }
 
 void WebLayerTreeViewImplForTesting::registerViewportLayers(
@@ -162,13 +153,14 @@ void WebLayerTreeViewImplForTesting::registerViewportLayers(
     const blink::WebLayer* innerViewportScrollLayer,
     const blink::WebLayer* outerViewportScrollLayer) {
   layer_tree_host_->RegisterViewportLayers(
-      static_cast<const WebLayerImpl*>(pageScaleLayer)->layer(),
-      static_cast<const WebLayerImpl*>(innerViewportScrollLayer)->layer(),
+      static_cast<const cc_blink::WebLayerImpl*>(pageScaleLayer)->layer(),
+      static_cast<const cc_blink::WebLayerImpl*>(innerViewportScrollLayer)
+          ->layer(),
       // The outer viewport layer will only exist when using pinch virtual
       // viewports.
-      outerViewportScrollLayer
-          ? static_cast<const WebLayerImpl*>(outerViewportScrollLayer)->layer()
-          : NULL);
+      outerViewportScrollLayer ? static_cast<const cc_blink::WebLayerImpl*>(
+                                     outerViewportScrollLayer)->layer()
+                               : NULL);
 }
 
 void WebLayerTreeViewImplForTesting::clearViewportLayers() {
@@ -177,4 +169,12 @@ void WebLayerTreeViewImplForTesting::clearViewportLayers() {
                                            scoped_refptr<cc::Layer>());
 }
 
+void WebLayerTreeViewImplForTesting::registerSelection(
+    const blink::WebSelectionBound& start,
+    const blink::WebSelectionBound& end) {
+}
+
+void WebLayerTreeViewImplForTesting::clearSelection() {
+}
+
 }  // namespace content