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

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: 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
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());
562 } 570 }
563 571
564 // Ensure that top controls do not affect the layout by showing and hiding 572 // Ensure that top controls do not affect the layout by showing and hiding
565 // except for position: fixed elements. 573 // except for position: fixed elements.
566 TEST_F(TopControlsTest, MAYBE(DontAffectLayoutHeight)) 574 TEST_F(TopControlsTest, MAYBE(DontAffectLayoutHeight))
567 { 575 {
568 // Initialize with the top controls showing. 576 // Initialize with the top controls showing.
569 WebViewImpl* webView = initialize("percent-height.html"); 577 WebViewImpl* webView = initialize("percent-height.html");
570 webView->resizeWithTopControls(WebSize(400, 300), 100.f, true); 578 webView->resizeWithTopControls(WebSize(400, 300), 100.f, true);
571 webView->updateTopControlsState( 579 webView->updateTopControlsState(
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 818
811 ASSERT_EQ(80.f, webView->topControls().contentOffset()); 819 ASSERT_EQ(80.f, webView->topControls().contentOffset());
812 EXPECT_EQ(expectedRootOffset, rootViewport->scrollPosition().y()); 820 EXPECT_EQ(expectedRootOffset, rootViewport->scrollPosition().y());
813 821
814 webView->handleInputEvent( 822 webView->handleInputEvent(
815 generateEvent(WebInputEvent::GestureScrollEnd)); 823 generateEvent(WebInputEvent::GestureScrollEnd));
816 } 824 }
817 } 825 }
818 826
819 } // namespace blink 827 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698