| 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 EXPECT_FALSE(button()->canceled()); | 325 EXPECT_FALSE(button()->canceled()); |
| 326 } | 326 } |
| 327 | 327 |
| 328 // No touch on desktop Mac. Tracked in http://crbug.com/445520. | 328 // No touch on desktop Mac. Tracked in http://crbug.com/445520. |
| 329 #if !defined(OS_MACOSX) || defined(USE_AURA) | 329 #if !defined(OS_MACOSX) || defined(USE_AURA) |
| 330 | 330 |
| 331 namespace { | 331 namespace { |
| 332 | 332 |
| 333 void PerformGesture(CustomButton* button, ui::EventType event_type) { | 333 void PerformGesture(CustomButton* button, ui::EventType event_type) { |
| 334 ui::GestureEventDetails gesture_details(event_type); | 334 ui::GestureEventDetails gesture_details(event_type); |
| 335 base::TimeDelta time_stamp = base::TimeDelta::FromMicroseconds(0); | 335 ui::GestureEvent gesture_event(0, 0, 0, base::TimeTicks(), gesture_details); |
| 336 ui::GestureEvent gesture_event(0, 0, 0, time_stamp, gesture_details); | |
| 337 button->OnGestureEvent(&gesture_event); | 336 button->OnGestureEvent(&gesture_event); |
| 338 } | 337 } |
| 339 | 338 |
| 340 } // namespace | 339 } // namespace |
| 341 | 340 |
| 342 // Tests that gesture events correctly change the button state. | 341 // Tests that gesture events correctly change the button state. |
| 343 TEST_F(CustomButtonTest, GestureEventsSetState) { | 342 TEST_F(CustomButtonTest, GestureEventsSetState) { |
| 344 aura::test::TestCursorClient cursor_client( | 343 aura::test::TestCursorClient cursor_client( |
| 345 widget()->GetNativeView()->GetRootWindow()); | 344 widget()->GetNativeView()->GetRootWindow()); |
| 346 | 345 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 ink_drop_delegate->SetHovered(true); | 474 ink_drop_delegate->SetHovered(true); |
| 476 ink_drop_delegate->OnAction(InkDropState::ACTION_PENDING); | 475 ink_drop_delegate->OnAction(InkDropState::ACTION_PENDING); |
| 477 | 476 |
| 478 button()->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE); | 477 button()->ShowContextMenu(gfx::Point(), ui::MENU_SOURCE_MOUSE); |
| 479 | 478 |
| 480 EXPECT_TRUE(ink_drop_delegate->is_hovered()); | 479 EXPECT_TRUE(ink_drop_delegate->is_hovered()); |
| 481 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop_delegate->state()); | 480 EXPECT_EQ(InkDropState::ACTION_PENDING, ink_drop_delegate->state()); |
| 482 } | 481 } |
| 483 | 482 |
| 484 } // namespace views | 483 } // namespace views |
| OLD | NEW |