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

Side by Side Diff: ui/views/widget/widget_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 <algorithm> 5 #include <algorithm>
6 #include <memory> 6 #include <memory>
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 2221 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 View* view = new RootViewTestView(); 2232 View* view = new RootViewTestView();
2233 view->SetBounds(0, 0, 300, 300); 2233 view->SetBounds(0, 0, 300, 300);
2234 internal::RootView* root_view = 2234 internal::RootView* root_view =
2235 static_cast<internal::RootView*>(widget->GetRootView()); 2235 static_cast<internal::RootView*>(widget->GetRootView());
2236 root_view->AddChildView(view); 2236 root_view->AddChildView(view);
2237 2237
2238 // Check RootView::mouse_pressed_handler_. 2238 // Check RootView::mouse_pressed_handler_.
2239 widget->Show(); 2239 widget->Show();
2240 EXPECT_EQ(NULL, GetMousePressedHandler(root_view)); 2240 EXPECT_EQ(NULL, GetMousePressedHandler(root_view));
2241 gfx::Point click_location(45, 15); 2241 gfx::Point click_location(45, 15);
2242 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, click_location, click_location, 2242 ui::MouseEvent press(
2243 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 2243 ui::ET_MOUSE_PRESSED, click_location, click_location,
2244 ui::EF_LEFT_MOUSE_BUTTON); 2244 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON,
2245 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
2245 widget->OnMouseEvent(&press); 2246 widget->OnMouseEvent(&press);
2246 EXPECT_EQ(view, GetMousePressedHandler(root_view)); 2247 EXPECT_EQ(view, GetMousePressedHandler(root_view));
2247 widget->Hide(); 2248 widget->Hide();
2248 EXPECT_EQ(NULL, GetMousePressedHandler(root_view)); 2249 EXPECT_EQ(NULL, GetMousePressedHandler(root_view));
2249 2250
2250 // Check RootView::mouse_move_handler_. 2251 // Check RootView::mouse_move_handler_.
2251 widget->Show(); 2252 widget->Show();
2252 EXPECT_EQ(NULL, GetMouseMoveHandler(root_view)); 2253 EXPECT_EQ(NULL, GetMouseMoveHandler(root_view));
2253 gfx::Point move_location(45, 15); 2254 gfx::Point move_location(45, 15);
2254 ui::MouseEvent move(ui::ET_MOUSE_MOVED, move_location, move_location, 2255 ui::MouseEvent move(
2255 ui::EventTimeForNow(), 0, 0); 2256 ui::ET_MOUSE_MOVED, move_location, move_location, ui::EventTimeForNow(),
2257 0, 0, ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
2256 widget->OnMouseEvent(&move); 2258 widget->OnMouseEvent(&move);
2257 EXPECT_EQ(view, GetMouseMoveHandler(root_view)); 2259 EXPECT_EQ(view, GetMouseMoveHandler(root_view));
2258 widget->Hide(); 2260 widget->Hide();
2259 EXPECT_EQ(NULL, GetMouseMoveHandler(root_view)); 2261 EXPECT_EQ(NULL, GetMouseMoveHandler(root_view));
2260 2262
2261 // Check RootView::gesture_handler_. 2263 // Check RootView::gesture_handler_.
2262 widget->Show(); 2264 widget->Show();
2263 EXPECT_EQ(NULL, GetGestureHandler(root_view)); 2265 EXPECT_EQ(NULL, GetGestureHandler(root_view));
2264 ui::GestureEvent tap_down(15, 15, 0, base::TimeTicks(), 2266 ui::GestureEvent tap_down(15, 15, 0, base::TimeTicks(),
2265 ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN)); 2267 ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN));
(...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after
3872 } 3874 }
3873 3875
3874 TEST_F(CompositingWidgetTest, Transparency_DesktopWidgetTranslucent) { 3876 TEST_F(CompositingWidgetTest, Transparency_DesktopWidgetTranslucent) {
3875 CheckAllWidgetsForOpacity(Widget::InitParams::TRANSLUCENT_WINDOW); 3877 CheckAllWidgetsForOpacity(Widget::InitParams::TRANSLUCENT_WINDOW);
3876 } 3878 }
3877 3879
3878 #endif // !defined(OS_CHROMEOS) 3880 #endif // !defined(OS_CHROMEOS)
3879 3881
3880 } // namespace test 3882 } // namespace test
3881 } // namespace views 3883 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698