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

Side by Side Diff: ui/views/controls/scroll_view_unittest.cc

Issue 2786693002: Add PointerDetails to ui::MouseEvent's constructors (Closed)
Patch Set: mouse event constructor Created 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/views/controls/scroll_view.h" 5 #include "ui/views/controls/scroll_view.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 : scroll_view.vertical_scroll_bar(); 120 : scroll_view.vertical_scroll_bar();
121 if (should_be_visible) { 121 if (should_be_visible) {
122 ASSERT_TRUE(scrollbar); 122 ASSERT_TRUE(scrollbar);
123 EXPECT_TRUE(scrollbar->visible()); 123 EXPECT_TRUE(scrollbar->visible());
124 } else { 124 } else {
125 EXPECT_TRUE(!scrollbar || !scrollbar->visible()); 125 EXPECT_TRUE(!scrollbar || !scrollbar->visible());
126 } 126 }
127 } 127 }
128 128
129 ui::MouseEvent TestLeftMouseAt(const gfx::Point& location, ui::EventType type) { 129 ui::MouseEvent TestLeftMouseAt(const gfx::Point& location, ui::EventType type) {
130 return ui::MouseEvent(type, location, location, base::TimeTicks(), 130 return ui::MouseEvent(
131 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); 131 type, location, location, base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON,
132 ui::EF_LEFT_MOUSE_BUTTON,
133 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
132 } 134 }
133 135
134 } // namespace 136 } // namespace
135 137
136 using test::ScrollViewTestApi; 138 using test::ScrollViewTestApi;
137 139
138 // Simple test harness for testing a ScrollView directly. 140 // Simple test harness for testing a ScrollView directly.
139 class ScrollViewTest : public ViewsTestBase { 141 class ScrollViewTest : public ViewsTestBase {
140 public: 142 public:
141 ScrollViewTest() {} 143 ScrollViewTest() {}
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 // Scroll via ScrollView API. Should be reflected on the impl side. 1033 // Scroll via ScrollView API. Should be reflected on the impl side.
1032 offset.set_y(kDefaultHeight * 4); 1034 offset.set_y(kDefaultHeight * 4);
1033 scroll_view->contents()->ScrollRectToVisible(offset); 1035 scroll_view->contents()->ScrollRectToVisible(offset);
1034 EXPECT_EQ(gfx::ScrollOffset(0, offset.y()), test_api.CurrentOffset()); 1036 EXPECT_EQ(gfx::ScrollOffset(0, offset.y()), test_api.CurrentOffset());
1035 1037
1036 EXPECT_TRUE(compositor->GetScrollOffsetForLayer(layer_id, &impl_offset)); 1038 EXPECT_TRUE(compositor->GetScrollOffsetForLayer(layer_id, &impl_offset));
1037 EXPECT_EQ(gfx::ScrollOffset(0, offset.y()), impl_offset); 1039 EXPECT_EQ(gfx::ScrollOffset(0, offset.y()), impl_offset);
1038 } 1040 }
1039 1041
1040 } // namespace views 1042 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698