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

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

Issue 1879103002: Convert main-thread overscroll parameters into viewport space. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Majid's review Created 4 years, 8 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 8232 matching lines...) Expand 10 before | Expand all | Expand 10 after
8243 8243
8244 TEST_P(WebFrameOverscrollTest, ScaledPageRootLayerOverscrolled) 8244 TEST_P(WebFrameOverscrollTest, ScaledPageRootLayerOverscrolled)
8245 { 8245 {
8246 OverscrollWebViewClient client; 8246 OverscrollWebViewClient client;
8247 registerMockedHttpURLLoad("overscroll/overscroll.html"); 8247 registerMockedHttpURLLoad("overscroll/overscroll.html");
8248 FrameTestHelpers::WebViewHelper webViewHelper; 8248 FrameTestHelpers::WebViewHelper webViewHelper;
8249 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "over scroll/overscroll.html", true, 0, &client, configureAndroid); 8249 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "over scroll/overscroll.html", true, 0, &client, configureAndroid);
8250 webViewHelper.resize(WebSize(200, 200)); 8250 webViewHelper.resize(WebSize(200, 200));
8251 webViewImpl->setPageScaleFactor(3.0); 8251 webViewImpl->setPageScaleFactor(3.0);
8252 8252
8253 // Calculation of accumulatedRootOverscroll and unusedDelta on scaled page. 8253 // Calculation of accumulatedRootOverscroll and unusedDelta on scaled page. The point is (99, 99) because we clamp
8254 // in the division by 3 to 33 so when we go back to viewport coordinates it becomes (99, 99).
8254 ScrollBegin(&webViewHelper); 8255 ScrollBegin(&webViewHelper);
8255 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, -10), WebFloatSize(0, -10) , WebFloatPoint(33, 33), WebFloatSize())); 8256 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -30) , WebFloatPoint(99, 99), WebFloatSize()));
8256 ScrollUpdate(&webViewHelper, 0, 30); 8257 ScrollUpdate(&webViewHelper, 0, 30);
8257 Mock::VerifyAndClearExpectations(&client); 8258 Mock::VerifyAndClearExpectations(&client);
8258 8259
8259 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, -10), WebFloatSize(0, -20) , WebFloatPoint(33, 33), WebFloatSize())); 8260 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -60) , WebFloatPoint(99, 99), WebFloatSize()));
8260 ScrollUpdate(&webViewHelper, 0, 30); 8261 ScrollUpdate(&webViewHelper, 0, 30);
8261 Mock::VerifyAndClearExpectations(&client); 8262 Mock::VerifyAndClearExpectations(&client);
8262 8263
8263 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, -10), WebFloatSize(-10, -30), WebFloatPoint(33, 33), WebFloatSize())); 8264 EXPECT_CALL(client, didOverscroll(WebFloatSize(-30, -30), WebFloatSize(-30, -90), WebFloatPoint(99, 99), WebFloatSize()));
8264 ScrollUpdate(&webViewHelper, 30, 30); 8265 ScrollUpdate(&webViewHelper, 30, 30);
8265 Mock::VerifyAndClearExpectations(&client); 8266 Mock::VerifyAndClearExpectations(&client);
8266 8267
8267 EXPECT_CALL(client, didOverscroll(WebFloatSize(-10, 0), WebFloatSize(-20, -3 0), WebFloatPoint(33, 33), WebFloatSize())); 8268 EXPECT_CALL(client, didOverscroll(WebFloatSize(-30, 0), WebFloatSize(-60, -9 0), WebFloatPoint(99, 99), WebFloatSize()));
8268 ScrollUpdate(&webViewHelper, 30, 0); 8269 ScrollUpdate(&webViewHelper, 30, 0);
8269 Mock::VerifyAndClearExpectations(&client); 8270 Mock::VerifyAndClearExpectations(&client);
8270 8271
8271 // Overscroll is not reported. 8272 // Overscroll is not reported.
8272 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); 8273 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
8273 ScrollEnd(&webViewHelper); 8274 ScrollEnd(&webViewHelper);
8274 Mock::VerifyAndClearExpectations(&client); 8275 Mock::VerifyAndClearExpectations(&client);
8275 } 8276 }
8276 8277
8277 TEST_P(WebFrameOverscrollTest, NoOverscrollForSmallvalues) 8278 TEST_P(WebFrameOverscrollTest, NoOverscrollForSmallvalues)
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
8555 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); 8556 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame();
8556 v8::HandleScope scope(v8::Isolate::GetCurrent()); 8557 v8::HandleScope scope(v8::Isolate::GetCurrent());
8557 mainFrame->executeScript(WebScriptSource("hello = 'world';")); 8558 mainFrame->executeScript(WebScriptSource("hello = 'world';"));
8558 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); 8559 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page");
8559 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello")); 8560 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello"));
8560 ASSERT_TRUE(result->IsString()); 8561 ASSERT_TRUE(result->IsString());
8561 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked())); 8562 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked()));
8562 } 8563 }
8563 8564
8564 } // namespace blink 8565 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/ChromeClientImpl.cpp ('k') | third_party/WebKit/public/web/WebWidgetClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698