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

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

Issue 2371113003: Do not give instant focus if a view's toplevelwidget is not active (Closed)
Patch Set: nit Created 4 years, 2 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
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/location.h" 9 #include "base/location.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 Widget* deactivate_widget_ = nullptr; 1648 Widget* deactivate_widget_ = nullptr;
1649 1649
1650 DISALLOW_COPY_AND_ASSIGN(WidgetInputMethodInteractiveTest); 1650 DISALLOW_COPY_AND_ASSIGN(WidgetInputMethodInteractiveTest);
1651 }; 1651 };
1652 1652
1653 // Test input method focus changes affected by top window activaction. 1653 // Test input method focus changes affected by top window activaction.
1654 TEST_F(WidgetInputMethodInteractiveTest, Activation) { 1654 TEST_F(WidgetInputMethodInteractiveTest, Activation) {
1655 Widget* widget = CreateWidget(); 1655 Widget* widget = CreateWidget();
1656 Textfield* textfield = new Textfield; 1656 Textfield* textfield = new Textfield;
1657 widget->GetRootView()->AddChildView(textfield); 1657 widget->GetRootView()->AddChildView(textfield);
1658 ShowSync(widget);
sky 2016/10/13 16:21:22 Why does the order here matter?
Qiang(Joe) Xu 2016/10/14 01:42:39 Oh, the master doesn't matter any more. I will res
1658 textfield->RequestFocus(); 1659 textfield->RequestFocus();
1659 1660
1660 ShowSync(widget);
1661
1662 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, 1661 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT,
1663 widget->GetInputMethod()->GetTextInputType()); 1662 widget->GetInputMethod()->GetTextInputType());
1664 1663
1665 DeactivateSync(widget); 1664 DeactivateSync(widget);
1666 1665
1667 EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, 1666 EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE,
1668 widget->GetInputMethod()->GetTextInputType()); 1667 widget->GetInputMethod()->GetTextInputType());
1669 widget->CloseNow(); 1668 widget->CloseNow();
1670 } 1669 }
1671 1670
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1816 1815
1817 ui::KeyEvent key_event2(key_event); 1816 ui::KeyEvent key_event2(key_event);
1818 widget->OnKeyEvent(&key_event2); 1817 widget->OnKeyEvent(&key_event2);
1819 EXPECT_FALSE(key_event2.stopped_propagation()); 1818 EXPECT_FALSE(key_event2.stopped_propagation());
1820 1819
1821 widget->CloseNow(); 1820 widget->CloseNow();
1822 } 1821 }
1823 1822
1824 } // namespace test 1823 } // namespace test
1825 } // namespace views 1824 } // namespace views
OLDNEW
« ui/views/widget/native_widget_aura_unittest.cc ('K') | « ui/views/widget/root_view_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698