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

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

Issue 1412453002: Remove enable-iframe-based-signin flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded test class Created 5 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 content::WebContents* web_contents = 251 content::WebContents* web_contents =
252 browser()->tab_strip_model()->GetActiveWebContents(); 252 browser()->tab_strip_model()->GetActiveWebContents();
253 253
254 HostZoomMap* host_zoom_map = HostZoomMap::GetForWebContents(web_contents); 254 HostZoomMap* host_zoom_map = HostZoomMap::GetForWebContents(web_contents);
255 255
256 // For the webview based sign-in code, the sign in page uses the default host 256 // For the webview based sign-in code, the sign in page uses the default host
257 // zoom map. 257 // zoom map.
258 HostZoomMap* default_profile_host_zoom_map = 258 HostZoomMap* default_profile_host_zoom_map =
259 HostZoomMap::GetDefaultForBrowserContext(browser()->profile()); 259 HostZoomMap::GetDefaultForBrowserContext(browser()->profile());
260 // Since ChromeOS still uses IFrame-based signin, we should expect the 260 EXPECT_EQ(host_zoom_map, default_profile_host_zoom_map);
261 // storage partition to be different if Webview signin is not enabled.
262 if (switches::IsEnableWebviewBasedSignin())
263 EXPECT_EQ(host_zoom_map, default_profile_host_zoom_map);
264 else
265 EXPECT_NE(host_zoom_map, default_profile_host_zoom_map);
266 }
267
268 class HostZoomMapIframeSigninBrowserTest : public HostZoomMapBrowserTest {
269 public:
270 void SetUpCommandLine(base::CommandLine* command_line) override {
271 command_line->AppendSwitch(switches::kEnableIframeBasedSignin);
272 }
273 };
274
275 // Regression test for crbug.com/435017.
276 IN_PROC_BROWSER_TEST_F(HostZoomMapIframeSigninBrowserTest,
277 EventsForNonDefaultStoragePartition) {
278 ZoomLevelChangeObserver observer(browser()->profile());
279 // TODO(wjmaclean): Make this test more general by implementing a way to
280 // force a generic URL to be loaded in a non-default storage partition. This
281 // test currently relies on the signin page being loaded into a non-default
282 // storage partition (and verifies this is the case), but ultimately it would
283 // be better not to rely on what the signin page is doing.
284 GURL test_url = ConstructTestServerURL(chrome::kChromeUIChromeSigninURL);
285 std::string test_host(test_url.host());
286 std::string test_scheme(test_url.scheme());
287 ui_test_utils::NavigateToURL(browser(), test_url);
288
289 content::WebContents* web_contents =
290 browser()->tab_strip_model()->GetActiveWebContents();
291
292 // We are forcing non-webview based signin, so we expect the signin page to
293 // be in a different storage partition, and hence a different HostZoomMap.
294 HostZoomMap* host_zoom_map = HostZoomMap::GetForWebContents(web_contents);
295
296 EXPECT_FALSE(switches::IsEnableWebviewBasedSignin());
297 HostZoomMap* default_profile_host_zoom_map =
298 HostZoomMap::GetDefaultForBrowserContext(browser()->profile());
299 EXPECT_NE(host_zoom_map, default_profile_host_zoom_map);
300
301 double new_zoom_level =
302 host_zoom_map->GetZoomLevelForHostAndScheme(test_scheme, test_host) + 0.5;
303 host_zoom_map->SetZoomLevelForHostAndScheme(test_scheme, test_host,
304 new_zoom_level);
305 observer.BlockUntilZoomLevelForHostHasChanged(test_host);
306 EXPECT_EQ(new_zoom_level, host_zoom_map->GetZoomLevelForHostAndScheme(
307 test_scheme, test_host));
308 } 261 }
309 262
310 // Regression test for crbug.com/364399. 263 // Regression test for crbug.com/364399.
311 IN_PROC_BROWSER_TEST_F(HostZoomMapBrowserTest, ToggleDefaultZoomLevel) { 264 IN_PROC_BROWSER_TEST_F(HostZoomMapBrowserTest, ToggleDefaultZoomLevel) {
312 const double default_zoom_level = content::ZoomFactorToZoomLevel(1.5); 265 const double default_zoom_level = content::ZoomFactorToZoomLevel(1.5);
313 266
314 const char kTestURLTemplate1[] = "http://host1:%u/"; 267 const char kTestURLTemplate1[] = "http://host1:%u/";
315 const char kTestURLTemplate2[] = "http://host2:%u/"; 268 const char kTestURLTemplate2[] = "http://host2:%u/";
316 269
317 ZoomLevelChangeObserver observer(browser()->profile()); 270 ZoomLevelChangeObserver observer(browser()->profile());
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 HostZoomMap::GetDefaultForBrowserContext(child_profile); 378 HostZoomMap::GetDefaultForBrowserContext(child_profile);
426 ASSERT_TRUE(parent_host_zoom_map); 379 ASSERT_TRUE(parent_host_zoom_map);
427 ASSERT_TRUE(child_host_zoom_map); 380 ASSERT_TRUE(child_host_zoom_map);
428 EXPECT_NE(parent_host_zoom_map, child_host_zoom_map); 381 EXPECT_NE(parent_host_zoom_map, child_host_zoom_map);
429 EXPECT_NE(new_default_zoom_level, child_host_zoom_map->GetDefaultZoomLevel()); 382 EXPECT_NE(new_default_zoom_level, child_host_zoom_map->GetDefaultZoomLevel());
430 383
431 parent_profile->GetZoomLevelPrefs()->SetDefaultZoomLevelPref( 384 parent_profile->GetZoomLevelPrefs()->SetDefaultZoomLevelPref(
432 new_default_zoom_level); 385 new_default_zoom_level);
433 EXPECT_EQ(new_default_zoom_level, child_host_zoom_map->GetDefaultZoomLevel()); 386 EXPECT_EQ(new_default_zoom_level, child_host_zoom_map->GetDefaultZoomLevel());
434 } 387 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698