| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/magnifier/magnification_controller.h" | 5 #include "ash/magnifier/magnification_controller.h" |
| 6 | 6 |
| 7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "ash/test/display_manager_test_api.h" | 10 #include "ash/test/display_manager_test_api.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "ui/aura/client/aura_constants.h" | |
| 13 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
| 14 #include "ui/aura/test/aura_test_utils.h" | 13 #include "ui/aura/test/aura_test_utils.h" |
| 15 #include "ui/aura/window_tree_host.h" | 14 #include "ui/aura/window_tree_host.h" |
| 16 #include "ui/base/ime/input_method.h" | 15 #include "ui/base/ime/input_method.h" |
| 17 #include "ui/chromeos/accessibility_types.h" | 16 #include "ui/chromeos/accessibility_types.h" |
| 18 #include "ui/events/test/event_generator.h" | 17 #include "ui/events/test/event_generator.h" |
| 19 #include "ui/gfx/geometry/rect_conversions.h" | 18 #include "ui/gfx/geometry/rect_conversions.h" |
| 20 #include "ui/gfx/screen.h" | 19 #include "ui/gfx/screen.h" |
| 21 #include "ui/views/controls/textfield/textfield.h" | 20 #include "ui/views/controls/textfield/textfield.h" |
| 22 #include "ui/views/layout/fill_layout.h" | 21 #include "ui/views/layout/fill_layout.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 void FocusOnTextInputView() { | 142 void FocusOnTextInputView() { |
| 144 DCHECK(text_input_view_); | 143 DCHECK(text_input_view_); |
| 145 text_input_view_->FocusOnTextInput(); | 144 text_input_view_->FocusOnTextInput(); |
| 146 } | 145 } |
| 147 | 146 |
| 148 private: | 147 private: |
| 149 TextInputView* text_input_view_; | 148 TextInputView* text_input_view_; |
| 150 | 149 |
| 151 ui::InputMethod* GetInputMethod() { | 150 ui::InputMethod* GetInputMethod() { |
| 152 DCHECK(text_input_view_); | 151 DCHECK(text_input_view_); |
| 153 return text_input_view_->GetWidget() | 152 return text_input_view_->GetWidget()->GetHostInputMethod(); |
| 154 ->GetNativeWindow() | |
| 155 ->GetRootWindow() | |
| 156 ->GetProperty(aura::client::kRootWindowInputMethodKey); | |
| 157 } | 153 } |
| 158 | 154 |
| 159 DISALLOW_COPY_AND_ASSIGN(MagnificationControllerTest); | 155 DISALLOW_COPY_AND_ASSIGN(MagnificationControllerTest); |
| 160 }; | 156 }; |
| 161 | 157 |
| 162 TEST_F(MagnificationControllerTest, EnableAndDisable) { | 158 TEST_F(MagnificationControllerTest, EnableAndDisable) { |
| 163 // Confirms the magnifier is disabled. | 159 // Confirms the magnifier is disabled. |
| 164 EXPECT_TRUE(GetRootWindow()->layer()->transform().IsIdentity()); | 160 EXPECT_TRUE(GetRootWindow()->layer()->transform().IsIdentity()); |
| 165 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 161 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
| 166 EXPECT_EQ("0,0 800x600", GetViewport().ToString()); | 162 EXPECT_EQ("0,0 800x600", GetViewport().ToString()); |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 UpdateDisplay("500x500"); | 698 UpdateDisplay("500x500"); |
| 703 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); | 699 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); |
| 704 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); | 700 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); |
| 705 | 701 |
| 706 GetMagnificationController()->SetEnabled(false); | 702 GetMagnificationController()->SetEnabled(false); |
| 707 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); | 703 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); |
| 708 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 704 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
| 709 } | 705 } |
| 710 | 706 |
| 711 } // namespace ash | 707 } // namespace ash |
| OLD | NEW |