OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 event.x = 25; | 1267 event.x = 25; |
1268 event.y = 7; | 1268 event.y = 7; |
1269 webView->handleInputEvent(event); | 1269 webView->handleInputEvent(event); |
1270 runPendingTasks(); | 1270 runPendingTasks(); |
1271 EXPECT_EQ(25, client.longpressX()); | 1271 EXPECT_EQ(25, client.longpressX()); |
1272 EXPECT_EQ(7, client.longpressY()); | 1272 EXPECT_EQ(7, client.longpressY()); |
1273 | 1273 |
1274 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally
scoped client. | 1274 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally
scoped client. |
1275 } | 1275 } |
1276 | 1276 |
| 1277 TEST_F(WebViewTest, ClientTapHandlingNullWebViewClient) |
| 1278 { |
| 1279 WebViewImpl* webView = WebViewImpl::create(nullptr); |
| 1280 webView->setMainFrame(WebLocalFrame::create(nullptr)); |
| 1281 WebGestureEvent event; |
| 1282 event.type = WebInputEvent::GestureTap; |
| 1283 event.x = 3; |
| 1284 event.y = 8; |
| 1285 EXPECT_FALSE(webView->handleInputEvent(event)); |
| 1286 webView->close(); |
| 1287 } |
| 1288 |
1277 #if OS(ANDROID) | 1289 #if OS(ANDROID) |
1278 TEST_F(WebViewTest, LongPressSelection) | 1290 TEST_F(WebViewTest, LongPressSelection) |
1279 { | 1291 { |
1280 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("longpress_selection.html")); | 1292 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("longpress_selection.html")); |
1281 | 1293 |
1282 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_
selection.html", true); | 1294 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_
selection.html", true); |
1283 webView->resize(WebSize(500, 300)); | 1295 webView->resize(WebSize(500, 300)); |
1284 webView->layout(); | 1296 webView->layout(); |
1285 runPendingTasks(); | 1297 runPendingTasks(); |
1286 | 1298 |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2454 // Test without any preventDefault. | 2466 // Test without any preventDefault. |
2455 client.reset(); | 2467 client.reset(); |
2456 frame->executeScript(WebScriptSource("setTest('none');")); | 2468 frame->executeScript(WebScriptSource("setTest('none');")); |
2457 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr
omUTF8("target"))); | 2469 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr
omUTF8("target"))); |
2458 EXPECT_TRUE(client.getWasCalled()); | 2470 EXPECT_TRUE(client.getWasCalled()); |
2459 | 2471 |
2460 m_webViewHelper.reset(); // Remove dependency on locally scoped client. | 2472 m_webViewHelper.reset(); // Remove dependency on locally scoped client. |
2461 } | 2473 } |
2462 | 2474 |
2463 } // namespace | 2475 } // namespace |
OLD | NEW |