Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / cc / layers / scrollbar_layer_unittest.cc
index 56d525a..25fa708 100644 (file)
@@ -139,7 +139,7 @@ TEST(PaintedScrollbarLayerTest, ScrollOffsetSynchronization) {
   // Choose bounds to give max_scroll_offset = (30, 50).
   layer_tree_root->SetBounds(gfx::Size(70, 150));
   scroll_layer->SetScrollClipLayerId(layer_tree_root->id());
-  scroll_layer->SetScrollOffset(gfx::Vector2d(10, 20));
+  scroll_layer->SetScrollOffset(gfx::ScrollOffset(10, 20));
   scroll_layer->SetBounds(gfx::Size(100, 200));
   content_layer->SetBounds(gfx::Size(100, 200));
 
@@ -165,7 +165,7 @@ TEST(PaintedScrollbarLayerTest, ScrollOffsetSynchronization) {
   layer_tree_root->SetBounds(gfx::Size(700, 1500));
   layer_tree_root->SavePaintProperties();
   scroll_layer->SetBounds(gfx::Size(1000, 2000));
-  scroll_layer->SetScrollOffset(gfx::Vector2d(100, 200));
+  scroll_layer->SetScrollOffset(gfx::ScrollOffset(100, 200));
   scroll_layer->SavePaintProperties();
   content_layer->SetBounds(gfx::Size(1000, 2000));
   content_layer->SavePaintProperties();
@@ -193,7 +193,7 @@ TEST(PaintedScrollbarLayerTest, ScrollOffsetSynchronization) {
     root_layer_impl = root_clip_layer_impl->children()[0];          \
     scrollbar_layer_impl = static_cast<PaintedScrollbarLayerImpl*>( \
         root_layer_impl->children()[1]);                            \
-    scrollbar_layer_impl->ScrollbarParametersDidChange();           \
+    scrollbar_layer_impl->ScrollbarParametersDidChange(false);      \
   } while (false)
 
 TEST(ScrollbarLayerTest, UpdatePropertiesOfScrollBarWhenThumbRemoved) {
@@ -216,7 +216,7 @@ TEST(ScrollbarLayerTest, UpdatePropertiesOfScrollBarWhenThumbRemoved) {
   root_layer->AddChild(content_layer);
   root_layer->AddChild(scrollbar_layer);
 
-  root_layer->SetScrollOffset(gfx::Vector2d(0, 0));
+  root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0));
   scrollbar_layer->SetBounds(gfx::Size(70, 10));
   scrollbar_layer->SetScrollLayer(root_layer->id());
   scrollbar_layer->SetClipLayer(root_clip_layer->id());
@@ -226,9 +226,9 @@ TEST(ScrollbarLayerTest, UpdatePropertiesOfScrollBarWhenThumbRemoved) {
   scrollbar_layer->fake_scrollbar()->set_thumb_length(4);
 
   scrollbar_layer->UpdateThumbAndTrackGeometry();
-  LayerImpl* root_clip_layer_impl = NULL;
-  LayerImpl* root_layer_impl = NULL;
-  PaintedScrollbarLayerImpl* scrollbar_layer_impl = NULL;
+  LayerImpl* root_clip_layer_impl = nullptr;
+  LayerImpl* root_layer_impl = nullptr;
+  PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr;
 
   UPDATE_AND_EXTRACT_LAYER_POINTERS();
   EXPECT_EQ(gfx::Rect(10, 0, 4, 10).ToString(),
@@ -261,7 +261,7 @@ TEST(ScrollbarLayerTest, ThumbRect) {
   root_layer->AddChild(content_layer);
   root_layer->AddChild(scrollbar_layer);
 
-  root_layer->SetScrollOffset(gfx::Vector2d(0, 0));
+  root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0));
   scrollbar_layer->SetBounds(gfx::Size(70, 10));
   scrollbar_layer->SetScrollLayer(root_layer->id());
   scrollbar_layer->SetClipLayer(root_clip_layer->id());
@@ -270,9 +270,9 @@ TEST(ScrollbarLayerTest, ThumbRect) {
   scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10);
   scrollbar_layer->fake_scrollbar()->set_thumb_length(4);
   scrollbar_layer->UpdateThumbAndTrackGeometry();
-  LayerImpl* root_clip_layer_impl = NULL;
-  LayerImpl* root_layer_impl = NULL;
-  PaintedScrollbarLayerImpl* scrollbar_layer_impl = NULL;
+  LayerImpl* root_clip_layer_impl = nullptr;
+  LayerImpl* root_layer_impl = nullptr;
+  PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr;
 
   // Thumb is at the edge of the scrollbar (should be inset to
   // the start of the track within the scrollbar layer's
@@ -282,14 +282,14 @@ TEST(ScrollbarLayerTest, ThumbRect) {
             scrollbar_layer_impl->ComputeThumbQuadRect().ToString());
 
   // Under-scroll (thumb position should clamp and be unchanged).
-  root_layer->SetScrollOffset(gfx::Vector2d(-5, 0));
+  root_layer->SetScrollOffset(gfx::ScrollOffset(-5, 0));
 
   UPDATE_AND_EXTRACT_LAYER_POINTERS();
   EXPECT_EQ(gfx::Rect(10, 0, 4, 10).ToString(),
             scrollbar_layer_impl->ComputeThumbQuadRect().ToString());
 
   // Over-scroll (thumb position should clamp on the far side).
-  root_layer->SetScrollOffset(gfx::Vector2d(85, 0));
+  root_layer->SetScrollOffset(gfx::ScrollOffset(85, 0));
 
   UPDATE_AND_EXTRACT_LAYER_POINTERS();
   EXPECT_EQ(gfx::Rect(56, 0, 4, 10).ToString(),
@@ -345,11 +345,9 @@ TEST(ScrollbarLayerTest, SolidColorDrawQuads) {
 
   // Thickness should be overridden to 3.
   {
-    MockOcclusionTracker<LayerImpl> occlusion_tracker;
     scoped_ptr<RenderPass> render_pass = RenderPass::Create();
     AppendQuadsData data;
-    scrollbar_layer_impl->AppendQuads(
-        render_pass.get(), occlusion_tracker, &data);
+    scrollbar_layer_impl->AppendQuads(render_pass.get(), Occlusion(), &data);
 
     const QuadList& quads = render_pass->quad_list;
     ASSERT_EQ(1u, quads.size());
@@ -361,11 +359,9 @@ TEST(ScrollbarLayerTest, SolidColorDrawQuads) {
   scrollbar_layer_impl->draw_properties().contents_scale_x = 2.f;
   scrollbar_layer_impl->draw_properties().contents_scale_y = 2.f;
   {
-    MockOcclusionTracker<LayerImpl> occlusion_tracker;
     scoped_ptr<RenderPass> render_pass = RenderPass::Create();
     AppendQuadsData data;
-    scrollbar_layer_impl->AppendQuads(
-        render_pass.get(), occlusion_tracker, &data);
+    scrollbar_layer_impl->AppendQuads(render_pass.get(), Occlusion(), &data);
 
     const QuadList& quads = render_pass->quad_list;
     ASSERT_EQ(1u, quads.size());
@@ -379,11 +375,9 @@ TEST(ScrollbarLayerTest, SolidColorDrawQuads) {
   // current viewport state.
   scrollbar_layer_impl->SetVisibleToTotalLengthRatio(0.2f);
   {
-    MockOcclusionTracker<LayerImpl> occlusion_tracker;
     scoped_ptr<RenderPass> render_pass = RenderPass::Create();
     AppendQuadsData data;
-    scrollbar_layer_impl->AppendQuads(
-        render_pass.get(), occlusion_tracker, &data);
+    scrollbar_layer_impl->AppendQuads(render_pass.get(), Occlusion(), &data);
 
     const QuadList& quads = render_pass->quad_list;
     ASSERT_EQ(1u, quads.size());
@@ -395,11 +389,9 @@ TEST(ScrollbarLayerTest, SolidColorDrawQuads) {
   scrollbar_layer_impl->SetCurrentPos(0.f);
   scrollbar_layer_impl->SetMaximum(0);
   {
-    MockOcclusionTracker<LayerImpl> occlusion_tracker;
     scoped_ptr<RenderPass> render_pass = RenderPass::Create();
     AppendQuadsData data;
-    scrollbar_layer_impl->AppendQuads(
-        render_pass.get(), occlusion_tracker, &data);
+    scrollbar_layer_impl->AppendQuads(render_pass.get(), Occlusion(), &data);
 
     const QuadList& quads = render_pass->quad_list;
     ASSERT_EQ(1u, quads.size());
@@ -455,12 +447,10 @@ TEST(ScrollbarLayerTest, LayerDrivenSolidColorDrawQuads) {
   scrollbar_layer_impl->SetMaximum(8);
 
   {
-    MockOcclusionTracker<LayerImpl> occlusion_tracker;
     scoped_ptr<RenderPass> render_pass = RenderPass::Create();
 
     AppendQuadsData data;
-    scrollbar_layer_impl->AppendQuads(
-        render_pass.get(), occlusion_tracker, &data);
+    scrollbar_layer_impl->AppendQuads(render_pass.get(), Occlusion(), &data);
 
     const QuadList& quads = render_pass->quad_list;
     ASSERT_EQ(1u, quads.size());
@@ -578,7 +568,7 @@ class ScrollbarLayerTestMaxTextureSize : public LayerTreeTest {
 
   void SetScrollbarBounds(const gfx::Size& bounds) { bounds_ = bounds; }
 
-  virtual void BeginTest() OVERRIDE {
+  void BeginTest() override {
     scroll_layer_ = Layer::Create();
     layer_tree_host()->root_layer()->AddChild(scroll_layer_);
 
@@ -593,7 +583,7 @@ class ScrollbarLayerTestMaxTextureSize : public LayerTreeTest {
     PostSetNeedsCommitToMainThread();
   }
 
-  virtual void DidCommitAndDrawFrame() OVERRIDE {
+  void DidCommitAndDrawFrame() override {
     const int kMaxTextureSize =
         layer_tree_host()->GetRendererCapabilities().max_texture_size;
 
@@ -608,7 +598,7 @@ class ScrollbarLayerTestMaxTextureSize : public LayerTreeTest {
     EndTest();
   }
 
-  virtual void AfterTest() OVERRIDE {}
+  void AfterTest() override {}
 
  private:
   scoped_refptr<PaintedScrollbarLayer> scrollbar_layer_;
@@ -638,14 +628,14 @@ class FakeLayerTreeHost : public LayerTreeHost {
  public:
   FakeLayerTreeHost(FakeLayerTreeHostClient* client,
                     const LayerTreeSettings& settings)
-      : LayerTreeHost(client, NULL, settings),
+      : LayerTreeHost(client, nullptr, nullptr, settings),
         next_id_(1),
         total_ui_resource_created_(0),
         total_ui_resource_deleted_(0) {
     InitializeSingleThreaded(client, base::MessageLoopProxy::current());
   }
 
-  virtual UIResourceId CreateUIResource(UIResourceClient* content) OVERRIDE {
+  UIResourceId CreateUIResource(UIResourceClient* content) override {
     total_ui_resource_created_++;
     UIResourceId nid = next_id_++;
     ui_resource_bitmap_map_.insert(
@@ -654,7 +644,7 @@ class FakeLayerTreeHost : public LayerTreeHost {
   }
 
   // Deletes a UI resource.  May safely be called more than once.
-  virtual void DeleteUIResource(UIResourceId id) OVERRIDE {
+  void DeleteUIResource(UIResourceId id) override {
     UIResourceBitmapMap::iterator iter = ui_resource_bitmap_map_.find(id);
     if (iter != ui_resource_bitmap_map_.end()) {
       ui_resource_bitmap_map_.erase(iter);
@@ -677,7 +667,7 @@ class FakeLayerTreeHost : public LayerTreeHost {
     UIResourceBitmapMap::iterator iter = ui_resource_bitmap_map_.find(id);
     if (iter != ui_resource_bitmap_map_.end())
       return &iter->second;
-    return NULL;
+    return nullptr;
   }
 
  private:
@@ -728,7 +718,7 @@ class ScrollbarLayerTestResourceCreationAndRelease : public testing::Test {
 
     scrollbar_layer->SetIsDrawable(true);
     scrollbar_layer->SetBounds(gfx::Size(100, 100));
-    layer_tree_root->SetScrollOffset(gfx::Vector2d(10, 20));
+    layer_tree_root->SetScrollOffset(gfx::ScrollOffset(10, 20));
     layer_tree_root->SetBounds(gfx::Size(100, 200));
     content_layer->SetBounds(gfx::Size(100, 200));
     scrollbar_layer->draw_properties().content_bounds = gfx::Size(100, 200);