| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "ash/magnifier/magnification_controller.h" | 7 #include "ash/magnifier/magnification_controller.h" |
| 8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 gfx::Rect GetViewPort() { | 62 gfx::Rect GetViewPort() { |
| 63 return GetMagnificationController()->GetViewportRect(); | 63 return GetMagnificationController()->GetViewportRect(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 class MagnifierAnimationWaiter { | 66 class MagnifierAnimationWaiter { |
| 67 public: | 67 public: |
| 68 explicit MagnifierAnimationWaiter(ash::MagnificationController* controller) | 68 explicit MagnifierAnimationWaiter(ash::MagnificationController* controller) |
| 69 : controller_(controller) {} | 69 : controller_(controller) {} |
| 70 | 70 |
| 71 void Wait() { | 71 void Wait() { |
| 72 base::RepeatingTimer<MagnifierAnimationWaiter> check_timer; | 72 base::RepeatingTimer check_timer; |
| 73 check_timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(10), this, | 73 check_timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(10), this, |
| 74 &MagnifierAnimationWaiter::OnTimer); | 74 &MagnifierAnimationWaiter::OnTimer); |
| 75 runner_ = new content::MessageLoopRunner; | 75 runner_ = new content::MessageLoopRunner; |
| 76 runner_->Run(); | 76 runner_->Run(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 void OnTimer() { | 80 void OnTimer() { |
| 81 DCHECK(runner_.get()); | 81 DCHECK(runner_.get()); |
| 82 if (!controller_->IsOnAnimationForTesting()) { | 82 if (!controller_->IsOnAnimationForTesting()) { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 // Set the focus on the button. | 220 // Set the focus on the button. |
| 221 SetFocusOnElement("test_button"); | 221 SetFocusOnElement("test_button"); |
| 222 | 222 |
| 223 // Verify the magnifier window is not moved and still contains the button. | 223 // Verify the magnifier window is not moved and still contains the button. |
| 224 const gfx::Rect view_port_after_focus = GetViewPort(); | 224 const gfx::Rect view_port_after_focus = GetViewPort(); |
| 225 EXPECT_TRUE(view_port_after_focus.Contains(button_bounds)); | 225 EXPECT_TRUE(view_port_after_focus.Contains(button_bounds)); |
| 226 EXPECT_EQ(view_port_before_focus, view_port_after_focus); | 226 EXPECT_EQ(view_port_before_focus, view_port_after_focus); |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace chromeos | 229 } // namespace chromeos |
| OLD | NEW |