| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/ui/zoom/test/zoom_test_utils.h" | |
| 6 | |
| 7 #include "content/public/test/test_utils.h" | |
| 8 | |
| 9 namespace ui_zoom { | |
| 10 | |
| 11 bool operator==(const ZoomController::ZoomChangedEventData& lhs, | |
| 12 const ZoomController::ZoomChangedEventData& rhs) { | |
| 13 return lhs.web_contents == rhs.web_contents && | |
| 14 lhs.old_zoom_level == rhs.old_zoom_level && | |
| 15 lhs.new_zoom_level == rhs.new_zoom_level && | |
| 16 lhs.zoom_mode == rhs.zoom_mode && | |
| 17 lhs.can_show_bubble == rhs.can_show_bubble; | |
| 18 } | |
| 19 | |
| 20 ZoomChangedWatcher::ZoomChangedWatcher( | |
| 21 ZoomController* zoom_controller, | |
| 22 const ZoomController::ZoomChangedEventData& expected_event_data) | |
| 23 : zoom_controller_(zoom_controller), | |
| 24 expected_event_data_(expected_event_data), | |
| 25 message_loop_runner_(new content::MessageLoopRunner) { | |
| 26 zoom_controller_->AddObserver(this); | |
| 27 } | |
| 28 | |
| 29 ZoomChangedWatcher::~ZoomChangedWatcher() { | |
| 30 zoom_controller_->RemoveObserver(this); | |
| 31 } | |
| 32 | |
| 33 void ZoomChangedWatcher::Wait() { | |
| 34 message_loop_runner_->Run(); | |
| 35 } | |
| 36 | |
| 37 void ZoomChangedWatcher::OnZoomChanged( | |
| 38 const ZoomController::ZoomChangedEventData& event_data) { | |
| 39 if (event_data == expected_event_data_) | |
| 40 message_loop_runner_->Quit(); | |
| 41 } | |
| 42 | |
| 43 } // namespace ui_zoom | |
| OLD | NEW |