| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_finder.h" | 8 #include "chrome/browser/ui/browser_finder.h" |
| 9 #include "chrome/browser/ui/zoom/zoom_controller.h" | 9 #include "chrome/browser/ui/zoom/zoom_controller.h" |
| 10 #include "chrome/browser/ui/zoom/zoom_observer.h" | 10 #include "chrome/browser/ui/zoom/zoom_observer.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // available. | 88 // available. |
| 89 ZoomController::ZoomChangedEventData zoom_change_data( | 89 ZoomController::ZoomChangedEventData zoom_change_data( |
| 90 web_contents(), | 90 web_contents(), |
| 91 new_zoom_level, | 91 new_zoom_level, |
| 92 new_zoom_level, | 92 new_zoom_level, |
| 93 ZoomController::ZOOM_MODE_DEFAULT, | 93 ZoomController::ZOOM_MODE_DEFAULT, |
| 94 false); | 94 false); |
| 95 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data)).Times(1); | 95 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data)).Times(1); |
| 96 | 96 |
| 97 content::HostZoomMap* host_zoom_map = | 97 content::HostZoomMap* host_zoom_map = |
| 98 content::HostZoomMap::GetForBrowserContext( | 98 content::HostZoomMap::GetDefaultForBrowserContext( |
| 99 web_contents()->GetBrowserContext()); | 99 web_contents()->GetBrowserContext()); |
| 100 | 100 |
| 101 host_zoom_map->SetZoomLevelForHost(std::string(), new_zoom_level); | 101 host_zoom_map->SetZoomLevelForHost(std::string(), new_zoom_level); |
| 102 } | 102 } |
| 103 | 103 |
| 104 TEST_F(ZoomControllerTest, Observe_ZoomController) { | 104 TEST_F(ZoomControllerTest, Observe_ZoomController) { |
| 105 double old_zoom_level = zoom_controller_->GetZoomLevel(); | 105 double old_zoom_level = zoom_controller_->GetZoomLevel(); |
| 106 double new_zoom_level = 110.0; | 106 double new_zoom_level = 110.0; |
| 107 | 107 |
| 108 ZoomController::ZoomChangedEventData zoom_change_data1( | 108 ZoomController::ZoomChangedEventData zoom_change_data1( |
| 109 web_contents(), | 109 web_contents(), |
| 110 old_zoom_level, | 110 old_zoom_level, |
| 111 old_zoom_level, | 111 old_zoom_level, |
| 112 ZoomController::ZOOM_MODE_ISOLATED, | 112 ZoomController::ZOOM_MODE_ISOLATED, |
| 113 false /* can_show_bubble */); | 113 false /* can_show_bubble */); |
| 114 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data1)).Times(1); | 114 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data1)).Times(1); |
| 115 | 115 |
| 116 zoom_controller_->SetZoomMode(ZoomController::ZOOM_MODE_ISOLATED); | 116 zoom_controller_->SetZoomMode(ZoomController::ZOOM_MODE_ISOLATED); |
| 117 | 117 |
| 118 ZoomController::ZoomChangedEventData zoom_change_data2( | 118 ZoomController::ZoomChangedEventData zoom_change_data2( |
| 119 web_contents(), | 119 web_contents(), |
| 120 old_zoom_level, | 120 old_zoom_level, |
| 121 new_zoom_level, | 121 new_zoom_level, |
| 122 ZoomController::ZOOM_MODE_ISOLATED, | 122 ZoomController::ZOOM_MODE_ISOLATED, |
| 123 false /* can_show_bubble */); | 123 false /* can_show_bubble */); |
| 124 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data2)).Times(1); | 124 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data2)).Times(1); |
| 125 | 125 |
| 126 zoom_controller_->SetZoomLevel(new_zoom_level); | 126 zoom_controller_->SetZoomLevel(new_zoom_level); |
| 127 } | 127 } |
| OLD | NEW |