OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 RefPtr<WebCore::NodeList> nodes = root->querySelectorAll("[expected-action]"
, es); | 182 RefPtr<WebCore::NodeList> nodes = root->querySelectorAll("[expected-action]"
, es); |
183 ASSERT_FALSE(es.hadException()); | 183 ASSERT_FALSE(es.hadException()); |
184 | 184 |
185 for (unsigned index = 0; index < nodes->length(); index++) { | 185 for (unsigned index = 0; index < nodes->length(); index++) { |
186 WebCore::Element* element = toElement(nodes->item(index)); | 186 WebCore::Element* element = toElement(nodes->item(index)); |
187 element->scrollIntoViewIfNeeded(); | 187 element->scrollIntoViewIfNeeded(); |
188 ASSERT_TRUE(nodes->item(index)->isElementNode()); | 188 ASSERT_TRUE(nodes->item(index)->isElementNode()); |
189 | 189 |
190 std::string failureContext("Test case: "); | 190 std::string failureContext("Test case: "); |
191 if (element->hasID()) { | 191 if (element->hasID()) { |
192 failureContext.append(element->getIdAttribute().string().ascii().dat
a()); | 192 failureContext.append(element->getIdAttribute().ascii().data()); |
193 } else if (element->firstChild()) { | 193 } else if (element->firstChild()) { |
194 failureContext.append("\""); | 194 failureContext.append("\""); |
195 failureContext.append(element->firstChild()->textContent(false).stri
pWhiteSpace().ascii().data()); | 195 failureContext.append(element->firstChild()->textContent(false).stri
pWhiteSpace().ascii().data()); |
196 failureContext.append("\""); | 196 failureContext.append("\""); |
197 } else { | 197 } else { |
198 failureContext += "<missing ID>"; | 198 failureContext += "<missing ID>"; |
199 } | 199 } |
200 | 200 |
201 // Run each test three times at different positions in the element. | 201 // Run each test three times at different positions in the element. |
202 // Note that we don't want the bounding box because our tests sometimes
have elements with | 202 // Note that we don't want the bounding box because our tests sometimes
have elements with |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 if (client.touchActionSetCount()) { | 262 if (client.touchActionSetCount()) { |
263 if (expectedAction == "none") { | 263 if (expectedAction == "none") { |
264 EXPECT_EQ(WebTouchActionNone, client.lastTouchAction())
<< failureContextPos; | 264 EXPECT_EQ(WebTouchActionNone, client.lastTouchAction())
<< failureContextPos; |
265 } else if (expectedAction == "pan-x") { | 265 } else if (expectedAction == "pan-x") { |
266 EXPECT_EQ(WebTouchActionPanX, client.lastTouchAction())
<< failureContextPos; | 266 EXPECT_EQ(WebTouchActionPanX, client.lastTouchAction())
<< failureContextPos; |
267 } else if (expectedAction == "pan-y") { | 267 } else if (expectedAction == "pan-y") { |
268 EXPECT_EQ(WebTouchActionPanY, client.lastTouchAction())
<< failureContextPos; | 268 EXPECT_EQ(WebTouchActionPanY, client.lastTouchAction())
<< failureContextPos; |
269 } else if (expectedAction == "pan-x-y") { | 269 } else if (expectedAction == "pan-x-y") { |
270 EXPECT_EQ((WebTouchActionPanX | WebTouchActionPanY), cli
ent.lastTouchAction()) << failureContextPos; | 270 EXPECT_EQ((WebTouchActionPanX | WebTouchActionPanY), cli
ent.lastTouchAction()) << failureContextPos; |
271 } else { | 271 } else { |
272 FAIL() << "Unrecognized expected-action \"" << expectedA
ction.string().ascii().data() | 272 FAIL() << "Unrecognized expected-action \"" << expectedA
ction.ascii().data() |
273 << "\" " << failureContextPos; | 273 << "\" " << failureContextPos; |
274 } | 274 } |
275 } | 275 } |
276 } | 276 } |
277 | 277 |
278 // Reset webview touch state. | 278 // Reset webview touch state. |
279 client.reset(); | 279 client.reset(); |
280 sendTouchEvent(webView, WebInputEvent::TouchCancel, clientPoint); | 280 sendTouchEvent(webView, WebInputEvent::TouchCancel, clientPoint); |
281 EXPECT_EQ(0, client.touchActionSetCount()); | 281 EXPECT_EQ(0, client.touchActionSetCount()); |
282 } | 282 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 { | 318 { |
319 runShadowDOMTest("touch-action-shadow-dom.html"); | 319 runShadowDOMTest("touch-action-shadow-dom.html"); |
320 } | 320 } |
321 | 321 |
322 TEST_F(TouchActionTest, Pan) | 322 TEST_F(TouchActionTest, Pan) |
323 { | 323 { |
324 runTouchActionTest("touch-action-pan.html"); | 324 runTouchActionTest("touch-action-pan.html"); |
325 } | 325 } |
326 | 326 |
327 } | 327 } |
OLD | NEW |