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

Side by Side Diff: Source/web/tests/TouchActionTest.cpp

Issue 280123002: Oilpan: move LiveNodeList collections to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase needed Created 6 years, 7 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) 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 141
142 void TouchActionTest::runShadowDOMTest(std::string file) 142 void TouchActionTest::runShadowDOMTest(std::string file)
143 { 143 {
144 TouchActionTrackingWebViewClient client; 144 TouchActionTrackingWebViewClient client;
145 145
146 WebView* webView = setupTest(file, client); 146 WebView* webView = setupTest(file, client);
147 147
148 WebCore::TrackExceptionState es; 148 WebCore::TrackExceptionState es;
149 RefPtrWillBeRawPtr<WebCore::Document> document = static_cast<PassRefPtrWillB eRawPtr<WebCore::Document> >(webView->mainFrame()->document()); 149 RefPtrWillBeRawPtr<WebCore::Document> document = static_cast<PassRefPtrWillB eRawPtr<WebCore::Document> >(webView->mainFrame()->document());
150 RefPtr<WebCore::NodeList> hostNodes = document->querySelectorAll("[shadow-ho st]", es); 150 RefPtrWillBeRawPtr<WebCore::NodeList> hostNodes = document->querySelectorAll ("[shadow-host]", es);
151 ASSERT_FALSE(es.hadException()); 151 ASSERT_FALSE(es.hadException());
152 ASSERT_GE(hostNodes->length(), 1u); 152 ASSERT_GE(hostNodes->length(), 1u);
153 153
154 for (unsigned index = 0; index < hostNodes->length(); index++) { 154 for (unsigned index = 0; index < hostNodes->length(); index++) {
155 WebCore::ShadowRoot* shadowRoot = WebCore::toElement(hostNodes->item(ind ex))->shadowRoot(); 155 WebCore::ShadowRoot* shadowRoot = WebCore::toElement(hostNodes->item(ind ex))->shadowRoot();
156 runTestOnTree(shadowRoot, webView, client); 156 runTestOnTree(shadowRoot, webView, client);
157 } 157 }
158 158
159 // Projections show up in the main document. 159 // Projections show up in the main document.
160 runTestOnTree(document.get(), webView, client); 160 runTestOnTree(document.get(), webView, client);
(...skipping 18 matching lines...) Expand all
179 RefPtrWillBeRawPtr<WebCore::Document> document = static_cast<PassRefPtrWillB eRawPtr<WebCore::Document> >(webView->mainFrame()->document()); 179 RefPtrWillBeRawPtr<WebCore::Document> document = static_cast<PassRefPtrWillB eRawPtr<WebCore::Document> >(webView->mainFrame()->document());
180 document->frame()->view()->setScrollOffset(WebCore::IntPoint(0, kScrollOffse t)); 180 document->frame()->view()->setScrollOffset(WebCore::IntPoint(0, kScrollOffse t));
181 181
182 return webView; 182 return webView;
183 } 183 }
184 184
185 void TouchActionTest::runTestOnTree(WebCore::ContainerNode* root, WebView* webVi ew, TouchActionTrackingWebViewClient& client) 185 void TouchActionTest::runTestOnTree(WebCore::ContainerNode* root, WebView* webVi ew, TouchActionTrackingWebViewClient& client)
186 { 186 {
187 // Find all elements to test the touch-action of in the document. 187 // Find all elements to test the touch-action of in the document.
188 WebCore::TrackExceptionState es; 188 WebCore::TrackExceptionState es;
189 RefPtr<WebCore::NodeList> nodes = root->querySelectorAll("[expected-action]" , es); 189 RefPtrWillBeRawPtr<WebCore::NodeList> nodes = root->querySelectorAll("[expec ted-action]", es);
190 ASSERT_FALSE(es.hadException()); 190 ASSERT_FALSE(es.hadException());
191 191
192 for (unsigned index = 0; index < nodes->length(); index++) { 192 for (unsigned index = 0; index < nodes->length(); index++) {
193 // FIXME: Oilpan: this is a longer running test that allocates. If the
194 // PendingGCRunner task is run, it GCs assuming no pointers on the stack .
195 // But there are here; explicitly GCing each time around this loop isn't
196 // addressing that problem completely.
197 WebCore::Heap::collectGarbage(WebCore::ThreadState::HeapPointersOnStack) ;
198
193 WebCore::Element* element = toElement(nodes->item(index)); 199 WebCore::Element* element = toElement(nodes->item(index));
194 element->scrollIntoViewIfNeeded(); 200 element->scrollIntoViewIfNeeded();
195 ASSERT_TRUE(nodes->item(index)->isElementNode()); 201 ASSERT_TRUE(nodes->item(index)->isElementNode());
196 202
197 std::string failureContext("Test case: "); 203 std::string failureContext("Test case: ");
198 if (element->hasID()) { 204 if (element->hasID()) {
199 failureContext.append(element->getIdAttribute().ascii().data()); 205 failureContext.append(element->getIdAttribute().ascii().data());
200 } else if (element->firstChild()) { 206 } else if (element->firstChild()) {
201 failureContext.append("\""); 207 failureContext.append("\"");
202 failureContext.append(element->firstChild()->textContent(false).stri pWhiteSpace().ascii().data()); 208 failureContext.append(element->firstChild()->textContent(false).stri pWhiteSpace().ascii().data());
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 { 335 {
330 runShadowDOMTest("touch-action-shadow-dom.html"); 336 runShadowDOMTest("touch-action-shadow-dom.html");
331 } 337 }
332 338
333 TEST_F(TouchActionTest, Pan) 339 TEST_F(TouchActionTest, Pan)
334 { 340 {
335 runTouchActionTest("touch-action-pan.html"); 341 runTouchActionTest("touch-action-pan.html");
336 } 342 }
337 343
338 } 344 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698