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

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

Issue 1056983004: OverscrollGlow for mainThread-{BLINK CHANGES} (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tests !!! Created 5 years, 7 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) 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 7255 matching lines...) Expand 10 before | Expand all | Expand 10 after
7266 EXPECT_TRUE(webFrameClient.messages.empty()); 7266 EXPECT_TRUE(webFrameClient.messages.empty());
7267 ASSERT_EQ(2u, popupWebFrameClient.messages.size()); 7267 ASSERT_EQ(2u, popupWebFrameClient.messages.size());
7268 EXPECT_TRUE(std::string::npos != popupWebFrameClient.messages[1].text.utf8() .find("Blocked a frame")); 7268 EXPECT_TRUE(std::string::npos != popupWebFrameClient.messages[1].text.utf8() .find("Blocked a frame"));
7269 7269
7270 // Manually reset to break WebViewHelpers' dependencies on the stack 7270 // Manually reset to break WebViewHelpers' dependencies on the stack
7271 // allocated WebFrameClients. 7271 // allocated WebFrameClients.
7272 webViewHelper.reset(); 7272 webViewHelper.reset();
7273 popupWebViewHelper.reset(); 7273 popupWebViewHelper.reset();
7274 } 7274 }
7275 7275
7276 TEST_F(WebFrameTest, OverscrollGlowAnimation)
7277 {
7278 UseMockScrollbarSettings mockScrollbarSettings;
7279 registerMockedHttpURLLoad("mainthread_scrolling.html");
7280
7281 FixedLayoutTestWebViewClient client;
7282 client.m_screenInfo.deviceScaleFactor = 1;
7283 int viewportWidth = 640;
7284 int viewportHeight = 480;
7285
7286 FrameTestHelpers::WebViewHelper webViewHelper;
7287
7288 webViewHelper.initializeAndLoad(m_baseURL + "mainthread_scrolling.html", tru e, 0, &client, configureAndroid);
7289 // set view height to zero so that if the height of the view is not
7290 // successfully updated during later resizes touch events will fail
7291 // (as in not hit content included in the view)
7292 webViewHelper.webView()->resize(WebSize(viewportWidth, 0));
7293 webViewHelper.webView()->layout();
7294
majidvp 2015/05/07 16:35:30 Why do you need this resize here?
7295 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true);
7296 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight));
7297
majidvp 2015/05/07 16:35:30 Again resize does not make sense to me.
7298 IntPoint hitPoint = IntPoint(5, 5);
7299
7300 PlatformGestureEvent gestureEventSB(PlatformEvent::Type::GestureScrollBegin, hitPoint, hitPoint, IntSize(0, 0), 0, false, false, false, false);
7301 webViewHelper.webViewImpl()->mainFrameImpl()->frame()->eventHandler().handle GestureEvent(gestureEventSB);
majidvp 2015/05/07 16:35:30 I think it is better to have webView handle the ge
7302
7303 PlatformGestureEvent gestureEventSU1(PlatformEvent::Type::GestureScrollUpdat e, hitPoint, hitPoint, IntSize(0, 0), 0, false, false, false, false);
7304 gestureEventSU1.setScrollGestureData(0, -13, 0, 0, false, false);
7305 webViewHelper.webViewImpl()->mainFrameImpl()->frame()->eventHandler().handle GestureEvent(gestureEventSU1);
7306 FloatSize unUsedDelta = webViewHelper.webViewImpl()->mainFrameImpl()->frame( )->eventHandler().unusedDeltaForTesting();
7307 FloatSize accumulatedRootOverscroll = webViewHelper.webViewImpl()->mainFrame Impl()->frame()->eventHandler().accumulatedRootOverscrollForTesting();
7308 EXPECT_EQ(0, unUsedDelta.width());
7309 EXPECT_EQ(-13, unUsedDelta.height());
7310 EXPECT_EQ(0, accumulatedRootOverscroll.width());
7311 EXPECT_EQ(-13, accumulatedRootOverscroll.height());
7312
7313 PlatformGestureEvent gestureEventSU2(PlatformEvent::Type::GestureScrollUpdat e, hitPoint, hitPoint, IntSize(0, 0), 0, false, false, false, false);
7314 gestureEventSU2.setScrollGestureData(0, -13, 0, 0, false, false);
7315 webViewHelper.webViewImpl()->mainFrameImpl()->frame()->eventHandler().handle GestureEvent(gestureEventSU2);
7316 unUsedDelta = webViewHelper.webViewImpl()->mainFrameImpl()->frame()->eventHa ndler().unusedDeltaForTesting();
7317 accumulatedRootOverscroll = webViewHelper.webViewImpl()->mainFrameImpl()->fr ame()->eventHandler().accumulatedRootOverscrollForTesting();
7318 EXPECT_EQ(0, unUsedDelta.width());
7319 EXPECT_EQ(-13, unUsedDelta.height());
7320 EXPECT_EQ(0, accumulatedRootOverscroll.width());
7321 EXPECT_EQ(-26, accumulatedRootOverscroll.height());
majidvp 2015/05/07 16:35:30 This tests the simple case where we have overscrol
7322
7323 PlatformGestureEvent gestureEventSE(PlatformEvent::Type::GestureScrollEnd, h itPoint, hitPoint, IntSize(0, 0), 0, false, false, false, false);
7324 webViewHelper.webViewImpl()->mainFrameImpl()->frame()->eventHandler().handle GestureEvent(gestureEventSE);
7325 }
7326
7276 } // namespace blink 7327 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698