| 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" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 void FocusOnTextInputView() { | 141 void FocusOnTextInputView() { |
| 142 DCHECK(text_input_view_); | 142 DCHECK(text_input_view_); |
| 143 text_input_view_->FocusOnTextInput(); | 143 text_input_view_->FocusOnTextInput(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 private: | 146 private: |
| 147 TextInputView* text_input_view_; | 147 TextInputView* text_input_view_; |
| 148 | 148 |
| 149 ui::InputMethod* GetInputMethod() { | 149 ui::InputMethod* GetInputMethod() { |
| 150 DCHECK(text_input_view_); | 150 DCHECK(text_input_view_); |
| 151 return text_input_view_->GetWidget() | 151 return text_input_view_->GetWidget()->GetHostInputMethod(); |
| 152 ->GetNativeWindow() | |
| 153 ->GetRootWindow() | |
| 154 ->GetProperty(aura::client::kRootWindowInputMethodKey); | |
| 155 } | 152 } |
| 156 | 153 |
| 157 DISALLOW_COPY_AND_ASSIGN(MagnificationControllerTest); | 154 DISALLOW_COPY_AND_ASSIGN(MagnificationControllerTest); |
| 158 }; | 155 }; |
| 159 | 156 |
| 160 TEST_F(MagnificationControllerTest, EnableAndDisable) { | 157 TEST_F(MagnificationControllerTest, EnableAndDisable) { |
| 161 // Confirms the magnifier is disabled. | 158 // Confirms the magnifier is disabled. |
| 162 EXPECT_TRUE(GetRootWindow()->layer()->transform().IsIdentity()); | 159 EXPECT_TRUE(GetRootWindow()->layer()->transform().IsIdentity()); |
| 163 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 160 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
| 164 EXPECT_EQ("0,0 800x600", GetViewport().ToString()); | 161 EXPECT_EQ("0,0 800x600", GetViewport().ToString()); |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 UpdateDisplay("500x500"); | 612 UpdateDisplay("500x500"); |
| 616 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); | 613 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); |
| 617 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); | 614 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); |
| 618 | 615 |
| 619 GetMagnificationController()->SetEnabled(false); | 616 GetMagnificationController()->SetEnabled(false); |
| 620 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); | 617 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); |
| 621 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 618 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
| 622 } | 619 } |
| 623 | 620 |
| 624 } // namespace ash | 621 } // namespace ash |
| OLD | NEW |