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

Side by Side Diff: ui/views/touchui/touch_selection_controller_impl_unittest.cc

Issue 2371113003: Do not give instant focus if a view's toplevelwidget is not active (Closed)
Patch Set: new patch 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) 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "ui/aura/client/screen_position_client.h" 10 #include "ui/aura/client/screen_position_client.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 if (textfield_widget_ && !textfield_widget_->IsClosed()) 83 if (textfield_widget_ && !textfield_widget_->IsClosed())
84 textfield_widget_->Close(); 84 textfield_widget_->Close();
85 if (widget_ && !widget_->IsClosed()) 85 if (widget_ && !widget_->IsClosed())
86 widget_->Close(); 86 widget_->Close();
87 ViewsTestBase::TearDown(); 87 ViewsTestBase::TearDown();
88 } 88 }
89 89
90 void CreateTextfield() { 90 void CreateTextfield() {
91 textfield_ = new Textfield(); 91 textfield_ = new Textfield();
92 textfield_widget_ = new Widget; 92 textfield_widget_ = new Widget;
93 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP); 93 Widget::InitParams params =
94 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS);
94 params.bounds = gfx::Rect(0, 0, 200, 200); 95 params.bounds = gfx::Rect(0, 0, 200, 200);
95 textfield_widget_->Init(params); 96 textfield_widget_->Init(params);
96 View* container = new View(); 97 View* container = new View();
97 textfield_widget_->SetContentsView(container); 98 textfield_widget_->SetContentsView(container);
98 container->AddChildView(textfield_); 99 container->AddChildView(textfield_);
99 100
100 textfield_->SetBoundsRect(gfx::Rect(0, 0, 200, 21)); 101 textfield_->SetBoundsRect(gfx::Rect(0, 0, 200, 21));
101 textfield_->set_id(1); 102 textfield_->set_id(1);
102 textfield_widget_->Show(); 103 textfield_widget_->Show();
103 104
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 // Start touch editing; then press a key and ensure it deactivates touch 864 // Start touch editing; then press a key and ensure it deactivates touch
864 // selection. 865 // selection.
865 StartTouchEditing(); 866 StartTouchEditing();
866 EXPECT_TRUE(GetSelectionController()); 867 EXPECT_TRUE(GetSelectionController());
867 generator.PressKey(ui::VKEY_A, 0); 868 generator.PressKey(ui::VKEY_A, 0);
868 RunPendingMessages(); 869 RunPendingMessages();
869 EXPECT_FALSE(GetSelectionController()); 870 EXPECT_FALSE(GetSelectionController());
870 } 871 }
871 872
872 } // namespace views 873 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698