| Index: chrome/browser/profiles/host_zoom_map_browsertest.cc
|
| diff --git a/chrome/browser/profiles/host_zoom_map_browsertest.cc b/chrome/browser/profiles/host_zoom_map_browsertest.cc
|
| index afb92bb131e8332329d7ff6e9729c954b3e7def4..3ec5812af695d36d87433c3d5c03dc91bbb1672f 100644
|
| --- a/chrome/browser/profiles/host_zoom_map_browsertest.cc
|
| +++ b/chrome/browser/profiles/host_zoom_map_browsertest.cc
|
| @@ -37,6 +37,9 @@
|
| #include "components/zoom/page_zoom.h"
|
| #include "components/zoom/zoom_event_manager.h"
|
| #include "content/public/browser/host_zoom_map.h"
|
| +#include "content/public/browser/render_frame_host.h"
|
| +#include "content/public/browser/render_process_host.h"
|
| +#include "content/public/browser/render_view_host.h"
|
| #include "content/public/test/test_utils.h"
|
| #include "net/dns/mock_host_resolver.h"
|
| #include "net/test/embedded_test_server/embedded_test_server.h"
|
| @@ -416,3 +419,40 @@ IN_PROC_BROWSER_TEST_F(HostZoomMapBrowserTest, PageScaleIsOneChanged) {
|
| observer.BlockUntilZoomLevelForHostHasChanged(test_host);
|
| EXPECT_TRUE(content::HostZoomMap::PageScaleFactorIsOne(web_contents));
|
| }
|
| +
|
| +// Test to make sure that temporary zoom levels can be copied to
|
| +// new views.
|
| +IN_PROC_BROWSER_TEST_F(HostZoomMapBrowserTest,
|
| + PreserveTemporaryZoomLevelFrom) {
|
| + ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL));
|
| + content::WebContents* old_web_contents =
|
| + browser()->tab_strip_model()->GetActiveWebContents();
|
| + HostZoomMap* old_host_zoom_map =
|
| + HostZoomMap::GetForWebContents(old_web_contents);
|
| + content::RenderViewHost* old_view_host =
|
| + old_web_contents->GetMainFrame()->GetRenderViewHost();
|
| +
|
| + double temp_zoom_level = old_host_zoom_map->GetDefaultZoomLevel() + 1.0;
|
| +
|
| + old_host_zoom_map->SetTemporaryZoomLevel(
|
| + old_view_host->GetProcess()->GetID(), old_view_host->GetRoutingID(),
|
| + temp_zoom_level);
|
| +
|
| + ui_test_utils::NavigateToURLWithDisposition(
|
| + browser(), GURL(url::kAboutBlankURL),
|
| + WindowOpenDisposition::NEW_FOREGROUND_TAB,
|
| + ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
|
| + content::WebContents* new_web_contents =
|
| + browser()->tab_strip_model()->GetActiveWebContents();
|
| + ASSERT_NE(old_web_contents, new_web_contents);
|
| + HostZoomMap* new_host_zoom_map =
|
| + HostZoomMap::GetForWebContents(new_web_contents);
|
| +
|
| + ASSERT_FALSE(content::ZoomValuesEqual(
|
| + temp_zoom_level, HostZoomMap::GetZoomLevel(new_web_contents)));
|
| + new_host_zoom_map->PreserveTemporaryZoomLevelFrom(
|
| + old_host_zoom_map, old_web_contents->GetMainFrame(),
|
| + new_web_contents->GetMainFrame());
|
| + EXPECT_TRUE(content::ZoomValuesEqual(
|
| + temp_zoom_level, HostZoomMap::GetZoomLevel(new_web_contents)));
|
| +}
|
|
|