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

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

Issue 2105523002: Don't set shownRatio in main thread top controls on animated state change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improved test a bit Created 4 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
« 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) 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 552
553 verticalScroll(-50.f); 553 verticalScroll(-50.f);
554 EXPECT_FLOAT_EQ(0, webView->topControls().contentOffset()); 554 EXPECT_FLOAT_EQ(0, webView->topControls().contentOffset());
555 EXPECT_POINT_EQ(IntPoint(0, 90), frame()->view()->scrollPosition()); 555 EXPECT_POINT_EQ(IntPoint(0, 90), frame()->view()->scrollPosition());
556 556
557 // Setting permitted state to "both" should not change an in-flight offset. 557 // Setting permitted state to "both" should not change an in-flight offset.
558 verticalScroll(20.f); 558 verticalScroll(20.f);
559 EXPECT_FLOAT_EQ(20, webView->topControls().contentOffset()); 559 EXPECT_FLOAT_EQ(20, webView->topControls().contentOffset());
560 webView->updateTopControlsState(WebTopControlsBoth, WebTopControlsBoth, fals e); 560 webView->updateTopControlsState(WebTopControlsBoth, WebTopControlsBoth, fals e);
561 EXPECT_FLOAT_EQ(20, webView->topControls().contentOffset()); 561 EXPECT_FLOAT_EQ(20, webView->topControls().contentOffset());
562
563 // An animated state change shouldn't cause a change to the content offset
564 // since it'll be driven from the compositor.
565 webView->updateTopControlsState(WebTopControlsHidden, WebTopControlsHidden, true);
566 EXPECT_FLOAT_EQ(20, webView->topControls().contentOffset());
567
568 webView->updateTopControlsState(WebTopControlsShown, WebTopControlsShown, tr ue);
569 EXPECT_FLOAT_EQ(20, webView->topControls().contentOffset());
570
571 // Setting just the constraint should affect the content offset.
572 webView->updateTopControlsState(WebTopControlsHidden, WebTopControlsBoth, fa lse);
573 EXPECT_FLOAT_EQ(0, webView->topControls().contentOffset());
574
575 webView->updateTopControlsState(WebTopControlsShown, WebTopControlsBoth, fal se);
576 EXPECT_FLOAT_EQ(50, webView->topControls().contentOffset());
562 } 577 }
563 578
564 // Ensure that top controls do not affect the layout by showing and hiding 579 // Ensure that top controls do not affect the layout by showing and hiding
565 // except for position: fixed elements. 580 // except for position: fixed elements.
566 TEST_F(TopControlsTest, MAYBE(DontAffectLayoutHeight)) 581 TEST_F(TopControlsTest, MAYBE(DontAffectLayoutHeight))
567 { 582 {
568 // Initialize with the top controls showing. 583 // Initialize with the top controls showing.
569 WebViewImpl* webView = initialize("percent-height.html"); 584 WebViewImpl* webView = initialize("percent-height.html");
570 webView->resizeWithTopControls(WebSize(400, 300), 100.f, true); 585 webView->resizeWithTopControls(WebSize(400, 300), 100.f, true);
571 webView->updateTopControlsState( 586 webView->updateTopControlsState(
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 825
811 ASSERT_EQ(80.f, webView->topControls().contentOffset()); 826 ASSERT_EQ(80.f, webView->topControls().contentOffset());
812 EXPECT_EQ(expectedRootOffset, rootViewport->scrollPosition().y()); 827 EXPECT_EQ(expectedRootOffset, rootViewport->scrollPosition().y());
813 828
814 webView->handleInputEvent( 829 webView->handleInputEvent(
815 generateEvent(WebInputEvent::GestureScrollEnd)); 830 generateEvent(WebInputEvent::GestureScrollEnd));
816 } 831 }
817 } 832 }
818 833
819 } // namespace blink 834 } // 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