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

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

Issue 2898423002: Reset scroll and scale while toggling "Request desktop site" (Closed)
Patch Set: WebView bug Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4255 matching lines...) Expand 10 before | Expand all | Expand 10 after
4266 RegisterMockedHttpURLLoad(third_url); 4266 RegisterMockedHttpURLLoad(third_url);
4267 4267
4268 ClearScrollStateOnCommitWebFrameClient client; 4268 ClearScrollStateOnCommitWebFrameClient client;
4269 FrameTestHelpers::WebViewHelper web_view_helper; 4269 FrameTestHelpers::WebViewHelper web_view_helper;
4270 web_view_helper.InitializeAndLoad(base_url_ + first_url, true, &client); 4270 web_view_helper.InitializeAndLoad(base_url_ + first_url, true, &client);
4271 web_view_helper.Resize(WebSize(kPageWidth, kPageHeight)); 4271 web_view_helper.Resize(WebSize(kPageWidth, kPageHeight));
4272 web_view_helper.WebView()->MainFrame()->SetScrollOffset( 4272 web_view_helper.WebView()->MainFrame()->SetScrollOffset(
4273 WebSize(kPageWidth / 4, kPageHeight / 4)); 4273 WebSize(kPageWidth / 4, kPageHeight / 4));
4274 web_view_helper.WebView()->SetPageScaleFactor(kPageScaleFactor); 4274 web_view_helper.WebView()->SetPageScaleFactor(kPageScaleFactor);
4275 4275
4276 WebSize previous_offset =
4277 web_view_helper.WebView()->MainFrame()->GetScrollOffset();
4278 float previous_scale = web_view_helper.WebView()->PageScaleFactor();
4279
4280 // Reload the page and end up at the same url. State should be propagated. 4276 // Reload the page and end up at the same url. State should be propagated.
aelias_OOO_until_Jul13 2017/06/13 22:41:59 Also fix comment: "not be"
4281 web_view_helper.WebView()->MainFrame()->ReloadWithOverrideURL( 4277 web_view_helper.WebView()->MainFrame()->ReloadWithOverrideURL(
4282 ToKURL(base_url_ + first_url), WebFrameLoadType::kReload); 4278 ToKURL(base_url_ + first_url), WebFrameLoadType::kReload);
4283 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( 4279 FrameTestHelpers::PumpPendingRequestsForFrameToLoad(
4284 web_view_helper.WebView()->MainFrame()); 4280 web_view_helper.WebView()->MainFrame());
4285 EXPECT_EQ(previous_offset.width, 4281 EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width);
4286 web_view_helper.WebView()->MainFrame()->GetScrollOffset().width); 4282 EXPECT_EQ(0,
4287 EXPECT_EQ(previous_offset.height,
4288 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height); 4283 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height);
4289 EXPECT_EQ(previous_scale, web_view_helper.WebView()->PageScaleFactor()); 4284 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor());
4290 4285
4291 // Reload the page using the cache. State should not be propagated. 4286 // Reload the page using the cache. State should not be propagated.
4292 web_view_helper.WebView()->MainFrame()->ReloadWithOverrideURL( 4287 web_view_helper.WebView()->MainFrame()->ReloadWithOverrideURL(
4293 ToKURL(base_url_ + second_url), WebFrameLoadType::kReload); 4288 ToKURL(base_url_ + second_url), WebFrameLoadType::kReload);
4294 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( 4289 FrameTestHelpers::PumpPendingRequestsForFrameToLoad(
4295 web_view_helper.WebView()->MainFrame()); 4290 web_view_helper.WebView()->MainFrame());
4296 EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width); 4291 EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width);
4297 EXPECT_EQ(0, 4292 EXPECT_EQ(0,
4298 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height); 4293 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height);
4299 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); 4294 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor());
(...skipping 7981 matching lines...) Expand 10 before | Expand all | Expand 10 after
12281 if (obj->IsText()) { 12276 if (obj->IsText()) {
12282 LayoutText* layout_text = ToLayoutText(obj); 12277 LayoutText* layout_text = ToLayoutText(obj);
12283 text = layout_text->GetText(); 12278 text = layout_text->GetText();
12284 break; 12279 break;
12285 } 12280 }
12286 } 12281 }
12287 EXPECT_EQ("foo alt", text.Utf8()); 12282 EXPECT_EQ("foo alt", text.Utf8());
12288 } 12283 }
12289 12284
12290 } // namespace blink 12285 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698