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

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

Issue 404203003: Distinguish between keystroke and character events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IsCharFromNative() for Mac build Created 6 years, 4 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/root_view_unittest.cc ('k') | ui/views/win/hwnd_message_handler.cc » ('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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 Widget* toplevel = CreateTopLevelPlatformWidget(); 986 Widget* toplevel = CreateTopLevelPlatformWidget();
987 View* container = toplevel->client_view(); 987 View* container = toplevel->client_view();
988 988
989 Textfield* textfield = new Textfield(); 989 Textfield* textfield = new Textfield();
990 textfield->SetText(base::ASCIIToUTF16("some text")); 990 textfield->SetText(base::ASCIIToUTF16("some text"));
991 container->AddChildView(textfield); 991 container->AddChildView(textfield);
992 toplevel->Show(); 992 toplevel->Show();
993 textfield->RequestFocus(); 993 textfield->RequestFocus();
994 994
995 // The press gets handled. The release doesn't have an effect. 995 // The press gets handled. The release doesn't have an effect.
996 ui::KeyEvent backspace_p(ui::ET_KEY_PRESSED, ui::VKEY_DELETE, 0, false); 996 ui::KeyEvent backspace_p(ui::ET_KEY_PRESSED, ui::VKEY_DELETE, ui::EF_NONE);
997 toplevel->OnKeyEvent(&backspace_p); 997 toplevel->OnKeyEvent(&backspace_p);
998 EXPECT_TRUE(backspace_p.stopped_propagation()); 998 EXPECT_TRUE(backspace_p.stopped_propagation());
999 ui::KeyEvent backspace_r(ui::ET_KEY_RELEASED, ui::VKEY_DELETE, 0, false); 999 ui::KeyEvent backspace_r(ui::ET_KEY_RELEASED, ui::VKEY_DELETE, ui::EF_NONE);
1000 toplevel->OnKeyEvent(&backspace_r); 1000 toplevel->OnKeyEvent(&backspace_r);
1001 EXPECT_FALSE(backspace_r.handled()); 1001 EXPECT_FALSE(backspace_r.handled());
1002 1002
1003 toplevel->Close(); 1003 toplevel->Close();
1004 } 1004 }
1005 1005
1006 // Verifies bubbles result in a focus lost when shown. 1006 // Verifies bubbles result in a focus lost when shown.
1007 // TODO(msw): this tests relies on focus, it needs to be in 1007 // TODO(msw): this tests relies on focus, it needs to be in
1008 // interactive_ui_tests. 1008 // interactive_ui_tests.
1009 TEST_F(WidgetTest, DISABLED_FocusChangesOnBubble) { 1009 TEST_F(WidgetTest, DISABLED_FocusChangesOnBubble) {
(...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2728 EXPECT_EQ(3, view->GetEventCount(ui::ET_MOUSE_PRESSED)); 2728 EXPECT_EQ(3, view->GetEventCount(ui::ET_MOUSE_PRESSED));
2729 EXPECT_EQ(3, view->GetEventCount(ui::ET_MOUSE_RELEASED)); 2729 EXPECT_EQ(3, view->GetEventCount(ui::ET_MOUSE_RELEASED));
2730 EXPECT_EQ(1, view->GetEventCount(ui::ET_MOUSE_DRAGGED)); 2730 EXPECT_EQ(1, view->GetEventCount(ui::ET_MOUSE_DRAGGED));
2731 EXPECT_EQ(ui::EF_LEFT_MOUSE_BUTTON, view->last_flags()); 2731 EXPECT_EQ(ui::EF_LEFT_MOUSE_BUTTON, view->last_flags());
2732 2732
2733 widget->CloseNow(); 2733 widget->CloseNow();
2734 } 2734 }
2735 2735
2736 } // namespace test 2736 } // namespace test
2737 } // namespace views 2737 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/root_view_unittest.cc ('k') | ui/views/win/hwnd_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698