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

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

Issue 1604053002: cc: Fix enum style conformance in InputHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enumname: fixcasts Created 4 years, 11 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/location.h" 7 #include "base/location.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
11 #include "cc/input/main_thread_scrolling_reason.h"
11 #include "cc/layers/layer.h" 12 #include "cc/layers/layer.h"
12 #include "cc/layers/layer_impl.h" 13 #include "cc/layers/layer_impl.h"
13 #include "cc/layers/picture_layer.h" 14 #include "cc/layers/picture_layer.h"
14 #include "cc/scheduler/begin_frame_source.h" 15 #include "cc/scheduler/begin_frame_source.h"
15 #include "cc/test/fake_content_layer_client.h" 16 #include "cc/test/fake_content_layer_client.h"
16 #include "cc/test/fake_layer_tree_host_client.h" 17 #include "cc/test/fake_layer_tree_host_client.h"
17 #include "cc/test/fake_picture_layer.h" 18 #include "cc/test/fake_picture_layer.h"
18 #include "cc/test/fake_picture_layer_impl.h" 19 #include "cc/test/fake_picture_layer_impl.h"
19 #include "cc/test/geometry_test_utils.h" 20 #include "cc/test/geometry_test_utils.h"
20 #include "cc/test/layer_tree_test.h" 21 #include "cc/test/layer_tree_test.h"
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 scroll_layer->SetScrollClipLayer(root->children()[0]->id()); 1033 scroll_layer->SetScrollClipLayer(root->children()[0]->id());
1033 1034
1034 // Set max_scroll_offset = (100, 100). 1035 // Set max_scroll_offset = (100, 100).
1035 scroll_layer->SetBounds( 1036 scroll_layer->SetBounds(
1036 gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100)); 1037 gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100));
1037 1038
1038 InputHandler::ScrollStatus status = scroll_layer->TryScroll( 1039 InputHandler::ScrollStatus status = scroll_layer->TryScroll(
1039 gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE, SCROLL_BLOCKS_ON_NONE); 1040 gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE, SCROLL_BLOCKS_ON_NONE);
1040 1041
1041 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 1042 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
1042 EXPECT_EQ(InputHandler::NOT_SCROLLING_ON_MAIN, 1043 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
1043 status.main_thread_scrolling_reasons); 1044 status.main_thread_scrolling_reasons);
1044 1045
1045 // Set max_scroll_offset = (0, 0). 1046 // Set max_scroll_offset = (0, 0).
1046 scroll_layer->SetBounds(root->bounds()); 1047 scroll_layer->SetBounds(root->bounds());
1047 status = scroll_layer->TryScroll( 1048 status = scroll_layer->TryScroll(
1048 gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE, SCROLL_BLOCKS_ON_NONE); 1049 gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE, SCROLL_BLOCKS_ON_NONE);
1049 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread); 1050 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread);
1050 EXPECT_EQ(InputHandler::NOT_SCROLLABLE, 1051 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable,
1051 status.main_thread_scrolling_reasons); 1052 status.main_thread_scrolling_reasons);
1052 1053
1053 // Set max_scroll_offset = (-100, -100). 1054 // Set max_scroll_offset = (-100, -100).
1054 scroll_layer->SetBounds(gfx::Size()); 1055 scroll_layer->SetBounds(gfx::Size());
1055 status = scroll_layer->TryScroll( 1056 status = scroll_layer->TryScroll(
1056 gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE, SCROLL_BLOCKS_ON_NONE); 1057 gfx::PointF(0.0f, 1.0f), InputHandler::GESTURE, SCROLL_BLOCKS_ON_NONE);
1057 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread); 1058 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread);
1058 EXPECT_EQ(InputHandler::NOT_SCROLLABLE, 1059 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable,
1059 status.main_thread_scrolling_reasons); 1060 status.main_thread_scrolling_reasons);
1060 1061
1061 EndTest(); 1062 EndTest();
1062 } 1063 }
1063 1064
1064 void AfterTest() override {} 1065 void AfterTest() override {}
1065 }; 1066 };
1066 1067
1067 SINGLE_AND_MULTI_THREAD_TEST_F( 1068 SINGLE_AND_MULTI_THREAD_TEST_F(
1068 LayerTreeHostScrollTestScrollZeroMaxScrollOffset); 1069 LayerTreeHostScrollTestScrollZeroMaxScrollOffset);
(...skipping 18 matching lines...) Expand all
1087 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 1088 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
1088 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); 1089 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer();
1089 1090
1090 // Verify that the scroll layer's scroll offset is taken into account when 1091 // Verify that the scroll layer's scroll offset is taken into account when
1091 // checking whether the screen space point is inside the non-fast 1092 // checking whether the screen space point is inside the non-fast
1092 // scrollable region. 1093 // scrollable region.
1093 1094
1094 InputHandler::ScrollStatus status = scroll_layer->TryScroll( 1095 InputHandler::ScrollStatus status = scroll_layer->TryScroll(
1095 gfx::PointF(1.f, 1.f), InputHandler::GESTURE, SCROLL_BLOCKS_ON_NONE); 1096 gfx::PointF(1.f, 1.f), InputHandler::GESTURE, SCROLL_BLOCKS_ON_NONE);
1096 EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, status.thread); 1097 EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, status.thread);
1097 EXPECT_EQ(InputHandler::NON_FAST_SCROLLABLE_REGION, 1098 EXPECT_EQ(MainThreadScrollingReason::kNonFastScrollableRegion,
1098 status.main_thread_scrolling_reasons); 1099 status.main_thread_scrolling_reasons);
1099 1100
1100 status = scroll_layer->TryScroll( 1101 status = scroll_layer->TryScroll(
1101 gfx::PointF(21.f, 21.f), InputHandler::GESTURE, SCROLL_BLOCKS_ON_NONE); 1102 gfx::PointF(21.f, 21.f), InputHandler::GESTURE, SCROLL_BLOCKS_ON_NONE);
1102 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 1103 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
1103 EXPECT_EQ(InputHandler::NOT_SCROLLING_ON_MAIN, 1104 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
1104 status.main_thread_scrolling_reasons); 1105 status.main_thread_scrolling_reasons);
1105 1106
1106 EndTest(); 1107 EndTest();
1107 } 1108 }
1108 1109
1109 void AfterTest() override {} 1110 void AfterTest() override {}
1110 }; 1111 };
1111 1112
1112 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollNonDrawnLayer); 1113 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollNonDrawnLayer);
1113 1114
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 RunTest(CompositorMode::Threaded, false); 1297 RunTest(CompositorMode::Threaded, false);
1297 } 1298 }
1298 1299
1299 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { 1300 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) {
1300 scroll_destroy_whole_tree_ = true; 1301 scroll_destroy_whole_tree_ = true;
1301 RunTest(CompositorMode::Threaded, false); 1302 RunTest(CompositorMode::Threaded, false);
1302 } 1303 }
1303 1304
1304 } // namespace 1305 } // namespace
1305 } // namespace cc 1306 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | third_party/WebKit/public/platform/WebMainThreadScrollingReason.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698