OLD | NEW |
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 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 Widget* deactivate_widget_ = nullptr; | 1691 Widget* deactivate_widget_ = nullptr; |
1692 | 1692 |
1693 DISALLOW_COPY_AND_ASSIGN(WidgetInputMethodInteractiveTest); | 1693 DISALLOW_COPY_AND_ASSIGN(WidgetInputMethodInteractiveTest); |
1694 }; | 1694 }; |
1695 | 1695 |
1696 // Test input method focus changes affected by top window activaction. | 1696 // Test input method focus changes affected by top window activaction. |
1697 TEST_F(WidgetInputMethodInteractiveTest, Activation) { | 1697 TEST_F(WidgetInputMethodInteractiveTest, Activation) { |
1698 Widget* widget = CreateWidget(); | 1698 Widget* widget = CreateWidget(); |
1699 Textfield* textfield = new Textfield; | 1699 Textfield* textfield = new Textfield; |
1700 widget->GetRootView()->AddChildView(textfield); | 1700 widget->GetRootView()->AddChildView(textfield); |
| 1701 ShowSync(widget); |
1701 textfield->RequestFocus(); | 1702 textfield->RequestFocus(); |
1702 | 1703 |
1703 ShowSync(widget); | |
1704 | |
1705 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, | 1704 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, |
1706 widget->GetInputMethod()->GetTextInputType()); | 1705 widget->GetInputMethod()->GetTextInputType()); |
1707 | 1706 |
1708 DeactivateSync(widget); | 1707 DeactivateSync(widget); |
1709 | 1708 |
1710 EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, | 1709 EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, |
1711 widget->GetInputMethod()->GetTextInputType()); | 1710 widget->GetInputMethod()->GetTextInputType()); |
1712 widget->CloseNow(); | 1711 widget->CloseNow(); |
1713 } | 1712 } |
1714 | 1713 |
(...skipping 23 matching lines...) Expand all Loading... |
1738 DeactivateSync(widget); | 1737 DeactivateSync(widget); |
1739 EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, | 1738 EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, |
1740 widget->GetInputMethod()->GetTextInputType()); | 1739 widget->GetInputMethod()->GetTextInputType()); |
1741 | 1740 |
1742 ActivateSync(widget); | 1741 ActivateSync(widget); |
1743 EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, | 1742 EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, |
1744 widget->GetInputMethod()->GetTextInputType()); | 1743 widget->GetInputMethod()->GetTextInputType()); |
1745 | 1744 |
1746 DeactivateSync(widget); | 1745 DeactivateSync(widget); |
1747 textfield1->RequestFocus(); | 1746 textfield1->RequestFocus(); |
1748 ActivateSync(widget); | |
1749 EXPECT_TRUE(widget->IsActive()); | 1747 EXPECT_TRUE(widget->IsActive()); |
1750 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, | 1748 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, |
1751 widget->GetInputMethod()->GetTextInputType()); | 1749 widget->GetInputMethod()->GetTextInputType()); |
1752 #endif | 1750 #endif |
1753 widget->CloseNow(); | 1751 widget->CloseNow(); |
1754 } | 1752 } |
1755 | 1753 |
1756 // Test input method focus changes affected by focus changes cross 2 windows | 1754 // Test input method focus changes affected by focus changes cross 2 windows |
1757 // which shares the same top window. | 1755 // which shares the same top window. |
1758 TEST_F(WidgetInputMethodInteractiveTest, TwoWindows) { | 1756 TEST_F(WidgetInputMethodInteractiveTest, TwoWindows) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1859 | 1857 |
1860 ui::KeyEvent key_event2(key_event); | 1858 ui::KeyEvent key_event2(key_event); |
1861 widget->OnKeyEvent(&key_event2); | 1859 widget->OnKeyEvent(&key_event2); |
1862 EXPECT_FALSE(key_event2.stopped_propagation()); | 1860 EXPECT_FALSE(key_event2.stopped_propagation()); |
1863 | 1861 |
1864 widget->CloseNow(); | 1862 widget->CloseNow(); |
1865 } | 1863 } |
1866 | 1864 |
1867 } // namespace test | 1865 } // namespace test |
1868 } // namespace views | 1866 } // namespace views |
OLD | NEW |