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

Side by Side Diff: ash/wm/workspace/workspace_layout_manager_keyboard_unittest.cc

Issue 2871243003: Enable new-virtual-keyboard-behavior flag by default. (Closed)
Patch Set: keep sorted the declarations Created 3 years, 7 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 "ash/wm/workspace/workspace_layout_manager.h" 5 #include "ash/wm/workspace/workspace_layout_manager.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/public/cpp/shell_window_ids.h" 10 #include "ash/public/cpp/shell_window_ids.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 // Initializes the keyboard bounds using the bottom half of the work area. 77 // Initializes the keyboard bounds using the bottom half of the work area.
78 void InitKeyboardBounds() { 78 void InitKeyboardBounds() {
79 gfx::Rect work_area( 79 gfx::Rect work_area(
80 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 80 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
81 keyboard_bounds_.SetRect(work_area.x(), 81 keyboard_bounds_.SetRect(work_area.x(),
82 work_area.y() + work_area.height() / 2, 82 work_area.y() + work_area.height() / 2,
83 work_area.width(), work_area.height() / 2); 83 work_area.width(), work_area.height() / 2);
84 } 84 }
85 85
86 void EnableNewVKMode() { 86 void DisableNewVKMode() {
87 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 87 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
88 if (!command_line->HasSwitch(::switches::kUseNewVirtualKeyboardBehavior)) 88 if (!command_line->HasSwitch(
89 command_line->AppendSwitch(::switches::kUseNewVirtualKeyboardBehavior); 89 ::switches::kDisableNewVirtualKeyboardBehavior)) {
90 command_line->AppendSwitch(
91 ::switches::kDisableNewVirtualKeyboardBehavior);
92 }
90 } 93 }
91 94
92 const gfx::Rect& keyboard_bounds() const { return keyboard_bounds_; } 95 const gfx::Rect& keyboard_bounds() const { return keyboard_bounds_; }
93 96
94 private: 97 private:
95 gfx::Insets restore_work_area_insets_; 98 gfx::Insets restore_work_area_insets_;
96 gfx::Rect keyboard_bounds_; 99 gfx::Rect keyboard_bounds_;
97 WorkspaceLayoutManager* layout_manager_; 100 WorkspaceLayoutManager* layout_manager_;
98 101
99 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerKeyboardTest2); 102 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerKeyboardTest2);
100 }; 103 };
101 104
102 TEST_F(WorkspaceLayoutManagerKeyboardTest2, ChangeWorkAreaInNonStickyMode) { 105 TEST_F(WorkspaceLayoutManagerKeyboardTest2, ChangeWorkAreaInNonStickyMode) {
106 // Append the flag to cause work area change in non-sticky mode.
107 DisableNewVKMode();
108
103 keyboard::SetAccessibilityKeyboardEnabled(true); 109 keyboard::SetAccessibilityKeyboardEnabled(true);
104 InitKeyboardBounds(); 110 InitKeyboardBounds();
105 Shell::Get()->CreateKeyboard(); 111 Shell::Get()->CreateKeyboard();
106 keyboard::KeyboardController* kb_controller = 112 keyboard::KeyboardController* kb_controller =
107 keyboard::KeyboardController::GetInstance(); 113 keyboard::KeyboardController::GetInstance();
108 114
109 gfx::Rect work_area( 115 gfx::Rect work_area(
110 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 116 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
111 117
112 gfx::Rect orig_window_bounds(0, 100, work_area.width(), 118 gfx::Rect orig_window_bounds(0, 100, work_area.width(),
(...skipping 29 matching lines...) Expand all
142 148
143 kb_controller->HideKeyboard( 149 kb_controller->HideKeyboard(
144 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); 150 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC);
145 EXPECT_EQ(orig_window_bounds, window->bounds()); 151 EXPECT_EQ(orig_window_bounds, window->bounds());
146 } 152 }
147 153
148 // When kAshUseNewVKWindowBehavior flag enabled, do not change accessibility 154 // When kAshUseNewVKWindowBehavior flag enabled, do not change accessibility
149 // keyboard work area in non-sticky mode. 155 // keyboard work area in non-sticky mode.
150 TEST_F(WorkspaceLayoutManagerKeyboardTest2, 156 TEST_F(WorkspaceLayoutManagerKeyboardTest2,
151 IgnoreWorkAreaChangeinNonStickyMode) { 157 IgnoreWorkAreaChangeinNonStickyMode) {
152 // Append flag to ignore work area change in non-sticky mode.
153 EnableNewVKMode();
154
155 keyboard::SetAccessibilityKeyboardEnabled(true); 158 keyboard::SetAccessibilityKeyboardEnabled(true);
156 InitKeyboardBounds(); 159 InitKeyboardBounds();
157 Shell::Get()->CreateKeyboard(); 160 Shell::Get()->CreateKeyboard();
158 keyboard::KeyboardController* kb_controller = 161 keyboard::KeyboardController* kb_controller =
159 keyboard::KeyboardController::GetInstance(); 162 keyboard::KeyboardController::GetInstance();
160 163
161 gfx::Rect work_area( 164 gfx::Rect work_area(
162 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 165 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
163 166
164 gfx::Rect orig_window_bounds(0, 100, work_area.width(), 167 gfx::Rect orig_window_bounds(0, 100, work_area.width(),
(...skipping 26 matching lines...) Expand all
191 changed_window_bounds.Offset(0, -shift); 194 changed_window_bounds.Offset(0, -shift);
192 // Window should be shifted up. 195 // Window should be shifted up.
193 EXPECT_EQ(changed_window_bounds, window->bounds()); 196 EXPECT_EQ(changed_window_bounds, window->bounds());
194 197
195 kb_controller->HideKeyboard( 198 kb_controller->HideKeyboard(
196 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); 199 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC);
197 EXPECT_EQ(orig_window_bounds, window->bounds()); 200 EXPECT_EQ(orig_window_bounds, window->bounds());
198 } 201 }
199 202
200 } // namespace ash 203 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.cc ('k') | ash/wm/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698