| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 content::HostZoomMap::GetDefaultForBrowserContext( | 87 content::HostZoomMap::GetDefaultForBrowserContext( |
| 88 web_contents()->GetBrowserContext()); | 88 web_contents()->GetBrowserContext()); |
| 89 | 89 |
| 90 host_zoom_map->SetZoomLevelForHost(std::string(), new_zoom_level); | 90 host_zoom_map->SetZoomLevelForHost(std::string(), new_zoom_level); |
| 91 } | 91 } |
| 92 | 92 |
| 93 TEST_F(ZoomControllerTest, Observe_ZoomController) { | 93 TEST_F(ZoomControllerTest, Observe_ZoomController) { |
| 94 double old_zoom_level = zoom_controller_->GetZoomLevel(); | 94 double old_zoom_level = zoom_controller_->GetZoomLevel(); |
| 95 double new_zoom_level = 110.0; | 95 double new_zoom_level = 110.0; |
| 96 | 96 |
| 97 NavigateAndCommit(GURL("about:blank")); |
| 98 |
| 97 ZoomController::ZoomChangedEventData zoom_change_data1( | 99 ZoomController::ZoomChangedEventData zoom_change_data1( |
| 98 web_contents(), | 100 web_contents(), |
| 99 old_zoom_level, | 101 old_zoom_level, |
| 100 old_zoom_level, | 102 old_zoom_level, |
| 101 ZoomController::ZOOM_MODE_ISOLATED, | 103 ZoomController::ZOOM_MODE_ISOLATED, |
| 102 false /* can_show_bubble */); | 104 true /* can_show_bubble */); |
| 103 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data1)).Times(1); | 105 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data1)).Times(1); |
| 104 | 106 |
| 105 zoom_controller_->SetZoomMode(ZoomController::ZOOM_MODE_ISOLATED); | 107 zoom_controller_->SetZoomMode(ZoomController::ZOOM_MODE_ISOLATED); |
| 106 | 108 |
| 107 ZoomController::ZoomChangedEventData zoom_change_data2( | 109 ZoomController::ZoomChangedEventData zoom_change_data2( |
| 108 web_contents(), | 110 web_contents(), |
| 109 old_zoom_level, | 111 old_zoom_level, |
| 110 new_zoom_level, | 112 new_zoom_level, |
| 111 ZoomController::ZOOM_MODE_ISOLATED, | 113 ZoomController::ZOOM_MODE_ISOLATED, |
| 112 false /* can_show_bubble */); | 114 true /* can_show_bubble */); |
| 113 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data2)).Times(1); | 115 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data2)).Times(1); |
| 114 | 116 |
| 115 zoom_controller_->SetZoomLevel(new_zoom_level); | 117 zoom_controller_->SetZoomLevel(new_zoom_level); |
| 116 } | 118 } |
| OLD | NEW |