OLD | NEW |
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 2946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2957 textfield_->InsertOrReplaceText(base::ASCIIToUTF16("foo")); | 2957 textfield_->InsertOrReplaceText(base::ASCIIToUTF16("foo")); |
2958 EXPECT_TRUE(test_api_->IsCursorBlinkTimerRunning()); | 2958 EXPECT_TRUE(test_api_->IsCursorBlinkTimerRunning()); |
2959 } | 2959 } |
2960 | 2960 |
2961 #if defined(OS_CHROMEOS) | 2961 #if defined(OS_CHROMEOS) |
2962 // Check that when accessibility virtual keyboard is enabled, windows are | 2962 // Check that when accessibility virtual keyboard is enabled, windows are |
2963 // shifted up when focused and restored when focus is lost. | 2963 // shifted up when focused and restored when focus is lost. |
2964 TEST_F(TextfieldTest, VirtualKeyboardFocusEnsureCaretNotInRect) { | 2964 TEST_F(TextfieldTest, VirtualKeyboardFocusEnsureCaretNotInRect) { |
2965 InitTextfield(); | 2965 InitTextfield(); |
2966 | 2966 |
2967 // Enable new virtual keyboard behavior. | |
2968 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
2969 if (!command_line->HasSwitch(::switches::kUseNewVirtualKeyboardBehavior)) { | |
2970 command_line->AppendSwitch(::switches::kUseNewVirtualKeyboardBehavior); | |
2971 } | |
2972 | |
2973 aura::Window* root_window = widget_->GetNativeView()->GetRootWindow(); | 2967 aura::Window* root_window = widget_->GetNativeView()->GetRootWindow(); |
2974 int keyboard_height = 200; | 2968 int keyboard_height = 200; |
2975 gfx::Rect root_bounds = root_window->bounds(); | 2969 gfx::Rect root_bounds = root_window->bounds(); |
2976 gfx::Rect orig_widget_bounds = gfx::Rect(0, 300, 400, 200); | 2970 gfx::Rect orig_widget_bounds = gfx::Rect(0, 300, 400, 200); |
2977 gfx::Rect shifted_widget_bounds = gfx::Rect(0, 200, 400, 200); | 2971 gfx::Rect shifted_widget_bounds = gfx::Rect(0, 200, 400, 200); |
2978 gfx::Rect keyboard_view_bounds = | 2972 gfx::Rect keyboard_view_bounds = |
2979 gfx::Rect(0, root_bounds.height() - keyboard_height, root_bounds.width(), | 2973 gfx::Rect(0, root_bounds.height() - keyboard_height, root_bounds.width(), |
2980 keyboard_height); | 2974 keyboard_height); |
2981 | 2975 |
2982 // Focus the window. | 2976 // Focus the window. |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3168 InitTextfield(); | 3162 InitTextfield(); |
3169 | 3163 |
3170 textfield_->SetCursorEnabled(false); | 3164 textfield_->SetCursorEnabled(false); |
3171 EXPECT_FALSE(test_api_->IsCursorVisible()); | 3165 EXPECT_FALSE(test_api_->IsCursorVisible()); |
3172 | 3166 |
3173 textfield_->SetCursorEnabled(true); | 3167 textfield_->SetCursorEnabled(true); |
3174 EXPECT_TRUE(test_api_->IsCursorVisible()); | 3168 EXPECT_TRUE(test_api_->IsCursorVisible()); |
3175 } | 3169 } |
3176 | 3170 |
3177 } // namespace views | 3171 } // namespace views |
OLD | NEW |