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

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

Issue 655063002: Use uint16 for port numbers more pervasively. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert bad change 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 : HostZoomMapBrowserTestWithPrefs(kSanitizationTestPrefs) {} 207 : HostZoomMapBrowserTestWithPrefs(kSanitizationTestPrefs) {}
208 208
209 private: 209 private:
210 DISALLOW_COPY_AND_ASSIGN(HostZoomMapSanitizationBrowserTest); 210 DISALLOW_COPY_AND_ASSIGN(HostZoomMapSanitizationBrowserTest);
211 }; 211 };
212 212
213 // Regression test for crbug.com/364399. 213 // Regression test for crbug.com/364399.
214 IN_PROC_BROWSER_TEST_F(HostZoomMapBrowserTest, ToggleDefaultZoomLevel) { 214 IN_PROC_BROWSER_TEST_F(HostZoomMapBrowserTest, ToggleDefaultZoomLevel) {
215 const double default_zoom_level = content::ZoomFactorToZoomLevel(1.5); 215 const double default_zoom_level = content::ZoomFactorToZoomLevel(1.5);
216 216
217 const char kTestURLTemplate1[] = "http://host1:%d/"; 217 const char kTestURLTemplate1[] = "http://host1:%u/";
218 const char kTestURLTemplate2[] = "http://host2:%d/"; 218 const char kTestURLTemplate2[] = "http://host2:%u/";
219 219
220 ZoomLevelChangeObserver observer(browser()->profile()); 220 ZoomLevelChangeObserver observer(browser()->profile());
221 221
222 GURL test_url1 = ConstructTestServerURL(kTestURLTemplate1); 222 GURL test_url1 = ConstructTestServerURL(kTestURLTemplate1);
223 ui_test_utils::NavigateToURL(browser(), test_url1); 223 ui_test_utils::NavigateToURL(browser(), test_url1);
224 224
225 SetDefaultZoomLevel(default_zoom_level); 225 SetDefaultZoomLevel(default_zoom_level);
226 observer.BlockUntilZoomLevelForHostHasChanged(test_url1.host()); 226 observer.BlockUntilZoomLevelForHostHasChanged(test_url1.host());
227 EXPECT_TRUE( 227 EXPECT_TRUE(
228 content::ZoomValuesEqual(default_zoom_level, GetZoomLevel(test_url1))); 228 content::ZoomValuesEqual(default_zoom_level, GetZoomLevel(test_url1)));
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 profile_prefs->GetDictionary(prefs::kPerHostZoomLevelsDeprecated); 323 profile_prefs->GetDictionary(prefs::kPerHostZoomLevelsDeprecated);
324 EXPECT_EQ(0UL, profile_host_zoom_dictionary->size()); 324 EXPECT_EQ(0UL, profile_host_zoom_dictionary->size());
325 } 325 }
326 326
327 // Make sure a change to the default zoom level doesn't propagate to the 327 // Make sure a change to the default zoom level doesn't propagate to the
328 // profile prefs. 328 // profile prefs.
329 329
330 // First, we need a host at the default zoom level to respond when the 330 // First, we need a host at the default zoom level to respond when the
331 // default zoom level changes. 331 // default zoom level changes.
332 const double kNewDefaultZoomLevel = 1.5; 332 const double kNewDefaultZoomLevel = 1.5;
333 GURL test_url = ConstructTestServerURL("http://host4:%d/"); 333 GURL test_url = ConstructTestServerURL("http://host4:%u/");
334 ui_test_utils::NavigateToURL(browser(), test_url); 334 ui_test_utils::NavigateToURL(browser(), test_url);
335 EXPECT_TRUE(content::ZoomValuesEqual(kOriginalDefaultZoomLevel, 335 EXPECT_TRUE(content::ZoomValuesEqual(kOriginalDefaultZoomLevel,
336 GetZoomLevel(test_url))); 336 GetZoomLevel(test_url)));
337 337
338 // Change the default zoom level and observe. 338 // Change the default zoom level and observe.
339 SetDefaultZoomLevel(kNewDefaultZoomLevel); 339 SetDefaultZoomLevel(kNewDefaultZoomLevel);
340 observer.BlockUntilZoomLevelForHostHasChanged(test_url.host()); 340 observer.BlockUntilZoomLevelForHostHasChanged(test_url.host());
341 EXPECT_TRUE( 341 EXPECT_TRUE(
342 content::ZoomValuesEqual(kNewDefaultZoomLevel, GetZoomLevel(test_url))); 342 content::ZoomValuesEqual(kNewDefaultZoomLevel, GetZoomLevel(test_url)));
343 EXPECT_EQ(kNewDefaultZoomLevel, zoom_level_prefs->GetDefaultZoomLevelPref()); 343 EXPECT_EQ(kNewDefaultZoomLevel, zoom_level_prefs->GetDefaultZoomLevelPref());
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 parent_zoom_map->SetZoomLevelForHost(host, zoom_level_40); 392 parent_zoom_map->SetZoomLevelForHost(host, zoom_level_40);
393 ASSERT_EQ( 393 ASSERT_EQ(
394 parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), 394 parent_zoom_map->GetZoomLevelForHostAndScheme("http", host),
395 zoom_level_40); 395 zoom_level_40);
396 396
397 EXPECT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host), 397 EXPECT_EQ(parent_zoom_map->GetZoomLevelForHostAndScheme("http", host),
398 child_zoom_map->GetZoomLevelForHostAndScheme("http", host)) << 398 child_zoom_map->GetZoomLevelForHostAndScheme("http", host)) <<
399 "Parent change should propagate to child."; 399 "Parent change should propagate to child.";
400 base::RunLoop().RunUntilIdle(); 400 base::RunLoop().RunUntilIdle();
401 } 401 }
OLDNEW
« no previous file with comments | « chrome/browser/net/sdch_browsertest.cc ('k') | chrome/common/extensions/permissions/permissions_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698