| 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 | 32 |
| 33 #include "RuntimeEnabledFeatures.h" | 33 #include "RuntimeEnabledFeatures.h" |
| 34 #include "core/dom/ClientRect.h" | 34 #include "core/dom/ClientRect.h" |
| 35 #include "core/dom/ClientRectList.h" | 35 #include "core/dom/ClientRectList.h" |
| 36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 37 #include "core/dom/Element.h" | 37 #include "core/dom/Element.h" |
| 38 #include "core/dom/StaticNodeList.h" |
| 38 #include "core/dom/shadow/ShadowRoot.h" | 39 #include "core/dom/shadow/ShadowRoot.h" |
| 39 #include "core/frame/FrameView.h" | 40 #include "core/frame/FrameView.h" |
| 40 #include "core/frame/LocalFrame.h" | 41 #include "core/frame/LocalFrame.h" |
| 41 #include "core/page/EventHandler.h" | 42 #include "core/page/EventHandler.h" |
| 42 #include "core/rendering/HitTestResult.h" | 43 #include "core/rendering/HitTestResult.h" |
| 43 #include "core/rendering/RenderTreeAsText.h" | 44 #include "core/rendering/RenderTreeAsText.h" |
| 44 #include "public/platform/Platform.h" | 45 #include "public/platform/Platform.h" |
| 45 #include "public/platform/WebUnitTestSupport.h" | 46 #include "public/platform/WebUnitTestSupport.h" |
| 46 #include "public/web/WebDocument.h" | 47 #include "public/web/WebDocument.h" |
| 47 #include "public/web/WebFrame.h" | 48 #include "public/web/WebFrame.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 void TouchActionTest::runShadowDOMTest(std::string file) | 153 void TouchActionTest::runShadowDOMTest(std::string file) |
| 153 { | 154 { |
| 154 TouchActionTrackingWebViewClient client; | 155 TouchActionTrackingWebViewClient client; |
| 155 | 156 |
| 156 WebView* webView = setupTest(file, client); | 157 WebView* webView = setupTest(file, client); |
| 157 | 158 |
| 158 WebCore::TrackExceptionState es; | 159 WebCore::TrackExceptionState es; |
| 159 | 160 |
| 160 // Oilpan: see runTouchActionTest() comment why these are persistent referen
ces. | 161 // Oilpan: see runTouchActionTest() comment why these are persistent referen
ces. |
| 161 RefPtrWillBePersistent<WebCore::Document> document = static_cast<PassRefPtrW
illBeRawPtr<WebCore::Document> >(webView->mainFrame()->document()); | 162 RefPtrWillBePersistent<WebCore::Document> document = static_cast<PassRefPtrW
illBeRawPtr<WebCore::Document> >(webView->mainFrame()->document()); |
| 162 RefPtrWillBePersistent<WebCore::NodeList> hostNodes = document->querySelecto
rAll("[shadow-host]", es); | 163 RefPtrWillBePersistent<WebCore::StaticNodeList> hostNodes = document->queryS
electorAll("[shadow-host]", es); |
| 163 ASSERT_FALSE(es.hadException()); | 164 ASSERT_FALSE(es.hadException()); |
| 164 ASSERT_GE(hostNodes->length(), 1u); | 165 ASSERT_GE(hostNodes->length(), 1u); |
| 165 | 166 |
| 166 for (unsigned index = 0; index < hostNodes->length(); index++) { | 167 for (unsigned index = 0; index < hostNodes->length(); index++) { |
| 167 WebCore::ShadowRoot* shadowRoot = WebCore::toElement(hostNodes->item(ind
ex))->shadowRoot(); | 168 WebCore::ShadowRoot* shadowRoot = WebCore::toElement(hostNodes->item(ind
ex))->shadowRoot(); |
| 168 runTestOnTree(shadowRoot, webView, client); | 169 runTestOnTree(shadowRoot, webView, client); |
| 169 } | 170 } |
| 170 | 171 |
| 171 // Projections show up in the main document. | 172 // Projections show up in the main document. |
| 172 runTestOnTree(document.get(), webView, client); | 173 runTestOnTree(document.get(), webView, client); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 193 | 194 |
| 194 return webView; | 195 return webView; |
| 195 } | 196 } |
| 196 | 197 |
| 197 void TouchActionTest::runTestOnTree(WebCore::ContainerNode* root, WebView* webVi
ew, TouchActionTrackingWebViewClient& client) | 198 void TouchActionTest::runTestOnTree(WebCore::ContainerNode* root, WebView* webVi
ew, TouchActionTrackingWebViewClient& client) |
| 198 { | 199 { |
| 199 // Find all elements to test the touch-action of in the document. | 200 // Find all elements to test the touch-action of in the document. |
| 200 WebCore::TrackExceptionState es; | 201 WebCore::TrackExceptionState es; |
| 201 | 202 |
| 202 // Oilpan: see runTouchActionTest() comment why these are persistent referen
ces. | 203 // Oilpan: see runTouchActionTest() comment why these are persistent referen
ces. |
| 203 RefPtrWillBePersistent<WebCore::NodeList> nodes = root->querySelectorAll("[e
xpected-action]", es); | 204 RefPtrWillBePersistent<WebCore::StaticNodeList> nodes = root->querySelectorA
ll("[expected-action]", es); |
| 204 ASSERT_FALSE(es.hadException()); | 205 ASSERT_FALSE(es.hadException()); |
| 205 | 206 |
| 206 for (unsigned index = 0; index < nodes->length(); index++) { | 207 for (unsigned index = 0; index < nodes->length(); index++) { |
| 207 WebCore::Element* element = toElement(nodes->item(index)); | 208 WebCore::Element* element = toElement(nodes->item(index)); |
| 208 element->scrollIntoViewIfNeeded(); | 209 element->scrollIntoViewIfNeeded(); |
| 209 ASSERT_TRUE(nodes->item(index)->isElementNode()); | 210 ASSERT_TRUE(nodes->item(index)->isElementNode()); |
| 210 | 211 |
| 211 std::string failureContext("Test case: "); | 212 std::string failureContext("Test case: "); |
| 212 if (element->hasID()) { | 213 if (element->hasID()) { |
| 213 failureContext.append(element->getIdAttribute().ascii().data()); | 214 failureContext.append(element->getIdAttribute().ascii().data()); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 { | 344 { |
| 344 runShadowDOMTest("touch-action-shadow-dom.html"); | 345 runShadowDOMTest("touch-action-shadow-dom.html"); |
| 345 } | 346 } |
| 346 | 347 |
| 347 TEST_F(TouchActionTest, Pan) | 348 TEST_F(TouchActionTest, Pan) |
| 348 { | 349 { |
| 349 runTouchActionTest("touch-action-pan.html"); | 350 runTouchActionTest("touch-action-pan.html"); |
| 350 } | 351 } |
| 351 | 352 |
| 352 } | 353 } |
| OLD | NEW |