Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: cc/trees/layer_tree_host_unittest_scroll.cc

Issue 1052773002: cc: Add a rails argument to InputHandler::ScrollBy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comiple Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "cc/layers/layer.h" 8 #include "cc/layers/layer.h"
9 #include "cc/layers/layer_impl.h" 9 #include "cc/layers/layer_impl.h"
10 #include "cc/layers/picture_layer.h" 10 #include "cc/layers/picture_layer.h"
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 // Ensure device scale factor matches the active tree. 586 // Ensure device scale factor matches the active tree.
587 EXPECT_EQ(device_scale_factor_, impl->active_tree()->device_scale_factor()); 587 EXPECT_EQ(device_scale_factor_, impl->active_tree()->device_scale_factor());
588 switch (impl->active_tree()->source_frame_number()) { 588 switch (impl->active_tree()->source_frame_number()) {
589 case 0: { 589 case 0: {
590 // GESTURE scroll on impl thread. 590 // GESTURE scroll on impl thread.
591 InputHandler::ScrollStatus status = impl->ScrollBegin( 591 InputHandler::ScrollStatus status = impl->ScrollBegin(
592 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() - 592 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() -
593 gfx::Vector2dF(0.5f, 0.5f)), 593 gfx::Vector2dF(0.5f, 0.5f)),
594 InputHandler::GESTURE); 594 InputHandler::GESTURE);
595 EXPECT_EQ(InputHandler::SCROLL_STARTED, status); 595 EXPECT_EQ(InputHandler::SCROLL_STARTED, status);
596 impl->ScrollBy(gfx::Point(), scroll_amount_); 596 impl->ScrollBy(gfx::Point(), scroll_amount_,
597 InputHandler::RAILS_MODE_FREE);
597 impl->ScrollEnd(); 598 impl->ScrollEnd();
598 599
599 // Check the scroll is applied as a delta. 600 // Check the scroll is applied as a delta.
600 EXPECT_VECTOR_EQ(initial_offset_, 601 EXPECT_VECTOR_EQ(initial_offset_,
601 expected_scroll_layer_impl->BaseScrollOffset()); 602 expected_scroll_layer_impl->BaseScrollOffset());
602 EXPECT_VECTOR_EQ(scroll_amount_, 603 EXPECT_VECTOR_EQ(scroll_amount_,
603 expected_scroll_layer_impl->ScrollDelta()); 604 expected_scroll_layer_impl->ScrollDelta());
604 break; 605 break;
605 } 606 }
606 case 1: { 607 case 1: {
607 // WHEEL scroll on impl thread. 608 // WHEEL scroll on impl thread.
608 InputHandler::ScrollStatus status = impl->ScrollBegin( 609 InputHandler::ScrollStatus status = impl->ScrollBegin(
609 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() + 610 gfx::ToCeiledPoint(expected_scroll_layer_impl->position() +
610 gfx::Vector2dF(0.5f, 0.5f)), 611 gfx::Vector2dF(0.5f, 0.5f)),
611 InputHandler::WHEEL); 612 InputHandler::WHEEL);
612 EXPECT_EQ(InputHandler::SCROLL_STARTED, status); 613 EXPECT_EQ(InputHandler::SCROLL_STARTED, status);
613 impl->ScrollBy(gfx::Point(), scroll_amount_); 614 impl->ScrollBy(gfx::Point(), scroll_amount_,
615 InputHandler::RAILS_MODE_FREE);
614 impl->ScrollEnd(); 616 impl->ScrollEnd();
615 617
616 // Check the scroll is applied as a delta. 618 // Check the scroll is applied as a delta.
617 EXPECT_VECTOR_EQ(javascript_scroll_, 619 EXPECT_VECTOR_EQ(javascript_scroll_,
618 expected_scroll_layer_impl->BaseScrollOffset()); 620 expected_scroll_layer_impl->BaseScrollOffset());
619 EXPECT_VECTOR_EQ(scroll_amount_, 621 EXPECT_VECTOR_EQ(scroll_amount_,
620 expected_scroll_layer_impl->ScrollDelta()); 622 expected_scroll_layer_impl->ScrollDelta());
621 break; 623 break;
622 } 624 }
623 case 2: 625 case 2:
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 RunTest(true, false, true); 1232 RunTest(true, false, true);
1231 } 1233 }
1232 1234
1233 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { 1235 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) {
1234 scroll_destroy_whole_tree_ = true; 1236 scroll_destroy_whole_tree_ = true;
1235 RunTest(true, false, true); 1237 RunTest(true, false, true);
1236 } 1238 }
1237 1239
1238 } // namespace 1240 } // namespace
1239 } // namespace cc 1241 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | content/renderer/input/input_handler_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698