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

Side by Side Diff: ui/views/controls/textfield/textfield_unittest.cc

Issue 2505943002: MacViews: Fix accelerator handling while Omnibox is in focus. (Closed)
Patch Set: Fixed TextfieldTest.*, disable ViewTest.ActivateAcceleratorOnMac on non-MacViews. Created 4 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 EXPECT_TRUE(textfield_->key_handled()); 1245 EXPECT_TRUE(textfield_->key_handled());
1246 textfield_->clear(); 1246 textfield_->clear();
1247 1247
1248 SendEndEvent(shift); 1248 SendEndEvent(shift);
1249 EXPECT_TRUE(textfield_->key_received()); 1249 EXPECT_TRUE(textfield_->key_received());
1250 EXPECT_TRUE(textfield_->key_handled()); 1250 EXPECT_TRUE(textfield_->key_handled());
1251 textfield_->clear(); 1251 textfield_->clear();
1252 1252
1253 // F20 key won't be handled. 1253 // F20 key won't be handled.
1254 SendKeyEvent(ui::VKEY_F20); 1254 SendKeyEvent(ui::VKEY_F20);
1255 #if defined(OS_MACOSX)
1256 // On Mac, key combinations that don't map to editing commands are forwarded
1257 // on to the next responder, usually ending up at the window, which will beep.
tapted 2016/11/23 02:09:30 this is nice :)
1258 EXPECT_FALSE(textfield_->key_received());
themblsha 2016/11/22 14:33:48 The comment is outdated, as we try to DispatchKeyE
1259 #else
1260 EXPECT_TRUE(textfield_->key_received()); 1255 EXPECT_TRUE(textfield_->key_received());
1261 #endif
1262 EXPECT_FALSE(textfield_->key_handled()); 1256 EXPECT_FALSE(textfield_->key_handled());
1263 textfield_->clear(); 1257 textfield_->clear();
1264 } 1258 }
1265 1259
1266 // Tests that default key bindings are handled even with a delegate installed. 1260 // Tests that default key bindings are handled even with a delegate installed.
1267 TEST_F(TextfieldTest, OnKeyPressBinding) { 1261 TEST_F(TextfieldTest, OnKeyPressBinding) {
1268 InitTextfield(); 1262 InitTextfield();
1269 1263
1270 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 1264 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
1271 // Install a TextEditKeyBindingsDelegateAuraLinux that does nothing. 1265 // Install a TextEditKeyBindingsDelegateAuraLinux that does nothing.
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after
3008 ui::AXNodeData node_data_protected; 3002 ui::AXNodeData node_data_protected;
3009 node_data_protected.state = 0; 3003 node_data_protected.state = 0;
3010 textfield_->GetAccessibleNodeData(&node_data_protected); 3004 textfield_->GetAccessibleNodeData(&node_data_protected);
3011 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_protected.role); 3005 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, node_data_protected.role);
3012 EXPECT_EQ(ASCIIToUTF16("********"), 3006 EXPECT_EQ(ASCIIToUTF16("********"),
3013 node_data_protected.GetString16Attribute(ui::AX_ATTR_VALUE)); 3007 node_data_protected.GetString16Attribute(ui::AX_ATTR_VALUE));
3014 EXPECT_TRUE(node_data_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); 3008 EXPECT_TRUE(node_data_protected.HasStateFlag(ui::AX_STATE_PROTECTED));
3015 } 3009 }
3016 3010
3017 } // namespace views 3011 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698