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

Side by Side Diff: third_party/WebKit/LayoutTests/resources/js-test.js

Issue 1935703003: Layout Tests: Remove stringifyDOMObject() helper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@test-idlattr
Patch Set: Update expectation for test w/ line # change Created 4 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 // js-test now supports lazily printing test results which dumps all test 1 // js-test now supports lazily printing test results which dumps all test
2 // results once at the end of the test instead of building them up. To enable 2 // results once at the end of the test instead of building them up. To enable
3 // this option, call setPrintTestResultsLazily() before running any tests. 3 // this option, call setPrintTestResultsLazily() before running any tests.
4 var _lazyTestResults; // Set by setPrintTestResultsLazily(). 4 var _lazyTestResults; // Set by setPrintTestResultsLazily().
5 var _lazyDescription; // Set by description() after setPrintTestResultsLazily(). 5 var _lazyDescription; // Set by description() after setPrintTestResultsLazily().
6 6
7 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex t + pixel results 7 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex t + pixel results
8 if (self.testRunner) { 8 if (self.testRunner) {
9 if (self.enablePixelTesting) 9 if (self.enablePixelTesting)
10 testRunner.dumpAsTextWithPixelResults(); 10 testRunner.dumpAsTextWithPixelResults();
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 function stringify(v) 210 function stringify(v)
211 { 211 {
212 if (isNewSVGTearOffType(v)) 212 if (isNewSVGTearOffType(v))
213 return v.valueAsString; 213 return v.valueAsString;
214 if (v === 0 && 1/v < 0) 214 if (v === 0 && 1/v < 0)
215 return "-0"; 215 return "-0";
216 else return "" + v; 216 else return "" + v;
217 } 217 }
218 218
219 // Stringifies a DOM object. This function stringifies not only own properties
220 // but also DOM attributes which are on a prototype chain. Note that
221 // JSON.stringify only stringifies own properties.
222 function stringifyDOMObject(object)
223 {
224 function deepCopy(src) {
225 if (typeof src != "object")
226 return src;
227 var dst = Array.isArray(src) ? [] : {};
228 for (var property in src) {
229 dst[property] = deepCopy(src[property]);
230 }
231 return dst;
232 }
233 return JSON.stringify(deepCopy(object));
234 }
235
236 function evalAndLog(_a, _quiet) 219 function evalAndLog(_a, _quiet)
237 { 220 {
238 if (typeof _a != "string") 221 if (typeof _a != "string")
239 debug("WARN: tryAndLog() expects a string argument"); 222 debug("WARN: tryAndLog() expects a string argument");
240 223
241 // Log first in case things go horribly wrong or this causes a sync event. 224 // Log first in case things go horribly wrong or this causes a sync event.
242 if (!_quiet) 225 if (!_quiet)
243 debug(_a); 226 debug(_a);
244 227
245 var _av; 228 var _av;
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 testPassed = function(msg) { 903 testPassed = function(msg) {
921 workerPort.postMessage('PASS:' + msg); 904 workerPort.postMessage('PASS:' + msg);
922 }; 905 };
923 finishJSTest = function() { 906 finishJSTest = function() {
924 workerPort.postMessage('DONE:'); 907 workerPort.postMessage('DONE:');
925 }; 908 };
926 debug = function(msg) { 909 debug = function(msg) {
927 workerPort.postMessage(msg); 910 workerPort.postMessage(msg);
928 }; 911 };
929 } 912 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698