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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2949073002: Changing scroll and view state in onpopstate shouldn't overwrite back/forward state restore (Closed)
Patch Set: Reset ViewState when trying to copy from a nullptr Created 3 years, 5 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after
2441 FrameTestHelpers::WebViewHelper web_view_helper; 2441 FrameTestHelpers::WebViewHelper web_view_helper;
2442 web_view_helper.InitializeAndLoad(base_url_ + "fixed_layout.html", nullptr, 2442 web_view_helper.InitializeAndLoad(base_url_ + "fixed_layout.html", nullptr,
2443 &client, nullptr, ConfigureAndroid); 2443 &client, nullptr, ConfigureAndroid);
2444 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); 2444 web_view_helper.Resize(WebSize(viewport_width, viewport_height));
2445 2445
2446 web_view_helper.WebView()->SetPageScaleFactor(3); 2446 web_view_helper.WebView()->SetPageScaleFactor(3);
2447 EXPECT_EQ(3, ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) 2447 EXPECT_EQ(3, ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame())
2448 ->Loader() 2448 ->Loader()
2449 .GetDocumentLoader() 2449 .GetDocumentLoader()
2450 ->GetHistoryItem() 2450 ->GetHistoryItem()
2451 ->PageScaleFactor()); 2451 ->GetViewState()
2452 ->page_scale_factor_);
2452 } 2453 }
2453 2454
2454 TEST_P(ParameterizedWebFrameTest, initialScaleWrittenToHistoryItem) { 2455 TEST_P(ParameterizedWebFrameTest, initialScaleWrittenToHistoryItem) {
2455 RegisterMockedHttpURLLoad("fixed_layout.html"); 2456 RegisterMockedHttpURLLoad("fixed_layout.html");
2456 2457
2457 FixedLayoutTestWebViewClient client; 2458 FixedLayoutTestWebViewClient client;
2458 client.screen_info_.device_scale_factor = 1; 2459 client.screen_info_.device_scale_factor = 1;
2459 int viewport_width = 640; 2460 int viewport_width = 640;
2460 int viewport_height = 480; 2461 int viewport_height = 480;
2461 2462
2462 FrameTestHelpers::WebViewHelper web_view_helper; 2463 FrameTestHelpers::WebViewHelper web_view_helper;
2463 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); 2464 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid);
2464 web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); 2465 web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5);
2465 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), 2466 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(),
2466 base_url_ + "fixed_layout.html"); 2467 base_url_ + "fixed_layout.html");
2467 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); 2468 web_view_helper.Resize(WebSize(viewport_width, viewport_height));
2468 2469
2469 int default_fixed_layout_width = 980; 2470 int default_fixed_layout_width = 980;
2470 float minimum_page_scale_factor = 2471 float minimum_page_scale_factor =
2471 viewport_width / (float)default_fixed_layout_width; 2472 viewport_width / (float)default_fixed_layout_width;
2472 EXPECT_EQ(minimum_page_scale_factor, 2473 EXPECT_EQ(minimum_page_scale_factor,
2473 ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) 2474 ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame())
2474 ->Loader() 2475 ->Loader()
2475 .GetDocumentLoader() 2476 .GetDocumentLoader()
2476 ->GetHistoryItem() 2477 ->GetHistoryItem()
2477 ->PageScaleFactor()); 2478 ->GetViewState()
2479 ->page_scale_factor_);
2478 } 2480 }
2479 2481
2480 TEST_P(ParameterizedWebFrameTest, pageScaleFactorDoesntShrinkFrameView) { 2482 TEST_P(ParameterizedWebFrameTest, pageScaleFactorDoesntShrinkFrameView) {
2481 RegisterMockedHttpURLLoad("large-div.html"); 2483 RegisterMockedHttpURLLoad("large-div.html");
2482 2484
2483 FixedLayoutTestWebViewClient client; 2485 FixedLayoutTestWebViewClient client;
2484 client.screen_info_.device_scale_factor = 1; 2486 client.screen_info_.device_scale_factor = 1;
2485 // Small viewport to ensure there are always scrollbars. 2487 // Small viewport to ensure there are always scrollbars.
2486 int viewport_width = 64; 2488 int viewport_width = 64;
2487 int viewport_height = 48; 2489 int viewport_height = 48;
(...skipping 9576 matching lines...) Expand 10 before | Expand all | Expand 10 after
12064 tester.ExpectBucketCount(histogramName, kSPANavTypeOtherFragmentNavigation, 12066 tester.ExpectBucketCount(histogramName, kSPANavTypeOtherFragmentNavigation,
12065 1); 12067 1);
12066 // kSameDocumentNavigationHistoryApi and kFrameLoadTypeBackForward is an 12068 // kSameDocumentNavigationHistoryApi and kFrameLoadTypeBackForward is an
12067 // illegal combination, which has been caught by DCHECK in 12069 // illegal combination, which has been caught by DCHECK in
12068 // UpdateForSameDocumentNavigation(). 12070 // UpdateForSameDocumentNavigation().
12069 12071
12070 tester.ExpectTotalCount(histogramName, 3); 12072 tester.ExpectTotalCount(histogramName, 3);
12071 } 12073 }
12072 12074
12073 } // namespace blink 12075 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | third_party/WebKit/public/web/WebHistoryItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698