| OLD | NEW |
| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 TEST_F(TopControlsTest, MAYBE(ScrollUpPastLimitDoesNotHide)) | 476 TEST_F(TopControlsTest, MAYBE(ScrollUpPastLimitDoesNotHide)) |
| 477 { | 477 { |
| 478 WebViewImpl* webView = initialize(); | 478 WebViewImpl* webView = initialize(); |
| 479 // Initialize top controls to be shown | 479 // Initialize top controls to be shown |
| 480 webView->setTopControlsHeight(50.f, true); | 480 webView->setTopControlsHeight(50.f, true); |
| 481 webView->topControls().setShownRatio(1); | 481 webView->topControls().setShownRatio(1); |
| 482 // Use 2x scale so that both pinch viewport and frameview are scrollable | 482 // Use 2x scale so that both pinch viewport and frameview are scrollable |
| 483 webView->setPageScaleFactor(2.0); | 483 webView->setPageScaleFactor(2.0); |
| 484 | 484 |
| 485 // Fully scroll frameview but pinchviewport remains scrollable | 485 // Fully scroll frameview but pinchviewport remains scrollable |
| 486 webView->setMainFrameScrollOffset(WebPoint(0, 10000)); | 486 webView->mainFrame()->setScrollOffset(WebSize(0, 10000)); |
| 487 pinchViewport().setLocation(FloatPoint(0, 0)); | 487 pinchViewport().setLocation(FloatPoint(0, 0)); |
| 488 verticalScroll(-10.f); | 488 verticalScroll(-10.f); |
| 489 EXPECT_FLOAT_EQ(40, webView->topControls().contentOffset()); | 489 EXPECT_FLOAT_EQ(40, webView->topControls().contentOffset()); |
| 490 | 490 |
| 491 webView->topControls().setShownRatio(1); | 491 webView->topControls().setShownRatio(1); |
| 492 // Fully scroll pinch veiwport but frameview remains scrollable | 492 // Fully scroll pinch veiwport but frameview remains scrollable |
| 493 webView->setMainFrameScrollOffset(WebPoint(0, 0)); | 493 webView->mainFrame()->setScrollOffset(WebSize(0, 0)); |
| 494 pinchViewport().setLocation(FloatPoint(0, 10000)); | 494 pinchViewport().setLocation(FloatPoint(0, 10000)); |
| 495 verticalScroll(-20.f); | 495 verticalScroll(-20.f); |
| 496 EXPECT_FLOAT_EQ(30, webView->topControls().contentOffset()); | 496 EXPECT_FLOAT_EQ(30, webView->topControls().contentOffset()); |
| 497 | 497 |
| 498 webView->topControls().setShownRatio(1); | 498 webView->topControls().setShownRatio(1); |
| 499 // Fully scroll both frameview and pinch viewort | 499 // Fully scroll both frameview and pinch viewort |
| 500 webView->setMainFrameScrollOffset(WebPoint(0, 10000)); | 500 webView->mainFrame()->setScrollOffset(WebSize(0, 10000)); |
| 501 pinchViewport().setLocation(FloatPoint(0, 10000)); | 501 pinchViewport().setLocation(FloatPoint(0, 10000)); |
| 502 verticalScroll(-30.f); | 502 verticalScroll(-30.f); |
| 503 // Top controls should not move because neither frameview nor pinch viewport | 503 // Top controls should not move because neither frameview nor pinch viewport |
| 504 // are scrollable | 504 // are scrollable |
| 505 EXPECT_FLOAT_EQ(50.f, webView->topControls().contentOffset()); | 505 EXPECT_FLOAT_EQ(50.f, webView->topControls().contentOffset()); |
| 506 } | 506 } |
| 507 | 507 |
| 508 // Top controls should honor its constraints | 508 // Top controls should honor its constraints |
| 509 TEST_F(TopControlsTest, MAYBE(StateConstraints)) | 509 TEST_F(TopControlsTest, MAYBE(StateConstraints)) |
| 510 { | 510 { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 verticalScroll(50.f); | 546 verticalScroll(50.f); |
| 547 EXPECT_FLOAT_EQ(50, webView->topControls().contentOffset()); | 547 EXPECT_FLOAT_EQ(50, webView->topControls().contentOffset()); |
| 548 EXPECT_POINT_EQ(IntPoint(0, 90), frame()->view()->scrollPosition()); | 548 EXPECT_POINT_EQ(IntPoint(0, 90), frame()->view()->scrollPosition()); |
| 549 | 549 |
| 550 verticalScroll(-50.f); | 550 verticalScroll(-50.f); |
| 551 EXPECT_FLOAT_EQ(0, webView->topControls().contentOffset()); | 551 EXPECT_FLOAT_EQ(0, webView->topControls().contentOffset()); |
| 552 EXPECT_POINT_EQ(IntPoint(0, 90), frame()->view()->scrollPosition()); | 552 EXPECT_POINT_EQ(IntPoint(0, 90), frame()->view()->scrollPosition()); |
| 553 } | 553 } |
| 554 | 554 |
| 555 } // namespace | 555 } // namespace |
| OLD | NEW |