Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: chrome/browser/profiles/host_zoom_map_browsertest.cc

Issue 716223002: Use uint16 for port numbers, chrome/ edition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self-review Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 : HostZoomMapBrowserTestWithPrefs(kSanitizationTestPrefs) {} 204 : HostZoomMapBrowserTestWithPrefs(kSanitizationTestPrefs) {}
205 205
206 private: 206 private:
207 DISALLOW_COPY_AND_ASSIGN(HostZoomMapSanitizationBrowserTest); 207 DISALLOW_COPY_AND_ASSIGN(HostZoomMapSanitizationBrowserTest);
208 }; 208 };
209 209
210 // Regression test for crbug.com/364399. 210 // Regression test for crbug.com/364399.
211 IN_PROC_BROWSER_TEST_F(HostZoomMapBrowserTest, ToggleDefaultZoomLevel) { 211 IN_PROC_BROWSER_TEST_F(HostZoomMapBrowserTest, ToggleDefaultZoomLevel) {
212 const double default_zoom_level = content::ZoomFactorToZoomLevel(1.5); 212 const double default_zoom_level = content::ZoomFactorToZoomLevel(1.5);
213 213
214 const char kTestURLTemplate1[] = "http://host1:%d/"; 214 const char kTestURLTemplate1[] = "http://host1:%u/";
215 const char kTestURLTemplate2[] = "http://host2:%d/"; 215 const char kTestURLTemplate2[] = "http://host2:%u/";
216 216
217 ZoomLevelChangeObserver observer(browser()->profile()); 217 ZoomLevelChangeObserver observer(browser()->profile());
218 218
219 GURL test_url1 = ConstructTestServerURL(kTestURLTemplate1); 219 GURL test_url1 = ConstructTestServerURL(kTestURLTemplate1);
220 ui_test_utils::NavigateToURL(browser(), test_url1); 220 ui_test_utils::NavigateToURL(browser(), test_url1);
221 221
222 SetDefaultZoomLevel(default_zoom_level); 222 SetDefaultZoomLevel(default_zoom_level);
223 observer.BlockUntilZoomLevelForHostHasChanged(test_url1.host()); 223 observer.BlockUntilZoomLevelForHostHasChanged(test_url1.host());
224 EXPECT_TRUE( 224 EXPECT_TRUE(
225 content::ZoomValuesEqual(default_zoom_level, GetZoomLevel(test_url1))); 225 content::ZoomValuesEqual(default_zoom_level, GetZoomLevel(test_url1)));
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 profile_prefs->GetDictionary(prefs::kPerHostZoomLevelsDeprecated); 320 profile_prefs->GetDictionary(prefs::kPerHostZoomLevelsDeprecated);
321 EXPECT_EQ(0UL, profile_host_zoom_dictionary->size()); 321 EXPECT_EQ(0UL, profile_host_zoom_dictionary->size());
322 } 322 }
323 323
324 // Make sure a change to the default zoom level doesn't propagate to the 324 // Make sure a change to the default zoom level doesn't propagate to the
325 // profile prefs. 325 // profile prefs.
326 326
327 // First, we need a host at the default zoom level to respond when the 327 // First, we need a host at the default zoom level to respond when the
328 // default zoom level changes. 328 // default zoom level changes.
329 const double kNewDefaultZoomLevel = 1.5; 329 const double kNewDefaultZoomLevel = 1.5;
330 GURL test_url = ConstructTestServerURL("http://host4:%d/"); 330 GURL test_url = ConstructTestServerURL("http://host4:%u/");
331 ui_test_utils::NavigateToURL(browser(), test_url); 331 ui_test_utils::NavigateToURL(browser(), test_url);
332 EXPECT_TRUE(content::ZoomValuesEqual(kOriginalDefaultZoomLevel, 332 EXPECT_TRUE(content::ZoomValuesEqual(kOriginalDefaultZoomLevel,
333 GetZoomLevel(test_url))); 333 GetZoomLevel(test_url)));
334 334
335 // Change the default zoom level and observe. 335 // Change the default zoom level and observe.
336 SetDefaultZoomLevel(kNewDefaultZoomLevel); 336 SetDefaultZoomLevel(kNewDefaultZoomLevel);
337 observer.BlockUntilZoomLevelForHostHasChanged(test_url.host()); 337 observer.BlockUntilZoomLevelForHostHasChanged(test_url.host());
338 EXPECT_TRUE( 338 EXPECT_TRUE(
339 content::ZoomValuesEqual(kNewDefaultZoomLevel, GetZoomLevel(test_url))); 339 content::ZoomValuesEqual(kNewDefaultZoomLevel, GetZoomLevel(test_url)));
340 EXPECT_EQ(kNewDefaultZoomLevel, zoom_level_prefs->GetDefaultZoomLevelPref()); 340 EXPECT_EQ(kNewDefaultZoomLevel, zoom_level_prefs->GetDefaultZoomLevelPref());
341 EXPECT_EQ(0.0, profile_prefs->GetDouble(prefs::kDefaultZoomLevelDeprecated)); 341 EXPECT_EQ(0.0, profile_prefs->GetDouble(prefs::kDefaultZoomLevelDeprecated));
342 } 342 }
343 343
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698