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

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

Issue 2936423003: Move Get/SetScrollOffset methods from WebFrame to WebLocalFrame. (Closed)
Patch Set: Use WebViewHelper::LocalMainFrame() where possible. 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2015 Google Inc. All rights reserved. 2 * Copyright (C) 2015 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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 // Browser controls should not hide when scrolling up past limit 575 // Browser controls should not hide when scrolling up past limit
576 TEST_F(BrowserControlsTest, MAYBE(ScrollUpPastLimitDoesNotHide)) { 576 TEST_F(BrowserControlsTest, MAYBE(ScrollUpPastLimitDoesNotHide)) {
577 WebViewBase* web_view = Initialize(); 577 WebViewBase* web_view = Initialize();
578 // Initialize browser controls to be shown 578 // Initialize browser controls to be shown
579 web_view->ResizeWithBrowserControls(web_view->Size(), 50.f, true); 579 web_view->ResizeWithBrowserControls(web_view->Size(), 50.f, true);
580 web_view->GetBrowserControls().SetShownRatio(1); 580 web_view->GetBrowserControls().SetShownRatio(1);
581 // Use 2x scale so that both visual viewport and frameview are scrollable 581 // Use 2x scale so that both visual viewport and frameview are scrollable
582 web_view->SetPageScaleFactor(2.0); 582 web_view->SetPageScaleFactor(2.0);
583 583
584 // Fully scroll frameview but visualviewport remains scrollable 584 // Fully scroll frameview but visualviewport remains scrollable
585 web_view->MainFrame()->SetScrollOffset(WebSize(0, 10000)); 585 web_view->MainFrameImpl()->SetScrollOffset(WebSize(0, 10000));
586 GetVisualViewport().SetLocation(FloatPoint(0, 0)); 586 GetVisualViewport().SetLocation(FloatPoint(0, 0));
587 VerticalScroll(-10.f); 587 VerticalScroll(-10.f);
588 EXPECT_FLOAT_EQ(40, web_view->GetBrowserControls().ContentOffset()); 588 EXPECT_FLOAT_EQ(40, web_view->GetBrowserControls().ContentOffset());
589 589
590 web_view->GetBrowserControls().SetShownRatio(1); 590 web_view->GetBrowserControls().SetShownRatio(1);
591 // Fully scroll visual veiwport but frameview remains scrollable 591 // Fully scroll visual veiwport but frameview remains scrollable
592 web_view->MainFrame()->SetScrollOffset(WebSize(0, 0)); 592 web_view->MainFrameImpl()->SetScrollOffset(WebSize(0, 0));
593 GetVisualViewport().SetLocation(FloatPoint(0, 10000)); 593 GetVisualViewport().SetLocation(FloatPoint(0, 10000));
594 VerticalScroll(-20.f); 594 VerticalScroll(-20.f);
595 EXPECT_FLOAT_EQ(30, web_view->GetBrowserControls().ContentOffset()); 595 EXPECT_FLOAT_EQ(30, web_view->GetBrowserControls().ContentOffset());
596 596
597 web_view->GetBrowserControls().SetShownRatio(1); 597 web_view->GetBrowserControls().SetShownRatio(1);
598 // Fully scroll both frameview and visual viewport 598 // Fully scroll both frameview and visual viewport
599 web_view->MainFrame()->SetScrollOffset(WebSize(0, 10000)); 599 web_view->MainFrameImpl()->SetScrollOffset(WebSize(0, 10000));
600 GetVisualViewport().SetLocation(FloatPoint(0, 10000)); 600 GetVisualViewport().SetLocation(FloatPoint(0, 10000));
601 VerticalScroll(-30.f); 601 VerticalScroll(-30.f);
602 // Browser controls should not move because neither frameview nor visual 602 // Browser controls should not move because neither frameview nor visual
603 // viewport 603 // viewport
604 // are scrollable 604 // are scrollable
605 EXPECT_FLOAT_EQ(50.f, web_view->GetBrowserControls().ContentOffset()); 605 EXPECT_FLOAT_EQ(50.f, web_view->GetBrowserControls().ContentOffset());
606 } 606 }
607 607
608 // Browser controls should honor its constraints 608 // Browser controls should honor its constraints
609 TEST_F(BrowserControlsTest, MAYBE(StateConstraints)) { 609 TEST_F(BrowserControlsTest, MAYBE(StateConstraints)) {
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 1071
1072 // Make sure we're not adding the browser controls height to the vh units as 1072 // Make sure we're not adding the browser controls height to the vh units as
1073 // when they're locked to hidden, the ICB fills the entire viewport already. 1073 // when they're locked to hidden, the ICB fills the entire viewport already.
1074 EXPECT_FLOAT_EQ(200.f, abs_pos->getBoundingClientRect()->height()); 1074 EXPECT_FLOAT_EQ(200.f, abs_pos->getBoundingClientRect()->height());
1075 EXPECT_FLOAT_EQ(200.f, fixed_pos->getBoundingClientRect()->height()); 1075 EXPECT_FLOAT_EQ(200.f, fixed_pos->getBoundingClientRect()->height());
1076 EXPECT_EQ(400, GetFrame()->View()->ViewportSizeForViewportUnits().Height()); 1076 EXPECT_EQ(400, GetFrame()->View()->ViewportSizeForViewportUnits().Height());
1077 } 1077 }
1078 } 1078 }
1079 1079
1080 } // namespace blink 1080 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | third_party/WebKit/Source/web/tests/ProgrammaticScrollTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698