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

Side by Side Diff: ui/views/controls/button/custom_button_unittest.cc

Issue 2033433006: MacViews: Modify insertText handlers to correctly handle space key and simplify menu event dispatch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 4 years, 6 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
« no previous file with comments | « ui/views/cocoa/bridged_content_view.mm ('k') | ui/views/controls/menu/menu_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 577
578 button()->OnMouseDragged(ui::MouseEvent( 578 button()->OnMouseDragged(ui::MouseEvent(
579 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(), 579 ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(),
580 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); 580 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
581 581
582 EXPECT_EQ(InkDropState::HIDDEN, ink_drop_delegate->GetTargetInkDropState()); 582 EXPECT_EQ(InkDropState::HIDDEN, ink_drop_delegate->GetTargetInkDropState());
583 583
584 SetDraggedView(nullptr); 584 SetDraggedView(nullptr);
585 } 585 }
586 586
587 // Todo(karandeepb): On Mac, button should get clicked on a Space key press (and
tapted 2016/06/07 04:59:35 nit: button -> a button
karandeepb 2016/06/07 08:39:29 Done.
588 // not release). Modify this test after fixing crbug.com/607429.
589 // Test that Space Key behaves correctly on a focused button.
590 TEST_F(CustomButtonTest, ClickOnSpace) {
591 button()->RequestFocus();
592 EXPECT_EQ(button(), widget()->GetFocusManager()->GetFocusedView());
593
594 ui::test::EventGenerator generator(GetContext(), widget()->GetNativeWindow());
595 generator.PressKey(ui::VKEY_SPACE, ui::EF_NONE);
596 EXPECT_EQ(CustomButton::STATE_PRESSED, button()->state());
597 EXPECT_FALSE(button()->pressed());
598
599 generator.ReleaseKey(ui::VKEY_SPACE, ui::EF_NONE);
600 EXPECT_EQ(CustomButton::STATE_NORMAL, button()->state());
601 EXPECT_TRUE(button()->pressed());
602 }
603
587 } // namespace views 604 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/cocoa/bridged_content_view.mm ('k') | ui/views/controls/menu/menu_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698