Index: ash/magnifier/magnification_controller_unittest.cc |
diff --git a/ash/magnifier/magnification_controller_unittest.cc b/ash/magnifier/magnification_controller_unittest.cc |
index fcd7381a8d4c4d947ee8480540f5f8c0ebb0dbed..6c5a2d85953087b5099f976ea670669caa8f4047 100644 |
--- a/ash/magnifier/magnification_controller_unittest.cc |
+++ b/ash/magnifier/magnification_controller_unittest.cc |
@@ -266,6 +266,33 @@ TEST_F(MagnificationControllerTest, PointOfInterest) { |
EXPECT_EQ("450,350", CurrentPointOfInterest()); |
} |
+TEST_F(MagnificationControllerTest, FollowFocusChanged) { |
+ // Enables magnifier and confirm the viewport is at center. |
+ GetMagnificationController()->SetEnabled(true); |
+ EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); |
+ EXPECT_EQ("200,150 400x300", GetViewport().ToString()); |
+ |
+ // Don't move viewport when focusing edit box. |
+ GetMagnificationController()->HandleFocusedNodeChanged( |
+ true, gfx::Rect(0, 0, 10, 10)); |
+ EXPECT_EQ("200,150 400x300", GetViewport().ToString()); |
+ |
+ // Move viewport to element in upper left. |
+ GetMagnificationController()->HandleFocusedNodeChanged( |
+ false, gfx::Rect(0, 0, 10, 10)); |
+ EXPECT_EQ("0,0 400x300", GetViewport().ToString()); |
+ |
+ // Move viewport to element in lower right. |
+ GetMagnificationController()->HandleFocusedNodeChanged( |
+ false, gfx::Rect(790, 590, 10, 10)); |
+ EXPECT_EQ("400,300 400x300", GetViewport().ToString()); |
+ |
+ // Don't follow focus onto empty rectangle. |
+ GetMagnificationController()->HandleFocusedNodeChanged( |
+ false, gfx::Rect(0, 0, 0, 0)); |
+ EXPECT_EQ("400,300 400x300", GetViewport().ToString()); |
+} |
+ |
TEST_F(MagnificationControllerTest, PanWindow2xLeftToRight) { |
const aura::Env* env = aura::Env::GetInstance(); |
ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |