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

Side by Side Diff: ui/views/widget/widget_interactive_uitest.cc

Issue 1703683003: The key event should be stopped propagation when it's been processed as an accelerator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CQ green. Created 4 years, 10 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/widget/widget.cc ('k') | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 textfield->SetTextInputType(ui::TEXT_INPUT_TYPE_TEXT); 1637 textfield->SetTextInputType(ui::TEXT_INPUT_TYPE_TEXT);
1638 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, 1638 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT,
1639 widget->GetInputMethod()->GetTextInputType()); 1639 widget->GetInputMethod()->GetTextInputType());
1640 1640
1641 textfield->SetReadOnly(true); 1641 textfield->SetReadOnly(true);
1642 EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, 1642 EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE,
1643 widget->GetInputMethod()->GetTextInputType()); 1643 widget->GetInputMethod()->GetTextInputType());
1644 widget->CloseNow(); 1644 widget->CloseNow();
1645 } 1645 }
1646 1646
1647 // Test input method should not work for accelerator.
1648 TEST_F(WidgetInputMethodInteractiveTest, AcceleratorInTextfield) {
1649 Widget* widget = CreateWidget();
1650 Textfield* textfield = new Textfield;
1651 widget->GetRootView()->AddChildView(textfield);
1652 ShowSync(widget);
1653 textfield->SetTextInputType(ui::TEXT_INPUT_TYPE_TEXT);
1654 textfield->RequestFocus();
1655
1656 ui::KeyEvent key_event(ui::ET_KEY_PRESSED,
1657 ui::VKEY_F, ui::EF_ALT_DOWN);
1658 ui::Accelerator accelerator(key_event);
1659 widget->GetFocusManager()->RegisterAccelerator(
1660 accelerator, ui::AcceleratorManager::kNormalPriority,
1661 textfield);
1662
1663 widget->OnKeyEvent(&key_event);
1664 EXPECT_TRUE(key_event.stopped_propagation());
1665
1666 widget->GetFocusManager()->UnregisterAccelerators(textfield);
1667
1668 ui::KeyEvent key_event2(key_event);
1669 widget->OnKeyEvent(&key_event2);
1670 EXPECT_FALSE(key_event2.stopped_propagation());
1671
1672 widget->CloseNow();
1673 }
1674
1647 } // namespace test 1675 } // namespace test
1648 } // namespace views 1676 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/widget.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698