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