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

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

Issue 996743003: Webview-based signin shouldn't create a partition for the embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Force expectation in IFrame signin test. Created 5 years, 9 months 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 double new_zoom_level = 232 double new_zoom_level =
233 host_zoom_map->GetZoomLevelForHostAndScheme(test_scheme, test_host) + 0.5; 233 host_zoom_map->GetZoomLevelForHostAndScheme(test_scheme, test_host) + 0.5;
234 host_zoom_map->SetZoomLevelForHostAndScheme(test_scheme, test_host, 234 host_zoom_map->SetZoomLevelForHostAndScheme(test_scheme, test_host,
235 new_zoom_level); 235 new_zoom_level);
236 observer.BlockUntilZoomLevelForHostHasChanged(test_host); 236 observer.BlockUntilZoomLevelForHostHasChanged(test_host);
237 EXPECT_EQ(new_zoom_level, host_zoom_map->GetZoomLevelForHostAndScheme( 237 EXPECT_EQ(new_zoom_level, host_zoom_map->GetZoomLevelForHostAndScheme(
238 test_scheme, test_host)); 238 test_scheme, test_host));
239 } 239 }
240 240
241 #if defined(OS_CHROMEOS)
Charlie Reis 2015/03/11 20:23:10 You need a comment that explains why this is disab
wjmaclean 2015/03/23 15:31:52 Let's force the test to run for ChromeOS, but chec
242 #define MAYBE_WebviewBasedSigninUsesDefaultStoragePartitionForEmbedder \
243 DISABLED_WebviewBasedSigninUsesDefaultStoragePartitionForEmbedder
244 #else
245 #define MAYBE_WebviewBasedSigninUsesDefaultStoragePartitionForEmbedder \
246 WebviewBasedSigninUsesDefaultStoragePartitionForEmbedder
247 #endif
248 IN_PROC_BROWSER_TEST_F(
249 HostZoomMapBrowserTest,
250 MAYBE_WebviewBasedSigninUsesDefaultStoragePartitionForEmbedder) {
251 GURL test_url = ConstructTestServerURL(chrome::kChromeUIChromeSigninURL);
252 std::string test_host(test_url.host());
253 std::string test_scheme(test_url.scheme());
254 ui_test_utils::NavigateToURL(browser(), test_url);
255
256 content::WebContents* web_contents =
257 browser()->tab_strip_model()->GetActiveWebContents();
258
259 HostZoomMap* host_zoom_map = HostZoomMap::GetForWebContents(web_contents);
260
261 // For the webview based sign-in code, the sign in page uses the default host
262 // zoom map.
263 HostZoomMap* default_profile_host_zoom_map =
264 HostZoomMap::GetDefaultForBrowserContext(browser()->profile());
265 EXPECT_TRUE(switches::IsEnableWebviewBasedSignin());
266 EXPECT_EQ(host_zoom_map, default_profile_host_zoom_map);
267 }
268
269 class HostZoomMapIframeSigninBrowserTest : public HostZoomMapBrowserTest {
270 public:
271 void SetUpCommandLine(base::CommandLine* command_line) override {
272 switches::EnableIframeBasedSigninForTesting(command_line);
273 }
274 };
275
241 // Regression test for crbug.com/435017. 276 // Regression test for crbug.com/435017.
242 IN_PROC_BROWSER_TEST_F(HostZoomMapBrowserTest, 277 IN_PROC_BROWSER_TEST_F(HostZoomMapIframeSigninBrowserTest,
243 EventsForNonDefaultStoragePartition) { 278 EventsForNonDefaultStoragePartition) {
244 ZoomLevelChangeObserver observer(browser()->profile()); 279 ZoomLevelChangeObserver observer(browser()->profile());
245 // TODO(wjmaclean): Make this test more general by implementing a way to 280 // TODO(wjmaclean): Make this test more general by implementing a way to
246 // force a generic URL to be loaded in a non-default storage partition. This 281 // force a generic URL to be loaded in a non-default storage partition. This
247 // test currently relies on the signin page being loaded into a non-default 282 // test currently relies on the signin page being loaded into a non-default
248 // storage partition (and verifies this is the case), but ultimately it would 283 // storage partition (and verifies this is the case), but ultimately it would
249 // be better not to rely on what the signin page is doing. 284 // be better not to rely on what the signin page is doing.
250 GURL test_url = ConstructTestServerURL(chrome::kChromeUIChromeSigninURL); 285 GURL test_url = ConstructTestServerURL(chrome::kChromeUIChromeSigninURL);
251 std::string test_host(test_url.host()); 286 std::string test_host(test_url.host());
252 std::string test_scheme(test_url.scheme()); 287 std::string test_scheme(test_url.scheme());
253 ui_test_utils::NavigateToURL(browser(), test_url); 288 ui_test_utils::NavigateToURL(browser(), test_url);
254 289
255 content::WebContents* web_contents = 290 content::WebContents* web_contents =
256 browser()->tab_strip_model()->GetActiveWebContents(); 291 browser()->tab_strip_model()->GetActiveWebContents();
257 292
258 // Verify that our loaded page is using a HostZoomMap different from the 293 // We are forcing non-webview based signin, so we expect the signin page to
259 // one for the default StoragePartition. 294 // be in a different storage partition, and hence a different HostZoomMap.
260 HostZoomMap* host_zoom_map = HostZoomMap::GetForWebContents(web_contents); 295 HostZoomMap* host_zoom_map = HostZoomMap::GetForWebContents(web_contents);
261 296
262 // For the webview based sign-in code, the sign in page uses the default host 297 // For the webview based sign-in code, the sign in page uses the default host
Charlie Reis 2015/03/11 20:23:10 Please update this comment.
wjmaclean 2015/03/23 15:31:52 Done.
263 // zoom map. 298 // zoom map.
264 if (!switches::IsEnableWebviewBasedSignin()) { 299 EXPECT_FALSE(switches::IsEnableWebviewBasedSignin());
265 HostZoomMap* default_profile_host_zoom_map = 300 HostZoomMap* default_profile_host_zoom_map =
266 HostZoomMap::GetDefaultForBrowserContext(browser()->profile()); 301 HostZoomMap::GetDefaultForBrowserContext(browser()->profile());
267 EXPECT_NE(host_zoom_map, default_profile_host_zoom_map); 302 EXPECT_NE(host_zoom_map, default_profile_host_zoom_map);
268 }
269 303
270 double new_zoom_level = 304 double new_zoom_level =
271 host_zoom_map->GetZoomLevelForHostAndScheme(test_scheme, test_host) + 0.5; 305 host_zoom_map->GetZoomLevelForHostAndScheme(test_scheme, test_host) + 0.5;
272 host_zoom_map->SetZoomLevelForHostAndScheme(test_scheme, test_host, 306 host_zoom_map->SetZoomLevelForHostAndScheme(test_scheme, test_host,
273 new_zoom_level); 307 new_zoom_level);
274 observer.BlockUntilZoomLevelForHostHasChanged(test_host); 308 observer.BlockUntilZoomLevelForHostHasChanged(test_host);
275 EXPECT_EQ(new_zoom_level, host_zoom_map->GetZoomLevelForHostAndScheme( 309 EXPECT_EQ(new_zoom_level, host_zoom_map->GetZoomLevelForHostAndScheme(
276 test_scheme, test_host)); 310 test_scheme, test_host));
277 } 311 }
278 312
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 HostZoomMap::GetDefaultForBrowserContext(child_profile); 514 HostZoomMap::GetDefaultForBrowserContext(child_profile);
481 ASSERT_TRUE(parent_host_zoom_map); 515 ASSERT_TRUE(parent_host_zoom_map);
482 ASSERT_TRUE(child_host_zoom_map); 516 ASSERT_TRUE(child_host_zoom_map);
483 EXPECT_NE(parent_host_zoom_map, child_host_zoom_map); 517 EXPECT_NE(parent_host_zoom_map, child_host_zoom_map);
484 EXPECT_NE(new_default_zoom_level, child_host_zoom_map->GetDefaultZoomLevel()); 518 EXPECT_NE(new_default_zoom_level, child_host_zoom_map->GetDefaultZoomLevel());
485 519
486 parent_profile->GetZoomLevelPrefs()->SetDefaultZoomLevelPref( 520 parent_profile->GetZoomLevelPrefs()->SetDefaultZoomLevelPref(
487 new_default_zoom_level); 521 new_default_zoom_level);
488 EXPECT_EQ(new_default_zoom_level, child_host_zoom_map->GetDefaultZoomLevel()); 522 EXPECT_EQ(new_default_zoom_level, child_host_zoom_map->GetDefaultZoomLevel());
489 } 523 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698