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

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

Issue 843683005: Fix a bit of C++11 in web/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // effect, the implicit assumption that we're outside any event 135 // effect, the implicit assumption that we're outside any event
136 // loop (=> there being no pointers on the stack needing scanning) 136 // loop (=> there being no pointers on the stack needing scanning)
137 // when that GC strikes will no longer hold. 137 // when that GC strikes will no longer hold.
138 // 138 //
139 // To ensure that the references on the stack are also traced, we 139 // To ensure that the references on the stack are also traced, we
140 // turn them into persistent, stack allocated references. This 140 // turn them into persistent, stack allocated references. This
141 // workaround is sufficient to handle this artificial test 141 // workaround is sufficient to handle this artificial test
142 // scenario. 142 // scenario.
143 WebView* webView = setupTest(file, client); 143 WebView* webView = setupTest(file, client);
144 144
145 RefPtrWillBePersistent<Document> document = static_cast<PassRefPtrWillBeRawP tr<Document> >(webView->mainFrame()->document()); 145 RefPtrWillBePersistent<Document> document = static_cast<PassRefPtrWillBeRawP tr<Document>>(webView->mainFrame()->document());
146 runTestOnTree(document.get(), webView, client); 146 runTestOnTree(document.get(), webView, client);
147 147
148 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally scoped client. 148 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally scoped client.
149 } 149 }
150 150
151 void TouchActionTest::runShadowDOMTest(std::string file) 151 void TouchActionTest::runShadowDOMTest(std::string file)
152 { 152 {
153 TouchActionTrackingWebViewClient client; 153 TouchActionTrackingWebViewClient client;
154 154
155 WebView* webView = setupTest(file, client); 155 WebView* webView = setupTest(file, client);
156 156
157 TrackExceptionState es; 157 TrackExceptionState es;
158 158
159 // Oilpan: see runTouchActionTest() comment why these are persistent referen ces. 159 // Oilpan: see runTouchActionTest() comment why these are persistent referen ces.
160 RefPtrWillBePersistent<Document> document = static_cast<PassRefPtrWillBeRawP tr<Document> >(webView->mainFrame()->document()); 160 RefPtrWillBePersistent<Document> document = static_cast<PassRefPtrWillBeRawP tr<Document>>(webView->mainFrame()->document());
161 RefPtrWillBePersistent<StaticElementList> hostNodes = document->querySelecto rAll("[shadow-host]", es); 161 RefPtrWillBePersistent<StaticElementList> hostNodes = document->querySelecto rAll("[shadow-host]", es);
162 ASSERT_FALSE(es.hadException()); 162 ASSERT_FALSE(es.hadException());
163 ASSERT_GE(hostNodes->length(), 1u); 163 ASSERT_GE(hostNodes->length(), 1u);
164 164
165 for (unsigned index = 0; index < hostNodes->length(); index++) { 165 for (unsigned index = 0; index < hostNodes->length(); index++) {
166 ShadowRoot* shadowRoot = hostNodes->item(index)->shadowRoot(); 166 ShadowRoot* shadowRoot = hostNodes->item(index)->shadowRoot();
167 runTestOnTree(shadowRoot, webView, client); 167 runTestOnTree(shadowRoot, webView, client);
168 } 168 }
169 169
170 // Projections show up in the main document. 170 // Projections show up in the main document.
171 runTestOnTree(document.get(), webView, client); 171 runTestOnTree(document.get(), webView, client);
172 172
173 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally scoped client. 173 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally scoped client.
174 } 174 }
175 175
176 WebView* TouchActionTest::setupTest(std::string file, TouchActionTrackingWebView Client& client) 176 WebView* TouchActionTest::setupTest(std::string file, TouchActionTrackingWebView Client& client)
177 { 177 {
178 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL), WebString::fromUTF8(file)); 178 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL), WebString::fromUTF8(file));
179 // Note that JavaScript must be enabled for shadow DOM tests. 179 // Note that JavaScript must be enabled for shadow DOM tests.
180 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + file, true, 0, &client); 180 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + file, true, 0, &client);
181 181
182 // Lock page scale factor to avoid zooming out to contents size. 182 // Lock page scale factor to avoid zooming out to contents size.
183 m_webViewHelper.webView()->setPageScaleFactorLimits(1, 1); 183 m_webViewHelper.webView()->setPageScaleFactorLimits(1, 1);
184 184
185 // Set size to enable hit testing, and avoid line wrapping for consistency w ith browser. 185 // Set size to enable hit testing, and avoid line wrapping for consistency w ith browser.
186 webView->resize(WebSize(800, 1200)); 186 webView->resize(WebSize(800, 1200));
187 187
188 // Scroll to verify the code properly transforms windows to client co-ords. 188 // Scroll to verify the code properly transforms windows to client co-ords.
189 const int kScrollOffset = 100; 189 const int kScrollOffset = 100;
190 RefPtrWillBeRawPtr<Document> document = static_cast<PassRefPtrWillBeRawPtr<D ocument> >(webView->mainFrame()->document()); 190 RefPtrWillBeRawPtr<Document> document = static_cast<PassRefPtrWillBeRawPtr<D ocument>>(webView->mainFrame()->document());
191 document->frame()->view()->setScrollOffset(IntPoint(0, kScrollOffset)); 191 document->frame()->view()->setScrollOffset(IntPoint(0, kScrollOffset));
192 192
193 return webView; 193 return webView;
194 } 194 }
195 195
196 void TouchActionTest::runTestOnTree(ContainerNode* root, WebView* webView, Touch ActionTrackingWebViewClient& client) 196 void TouchActionTest::runTestOnTree(ContainerNode* root, WebView* webView, Touch ActionTrackingWebViewClient& client)
197 { 197 {
198 // Find all elements to test the touch-action of in the document. 198 // Find all elements to test the touch-action of in the document.
199 TrackExceptionState es; 199 TrackExceptionState es;
200 200
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 { 342 {
343 runShadowDOMTest("touch-action-shadow-dom.html"); 343 runShadowDOMTest("touch-action-shadow-dom.html");
344 } 344 }
345 345
346 TEST_F(TouchActionTest, Pan) 346 TEST_F(TouchActionTest, Pan)
347 { 347 {
348 runTouchActionTest("touch-action-pan.html"); 348 runTouchActionTest("touch-action-pan.html");
349 } 349 }
350 350
351 } 351 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698