| 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 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 25 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" | 25 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" |
| 26 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
| 27 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
| 28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 29 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
| 30 #include "chrome/test/base/in_process_browser_test.h" | 30 #include "chrome/test/base/in_process_browser_test.h" |
| 31 #include "chrome/test/base/testing_profile.h" | 31 #include "chrome/test/base/testing_profile.h" |
| 32 #include "chrome/test/base/ui_test_utils.h" | 32 #include "chrome/test/base/ui_test_utils.h" |
| 33 #include "components/signin/core/common/profile_management_switches.h" |
| 33 #include "components/ui/zoom/zoom_event_manager.h" | 34 #include "components/ui/zoom/zoom_event_manager.h" |
| 34 #include "content/public/test/test_utils.h" | 35 #include "content/public/test/test_utils.h" |
| 35 #include "net/dns/mock_host_resolver.h" | 36 #include "net/dns/mock_host_resolver.h" |
| 36 #include "net/test/embedded_test_server/embedded_test_server.h" | 37 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 37 #include "net/test/embedded_test_server/http_response.h" | 38 #include "net/test/embedded_test_server/http_response.h" |
| 38 #include "testing/gmock/include/gmock/gmock.h" | 39 #include "testing/gmock/include/gmock/gmock.h" |
| 39 #include "url/gurl.h" | 40 #include "url/gurl.h" |
| 40 | 41 |
| 41 using content::HostZoomMap; | 42 using content::HostZoomMap; |
| 42 | 43 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 std::string test_host(test_url.host()); | 251 std::string test_host(test_url.host()); |
| 251 std::string test_scheme(test_url.scheme()); | 252 std::string test_scheme(test_url.scheme()); |
| 252 ui_test_utils::NavigateToURL(browser(), test_url); | 253 ui_test_utils::NavigateToURL(browser(), test_url); |
| 253 | 254 |
| 254 content::WebContents* web_contents = | 255 content::WebContents* web_contents = |
| 255 browser()->tab_strip_model()->GetActiveWebContents(); | 256 browser()->tab_strip_model()->GetActiveWebContents(); |
| 256 | 257 |
| 257 // Verify that our loaded page is using a HostZoomMap different from the | 258 // Verify that our loaded page is using a HostZoomMap different from the |
| 258 // one for the default StoragePartition. | 259 // one for the default StoragePartition. |
| 259 HostZoomMap* host_zoom_map = HostZoomMap::GetForWebContents(web_contents); | 260 HostZoomMap* host_zoom_map = HostZoomMap::GetForWebContents(web_contents); |
| 260 HostZoomMap* default_profile_host_zoom_map = | 261 |
| 261 HostZoomMap::GetDefaultForBrowserContext(browser()->profile()); | 262 // For the webview based sign-in code, the sign in page uses the default host |
| 262 EXPECT_NE(host_zoom_map, default_profile_host_zoom_map); | 263 // zoom map. |
| 264 if (!switches::IsEnableWebviewBasedSignin()) { |
| 265 HostZoomMap* default_profile_host_zoom_map = |
| 266 HostZoomMap::GetDefaultForBrowserContext(browser()->profile()); |
| 267 EXPECT_NE(host_zoom_map, default_profile_host_zoom_map); |
| 268 } |
| 263 | 269 |
| 264 double new_zoom_level = | 270 double new_zoom_level = |
| 265 host_zoom_map->GetZoomLevelForHostAndScheme(test_scheme, test_host) + 0.5; | 271 host_zoom_map->GetZoomLevelForHostAndScheme(test_scheme, test_host) + 0.5; |
| 266 host_zoom_map->SetZoomLevelForHostAndScheme(test_scheme, test_host, | 272 host_zoom_map->SetZoomLevelForHostAndScheme(test_scheme, test_host, |
| 267 new_zoom_level); | 273 new_zoom_level); |
| 268 observer.BlockUntilZoomLevelForHostHasChanged(test_host); | 274 observer.BlockUntilZoomLevelForHostHasChanged(test_host); |
| 269 EXPECT_EQ(new_zoom_level, host_zoom_map->GetZoomLevelForHostAndScheme( | 275 EXPECT_EQ(new_zoom_level, host_zoom_map->GetZoomLevelForHostAndScheme( |
| 270 test_scheme, test_host)); | 276 test_scheme, test_host)); |
| 271 } | 277 } |
| 272 | 278 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 parent_zoom_map->SetZoomLevelForHost(host, zoom_level_40); | 458 parent_zoom_map->SetZoomLevelForHost(host, zoom_level_40); |
| 453 ASSERT_EQ( | 459 ASSERT_EQ( |
| 454 parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), | 460 parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), |
| 455 zoom_level_40); | 461 zoom_level_40); |
| 456 | 462 |
| 457 EXPECT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), | 463 EXPECT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), |
| 458 child_zoom_map->GetZoomLevelForHostAndScheme("http", host)) << | 464 child_zoom_map->GetZoomLevelForHostAndScheme("http", host)) << |
| 459 "Parent change should propagate to child."; | 465 "Parent change should propagate to child."; |
| 460 base::RunLoop().RunUntilIdle(); | 466 base::RunLoop().RunUntilIdle(); |
| 461 } | 467 } |
| OLD | NEW |