| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "content/browser/host_zoom_map_impl.h" | 5 #include "content/browser/host_zoom_map_impl.h" |
| 6 | 6 |
| 7 #include "content/public/browser/render_process_host.h" | 7 #include "content/public/browser/render_process_host.h" |
| 8 #include "content/public/browser/render_view_host.h" | 8 #include "content/public/browser/render_view_host.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 #include "content/public/test/content_browser_test.h" | 10 #include "content/public/test/content_browser_test.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 void RunTestForURL(const GURL& url, | 26 void RunTestForURL(const GURL& url, |
| 27 Shell* shell, | 27 Shell* shell, |
| 28 double host_zoom_level, | 28 double host_zoom_level, |
| 29 double temp_zoom_level) { | 29 double temp_zoom_level) { |
| 30 WebContents* web_contents = shell->web_contents(); | 30 WebContents* web_contents = shell->web_contents(); |
| 31 | 31 |
| 32 HostZoomMapImpl* host_zoom_map = static_cast<HostZoomMapImpl*>( | 32 HostZoomMapImpl* host_zoom_map = static_cast<HostZoomMapImpl*>( |
| 33 HostZoomMap::GetForWebContents(web_contents)); | 33 HostZoomMap::GetForWebContents(web_contents)); |
| 34 | 34 |
| 35 int view_id = web_contents->GetRoutingID(); | 35 int view_id = web_contents->GetRenderViewHost()->GetRoutingID(); |
| 36 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); | 36 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); |
| 37 | 37 |
| 38 // Assume caller has set the zoom level to |host_zoom_level| using | 38 // Assume caller has set the zoom level to |host_zoom_level| using |
| 39 // either a host or host+scheme entry in the HostZoomMap prior to | 39 // either a host or host+scheme entry in the HostZoomMap prior to |
| 40 // calling this function. | 40 // calling this function. |
| 41 EXPECT_DOUBLE_EQ(host_zoom_level, host_zoom_map->GetZoomLevelForView( | 41 EXPECT_DOUBLE_EQ(host_zoom_level, host_zoom_map->GetZoomLevelForView( |
| 42 url, render_process_id, view_id)); | 42 url, render_process_id, view_id)); |
| 43 | 43 |
| 44 // Make sure that GetZoomLevelForView() works for temporary zoom levels. | 44 // Make sure that GetZoomLevelForView() works for temporary zoom levels. |
| 45 host_zoom_map->SetTemporaryZoomLevel(render_process_id, view_id, | 45 host_zoom_map->SetTemporaryZoomLevel(render_process_id, view_id, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 double host_zoom_level = default_zoom_level + 1.0; | 89 double host_zoom_level = default_zoom_level + 1.0; |
| 90 double temp_zoom_level = default_zoom_level + 2.0; | 90 double temp_zoom_level = default_zoom_level + 2.0; |
| 91 | 91 |
| 92 host_zoom_map->SetZoomLevelForHostAndScheme(url.scheme(), url.host(), | 92 host_zoom_map->SetZoomLevelForHostAndScheme(url.scheme(), url.host(), |
| 93 host_zoom_level); | 93 host_zoom_level); |
| 94 | 94 |
| 95 RunTestForURL(url, shell(), host_zoom_level, temp_zoom_level); | 95 RunTestForURL(url, shell(), host_zoom_level, temp_zoom_level); |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace content | 98 } // namespace content |
| OLD | NEW |