OLD | NEW |
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/button/custom_button.h" | 5 #include "ui/views/controls/button/custom_button.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 "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 EXPECT_FALSE(button()->canceled()); | 281 EXPECT_FALSE(button()->canceled()); |
282 } | 282 } |
283 | 283 |
284 // No touch on desktop Mac. Tracked in http://crbug.com/445520. | 284 // No touch on desktop Mac. Tracked in http://crbug.com/445520. |
285 #if !defined(OS_MACOSX) || defined(USE_AURA) | 285 #if !defined(OS_MACOSX) || defined(USE_AURA) |
286 | 286 |
287 namespace { | 287 namespace { |
288 | 288 |
289 void PerformGesture(CustomButton* button, ui::EventType event_type) { | 289 void PerformGesture(CustomButton* button, ui::EventType event_type) { |
290 ui::GestureEventDetails gesture_details(event_type); | 290 ui::GestureEventDetails gesture_details(event_type); |
291 base::TimeDelta time_stamp = base::TimeDelta::FromMicroseconds(0); | 291 ui::GestureEvent gesture_event(0, 0, 0, base::TimeTicks(), gesture_details); |
292 ui::GestureEvent gesture_event(0, 0, 0, time_stamp, gesture_details); | |
293 button->OnGestureEvent(&gesture_event); | 292 button->OnGestureEvent(&gesture_event); |
294 } | 293 } |
295 | 294 |
296 } // namespace | 295 } // namespace |
297 | 296 |
298 // Tests that gesture events correctly change the button state. | 297 // Tests that gesture events correctly change the button state. |
299 TEST_F(CustomButtonTest, GestureEventsSetState) { | 298 TEST_F(CustomButtonTest, GestureEventsSetState) { |
300 aura::test::TestCursorClient cursor_client( | 299 aura::test::TestCursorClient cursor_client( |
301 widget()->GetNativeView()->GetRootWindow()); | 300 widget()->GetNativeView()->GetRootWindow()); |
302 | 301 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 button()->OnMouseDragged(ui::MouseEvent( | 518 button()->OnMouseDragged(ui::MouseEvent( |
520 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(), | 519 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(), |
521 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); | 520 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); |
522 | 521 |
523 EXPECT_EQ(InkDropState::HIDDEN, ink_drop->GetTargetInkDropState()); | 522 EXPECT_EQ(InkDropState::HIDDEN, ink_drop->GetTargetInkDropState()); |
524 | 523 |
525 SetDraggedView(nullptr); | 524 SetDraggedView(nullptr); |
526 } | 525 } |
527 | 526 |
528 } // namespace views | 527 } // namespace views |
OLD | NEW |