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

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

Issue 334573004: Fixes unittests with --enable-text-input-focus-manager flag enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed more unittests. Created 6 years, 6 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 | Annotate | Revision Log
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 "ash/display/display_layout.h" 7 #include "ash/display/display_layout.h"
8 #include "ash/display/display_manager.h" 8 #include "ash/display/display_manager.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/screen_util.h" 10 #include "ash/screen_util.h"
11 #include "ash/session/session_state_delegate.h" 11 #include "ash/session/session_state_delegate.h"
12 #include "ash/shelf/shelf_layout_manager.h" 12 #include "ash/shelf/shelf_layout_manager.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/shell_observer.h" 14 #include "ash/shell_observer.h"
15 #include "ash/shell_window_ids.h" 15 #include "ash/shell_window_ids.h"
16 #include "ash/test/ash_test_base.h" 16 #include "ash/test/ash_test_base.h"
17 #include "ash/wm/maximize_mode/workspace_backdrop_delegate.h" 17 #include "ash/wm/maximize_mode/workspace_backdrop_delegate.h"
18 #include "ash/wm/window_state.h" 18 #include "ash/wm/window_state.h"
19 #include "ash/wm/window_util.h" 19 #include "ash/wm/window_util.h"
20 #include "ash/wm/wm_event.h" 20 #include "ash/wm/wm_event.h"
21 #include "ash/wm/workspace/workspace_window_resizer.h" 21 #include "ash/wm/workspace/workspace_window_resizer.h"
22 #include "base/basictypes.h" 22 #include "base/basictypes.h"
23 #include "base/compiler_specific.h" 23 #include "base/compiler_specific.h"
24 #include "ui/aura/client/aura_constants.h" 24 #include "ui/aura/client/aura_constants.h"
25 #include "ui/aura/test/test_windows.h" 25 #include "ui/aura/test/test_windows.h"
26 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
27 #include "ui/aura/window_event_dispatcher.h" 27 #include "ui/aura/window_event_dispatcher.h"
28 #include "ui/base/ime/dummy_text_input_client.h" 28 #include "ui/base/ime/dummy_text_input_client.h"
29 #include "ui/base/ime/input_method.h" 29 #include "ui/base/ime/input_method.h"
30 #include "ui/base/ime/text_input_focus_manager.h"
31 #include "ui/base/ui_base_switches_util.h"
30 #include "ui/base/ui_base_types.h" 32 #include "ui/base/ui_base_types.h"
31 #include "ui/gfx/insets.h" 33 #include "ui/gfx/insets.h"
32 #include "ui/gfx/screen.h" 34 #include "ui/gfx/screen.h"
33 #include "ui/views/widget/widget.h" 35 #include "ui/views/widget/widget.h"
34 #include "ui/views/widget/widget_delegate.h" 36 #include "ui/views/widget/widget_delegate.h"
35 #include "ui/wm/core/window_util.h" 37 #include "ui/wm/core/window_util.h"
36 38
37 namespace ash { 39 namespace ash {
38 namespace { 40 namespace {
39 41
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 work_area.height() / 2); 1014 work_area.height() / 2);
1013 1015
1014 SetKeyboardBounds(keyboard_bounds); 1016 SetKeyboardBounds(keyboard_bounds);
1015 scoped_ptr<aura::Window> window( 1017 scoped_ptr<aura::Window> window(
1016 CreateTestWindowInShellWithBounds(work_area)); 1018 CreateTestWindowInShellWithBounds(work_area));
1017 1019
1018 aura::Window* root_window = ash::Shell::GetInstance()->GetPrimaryRootWindow(); 1020 aura::Window* root_window = ash::Shell::GetInstance()->GetPrimaryRootWindow();
1019 FakeTextInputClient text_input_client(window.get()); 1021 FakeTextInputClient text_input_client(window.get());
1020 ui::InputMethod* input_method = 1022 ui::InputMethod* input_method =
1021 root_window->GetProperty(aura::client::kRootWindowInputMethodKey); 1023 root_window->GetProperty(aura::client::kRootWindowInputMethodKey);
1022 input_method->SetFocusedTextInputClient(&text_input_client); 1024 if (switches::IsTextInputFocusManagerEnabled()) {
1025 ui::TextInputFocusManager::GetInstance()->FocusTextInputClient(
1026 &text_input_client);
1027 } else {
1028 input_method->SetFocusedTextInputClient(&text_input_client);
1029 }
1023 1030
1024 int available_height = 1031 int available_height =
1025 Shell::GetScreen()->GetPrimaryDisplay().bounds().height() - 1032 Shell::GetScreen()->GetPrimaryDisplay().bounds().height() -
1026 keyboard_bounds.height(); 1033 keyboard_bounds.height();
1027 1034
1028 EXPECT_EQ(gfx::Rect(work_area).ToString(), 1035 EXPECT_EQ(gfx::Rect(work_area).ToString(),
1029 window->bounds().ToString()); 1036 window->bounds().ToString());
1030 ShowKeyboard(); 1037 ShowKeyboard();
1031 EXPECT_EQ(gfx::Rect(work_area.origin(), 1038 EXPECT_EQ(gfx::Rect(work_area.origin(),
1032 gfx::Size(work_area.width(), available_height)).ToString(), 1039 gfx::Size(work_area.width(), available_height)).ToString(),
1033 window->bounds().ToString()); 1040 window->bounds().ToString());
1034 HideKeyboard(); 1041 HideKeyboard();
1035 1042
1036 window->SetBounds(gfx::Rect(50, 50, 100, 500)); 1043 window->SetBounds(gfx::Rect(50, 50, 100, 500));
1037 EXPECT_EQ("50,50 100x500", window->bounds().ToString()); 1044 EXPECT_EQ("50,50 100x500", window->bounds().ToString());
1038 ShowKeyboard(); 1045 ShowKeyboard();
1039 EXPECT_EQ(gfx::Rect(50, 0, 100, available_height).ToString(), 1046 EXPECT_EQ(gfx::Rect(50, 0, 100, available_height).ToString(),
1040 window->bounds().ToString()); 1047 window->bounds().ToString());
1041 HideKeyboard(); 1048 HideKeyboard();
1042 input_method->SetFocusedTextInputClient(NULL); 1049 if (switches::IsTextInputFocusManagerEnabled()) {
1050 ui::TextInputFocusManager::GetInstance()->BlurTextInputClient(
1051 &text_input_client);
1052 } else {
1053 input_method->SetFocusedTextInputClient(NULL);
1054 }
1043 } 1055 }
1044 1056
1045 } // namespace ash 1057 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller_unittest.cc ('k') | chrome/browser/chromeos/input_method/textinput_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698