| 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 "chrome/browser/ui/zoom/zoom_controller.h" | 5 #include "chrome/browser/ui/zoom/zoom_controller.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/process/kill.h" | 8 #include "base/process/kill.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 ZoomController* zoom_controller = | 82 ZoomController* zoom_controller = |
| 83 ZoomController::FromWebContents(web_contents); | 83 ZoomController::FromWebContents(web_contents); |
| 84 | 84 |
| 85 double old_zoom_level = zoom_controller->GetZoomLevel(); | 85 double old_zoom_level = zoom_controller->GetZoomLevel(); |
| 86 double new_zoom_level = old_zoom_level + 0.5; | 86 double new_zoom_level = old_zoom_level + 0.5; |
| 87 | 87 |
| 88 content::RenderProcessHost* host = web_contents->GetRenderProcessHost(); | 88 content::RenderProcessHost* host = web_contents->GetRenderProcessHost(); |
| 89 { | 89 { |
| 90 content::RenderProcessHostWatcher crash_observer( | 90 content::RenderProcessHostWatcher crash_observer( |
| 91 host, content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 91 host, content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
| 92 base::KillProcess(host->GetHandle(), 0, false); | 92 host->Shutdown(0, false); |
| 93 crash_observer.Wait(); | 93 crash_observer.Wait(); |
| 94 } | 94 } |
| 95 EXPECT_FALSE(web_contents->GetRenderViewHost()->IsRenderViewLive()); | 95 EXPECT_FALSE(web_contents->GetRenderViewHost()->IsRenderViewLive()); |
| 96 | 96 |
| 97 // The following attempt to change the zoom level for a crashed tab should | 97 // The following attempt to change the zoom level for a crashed tab should |
| 98 // fail. | 98 // fail. |
| 99 zoom_controller->SetZoomLevel(new_zoom_level); | 99 zoom_controller->SetZoomLevel(new_zoom_level); |
| 100 EXPECT_FLOAT_EQ(old_zoom_level, zoom_controller->GetZoomLevel()); | 100 EXPECT_FLOAT_EQ(old_zoom_level, zoom_controller->GetZoomLevel()); |
| 101 } | 101 } |
| 102 | 102 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 ZoomController::ZOOM_MODE_DEFAULT, | 159 ZoomController::ZOOM_MODE_DEFAULT, |
| 160 true); // We have a non-empty host, so this will be 'true'. | 160 true); // We have a non-empty host, so this will be 'true'. |
| 161 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data)).Times(1); | 161 EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data)).Times(1); |
| 162 | 162 |
| 163 content::HostZoomMap* host_zoom_map = | 163 content::HostZoomMap* host_zoom_map = |
| 164 content::HostZoomMap::GetDefaultForBrowserContext( | 164 content::HostZoomMap::GetDefaultForBrowserContext( |
| 165 web_contents->GetBrowserContext()); | 165 web_contents->GetBrowserContext()); |
| 166 | 166 |
| 167 host_zoom_map->SetZoomLevelForHost("about:blank", new_zoom_level); | 167 host_zoom_map->SetZoomLevelForHost("about:blank", new_zoom_level); |
| 168 } | 168 } |
| OLD | NEW |