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 "content/public/browser/host_zoom_map.h" | 5 #include "content/public/browser/host_zoom_map.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 HostZoomMap::GetDefaultForBrowserContext(child_profile); | 425 HostZoomMap::GetDefaultForBrowserContext(child_profile); |
426 ASSERT_TRUE(parent_host_zoom_map); | 426 ASSERT_TRUE(parent_host_zoom_map); |
427 ASSERT_TRUE(child_host_zoom_map); | 427 ASSERT_TRUE(child_host_zoom_map); |
428 EXPECT_NE(parent_host_zoom_map, child_host_zoom_map); | 428 EXPECT_NE(parent_host_zoom_map, child_host_zoom_map); |
429 EXPECT_NE(new_default_zoom_level, child_host_zoom_map->GetDefaultZoomLevel()); | 429 EXPECT_NE(new_default_zoom_level, child_host_zoom_map->GetDefaultZoomLevel()); |
430 | 430 |
431 parent_profile->GetZoomLevelPrefs()->SetDefaultZoomLevelPref( | 431 parent_profile->GetZoomLevelPrefs()->SetDefaultZoomLevelPref( |
432 new_default_zoom_level); | 432 new_default_zoom_level); |
433 EXPECT_EQ(new_default_zoom_level, child_host_zoom_map->GetDefaultZoomLevel()); | 433 EXPECT_EQ(new_default_zoom_level, child_host_zoom_map->GetDefaultZoomLevel()); |
434 } | 434 } |
| 435 |
| 436 IN_PROC_BROWSER_TEST_F(HostZoomMapBrowserTest, PageScaleIsOneChanged) { |
| 437 GURL test_url(url::kAboutBlankURL); |
| 438 std::string test_host(test_url.host()); |
| 439 |
| 440 ui_test_utils::NavigateToURL(browser(), test_url); |
| 441 content::WebContents* web_contents = |
| 442 browser()->tab_strip_model()->GetActiveWebContents(); |
| 443 |
| 444 ASSERT_TRUE(content::HostZoomMap::PageScaleFactorIsOne(web_contents)); |
| 445 |
| 446 ZoomLevelChangeObserver observer(browser()->profile()); |
| 447 |
| 448 web_contents->SetPageScale(1.5); |
| 449 observer.BlockUntilZoomLevelForHostHasChanged(test_host); |
| 450 EXPECT_FALSE(content::HostZoomMap::PageScaleFactorIsOne(web_contents)); |
| 451 |
| 452 web_contents->SetPageScale(1.f); |
| 453 observer.BlockUntilZoomLevelForHostHasChanged(test_host); |
| 454 EXPECT_TRUE(content::HostZoomMap::PageScaleFactorIsOne(web_contents)); |
| 455 } |
OLD | NEW |