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

Unified Diff: ash/wm/workspace/workspace_layout_manager_unittest.cc

Issue 1177503003: Remove the 2-level input method system & InputMethodBridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reverted changes for MockInputMethod. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/workspace/workspace_layout_manager_unittest.cc
diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/wm/workspace/workspace_layout_manager_unittest.cc
index 84a22519cd4273eb8099660be50b49ca446a7f11..c3a0e9eda800d7addb8f61e0552a8e2b8d12d1cd 100644
--- a/ash/wm/workspace/workspace_layout_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_layout_manager_unittest.cc
@@ -27,9 +27,6 @@
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
-#include "ui/base/ime/dummy_text_input_client.h"
-#include "ui/base/ime/input_method.h"
-#include "ui/base/ime/text_input_focus_manager.h"
#include "ui/base/ui_base_switches_util.h"
#include "ui/base/ui_base_types.h"
#include "ui/gfx/geometry/insets.h"
@@ -1013,30 +1010,6 @@ class WorkspaceLayoutManagerKeyboardTest : public test::AshTestBase {
keyboard_bounds_ = bounds;
}
- void Focus(ui::TextInputClient* text_input_client) {
- if (switches::IsTextInputFocusManagerEnabled()) {
- ui::TextInputFocusManager::GetInstance()->FocusTextInputClient(
- text_input_client);
- } else {
- aura::Window* root_window =
- ash::Shell::GetInstance()->GetPrimaryRootWindow();
- ui::InputMethod* input_method = root_window->GetHost()->GetInputMethod();
- input_method->SetFocusedTextInputClient(text_input_client);
- }
- }
-
- void Blur(ui::TextInputClient* text_input_client) {
- if (switches::IsTextInputFocusManagerEnabled()) {
- ui::TextInputFocusManager::GetInstance()->BlurTextInputClient(
- text_input_client);
- } else {
- aura::Window* root_window =
- ash::Shell::GetInstance()->GetPrimaryRootWindow();
- ui::InputMethod* input_method = root_window->GetHost()->GetInputMethod();
- input_method->SetFocusedTextInputClient(NULL);
- }
- }
-
private:
gfx::Insets restore_work_area_insets_;
gfx::Rect keyboard_bounds_;
@@ -1045,19 +1018,6 @@ class WorkspaceLayoutManagerKeyboardTest : public test::AshTestBase {
DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerKeyboardTest);
};
-class FakeTextInputClient : public ui::DummyTextInputClient {
- public:
- explicit FakeTextInputClient(gfx::NativeWindow window) : window_(window) {}
- ~FakeTextInputClient() override {}
-
- gfx::NativeWindow GetAttachedWindow() const override { return window_; }
-
- private:
- gfx::NativeWindow window_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeTextInputClient);
-};
-
// Tests that when a child window gains focus the top level window containing it
// is resized to fit the remaining workspace area.
TEST_F(WorkspaceLayoutManagerKeyboardTest, ChildWindowFocused) {
@@ -1078,8 +1038,7 @@ TEST_F(WorkspaceLayoutManagerKeyboardTest, ChildWindowFocused) {
&delegate2, -1, work_area));
parent_window->AddChild(window.get());
- FakeTextInputClient text_input_client(window.get());
- Focus(&text_input_client);
+ wm::ActivateWindow(window.get());
int available_height =
Shell::GetScreen()->GetPrimaryDisplay().bounds().height() -
@@ -1095,8 +1054,6 @@ TEST_F(WorkspaceLayoutManagerKeyboardTest, ChildWindowFocused) {
HideKeyboard();
EXPECT_EQ(initial_window_bounds.ToString(),
parent_window->bounds().ToString());
-
- Blur(&text_input_client);
}
TEST_F(WorkspaceLayoutManagerKeyboardTest, AdjustWindowForA11yKeyboard) {
@@ -1113,13 +1070,12 @@ TEST_F(WorkspaceLayoutManagerKeyboardTest, AdjustWindowForA11yKeyboard) {
scoped_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate(
&delegate, -1, work_area));
- FakeTextInputClient text_input_client(window.get());
- Focus(&text_input_client);
-
int available_height =
Shell::GetScreen()->GetPrimaryDisplay().bounds().height() -
keyboard_bounds.height();
+ wm::ActivateWindow(window.get());
+
EXPECT_EQ(gfx::Rect(work_area).ToString(), window->bounds().ToString());
ShowKeyboard();
EXPECT_EQ(gfx::Rect(work_area.origin(),
@@ -1151,8 +1107,6 @@ TEST_F(WorkspaceLayoutManagerKeyboardTest, AdjustWindowForA11yKeyboard) {
window->bounds().ToString());
HideKeyboard();
EXPECT_EQ(occluded_window_bounds.ToString(), window->bounds().ToString());
-
- Blur(&text_input_client);
}
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698