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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 void TouchActionTest::runShadowDOMTest(std::string file) | 152 void TouchActionTest::runShadowDOMTest(std::string file) |
153 { | 153 { |
154 TouchActionTrackingWebViewClient client; | 154 TouchActionTrackingWebViewClient client; |
155 | 155 |
156 WebView* webView = setupTest(file, client); | 156 WebView* webView = setupTest(file, client); |
157 | 157 |
158 WebCore::TrackExceptionState es; | 158 WebCore::TrackExceptionState es; |
159 | 159 |
160 // Oilpan: see runTouchActionTest() comment why these are persistent referen
ces. | 160 // Oilpan: see runTouchActionTest() comment why these are persistent referen
ces. |
161 RefPtrWillBePersistent<WebCore::Document> document = static_cast<PassRefPtrW
illBeRawPtr<WebCore::Document> >(webView->mainFrame()->document()); | 161 RefPtrWillBePersistent<WebCore::Document> document = static_cast<PassRefPtrW
illBeRawPtr<WebCore::Document> >(webView->mainFrame()->document()); |
162 RefPtrWillBePersistent<WebCore::NodeList> hostNodes = document->querySelecto
rAll("[shadow-host]", es); | 162 RefPtrWillBePersistent<WebCore::StaticNodeList> hostNodes = document->queryS
electorAll("[shadow-host]", es); |
163 ASSERT_FALSE(es.hadException()); | 163 ASSERT_FALSE(es.hadException()); |
164 ASSERT_GE(hostNodes->length(), 1u); | 164 ASSERT_GE(hostNodes->length(), 1u); |
165 | 165 |
166 for (unsigned index = 0; index < hostNodes->length(); index++) { | 166 for (unsigned index = 0; index < hostNodes->length(); index++) { |
167 WebCore::ShadowRoot* shadowRoot = WebCore::toElement(hostNodes->item(ind
ex))->shadowRoot(); | 167 WebCore::ShadowRoot* shadowRoot = WebCore::toElement(hostNodes->item(ind
ex))->shadowRoot(); |
168 runTestOnTree(shadowRoot, webView, client); | 168 runTestOnTree(shadowRoot, webView, client); |
169 } | 169 } |
170 | 170 |
171 // Projections show up in the main document. | 171 // Projections show up in the main document. |
172 runTestOnTree(document.get(), webView, client); | 172 runTestOnTree(document.get(), webView, client); |
(...skipping 20 matching lines...) Expand all Loading... |
193 | 193 |
194 return webView; | 194 return webView; |
195 } | 195 } |
196 | 196 |
197 void TouchActionTest::runTestOnTree(WebCore::ContainerNode* root, WebView* webVi
ew, TouchActionTrackingWebViewClient& client) | 197 void TouchActionTest::runTestOnTree(WebCore::ContainerNode* root, WebView* webVi
ew, TouchActionTrackingWebViewClient& client) |
198 { | 198 { |
199 // Find all elements to test the touch-action of in the document. | 199 // Find all elements to test the touch-action of in the document. |
200 WebCore::TrackExceptionState es; | 200 WebCore::TrackExceptionState es; |
201 | 201 |
202 // Oilpan: see runTouchActionTest() comment why these are persistent referen
ces. | 202 // Oilpan: see runTouchActionTest() comment why these are persistent referen
ces. |
203 RefPtrWillBePersistent<WebCore::NodeList> nodes = root->querySelectorAll("[e
xpected-action]", es); | 203 RefPtrWillBePersistent<WebCore::StaticNodeList> nodes = root->querySelectorA
ll("[expected-action]", es); |
204 ASSERT_FALSE(es.hadException()); | 204 ASSERT_FALSE(es.hadException()); |
205 | 205 |
206 for (unsigned index = 0; index < nodes->length(); index++) { | 206 for (unsigned index = 0; index < nodes->length(); index++) { |
207 WebCore::Element* element = toElement(nodes->item(index)); | 207 WebCore::Element* element = toElement(nodes->item(index)); |
208 element->scrollIntoViewIfNeeded(); | 208 element->scrollIntoViewIfNeeded(); |
209 ASSERT_TRUE(nodes->item(index)->isElementNode()); | 209 ASSERT_TRUE(nodes->item(index)->isElementNode()); |
210 | 210 |
211 std::string failureContext("Test case: "); | 211 std::string failureContext("Test case: "); |
212 if (element->hasID()) { | 212 if (element->hasID()) { |
213 failureContext.append(element->getIdAttribute().ascii().data()); | 213 failureContext.append(element->getIdAttribute().ascii().data()); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 { | 343 { |
344 runShadowDOMTest("touch-action-shadow-dom.html"); | 344 runShadowDOMTest("touch-action-shadow-dom.html"); |
345 } | 345 } |
346 | 346 |
347 TEST_F(TouchActionTest, Pan) | 347 TEST_F(TouchActionTest, Pan) |
348 { | 348 { |
349 runTouchActionTest("touch-action-pan.html"); | 349 runTouchActionTest("touch-action-pan.html"); |
350 } | 350 } |
351 | 351 |
352 } | 352 } |
OLD | NEW |