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

Side by Side Diff: LayoutTests/dom/xhtml/level2/html/selfxhtml.js

Issue 756123002: Remove tabs and trailing whitspace in LayoutTests/dom/.../*.js (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years 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) 2001-2005 World Wide Web Consortium, 2 Copyright (c) 2001-2005 World Wide Web Consortium,
3 (Massachusetts Institute of Technology, European Research Consortium 3 (Massachusetts Institute of Technology, European Research Consortium
4 for Informatics and Mathematics, Keio University). All 4 for Informatics and Mathematics, Keio University). All
5 Rights Reserved. This work is distributed under the W3C(r) Software License [1] in the 5 Rights Reserved. This work is distributed under the W3C(r) Software License [1] in the
6 hope that it will be useful, but WITHOUT ANY WARRANTY; without even 6 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
7 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 7 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8 8
9 [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 9 [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
10 */ 10 */
11 11
12 function assertSize(descr, expected, actual) { 12 function assertSize(descr, expected, actual) {
13 var actualSize; 13 var actualSize;
14 assertNotNull(descr, actual); 14 assertNotNull(descr, actual);
15 actualSize = actual.length; 15 actualSize = actual.length;
16 assertEquals(descr, expected, actualSize); 16 assertEquals(descr, expected, actualSize);
17 } 17 }
18 18
19 function assertEqualsAutoCase(context, descr, expected, actual) { 19 function assertEqualsAutoCase(context, descr, expected, actual) {
20 if (builder.contentType == "text/html") { 20 if (builder.contentType == "text/html") {
21 if(context == "attribute") { 21 if(context == "attribute") {
22 assertEquals(descr, expected.toLowerCase(), actual.toLowerCase()); 22 assertEquals(descr, expected.toLowerCase(), actual.toLowerCase());
23 } else { 23 } else {
24 assertEquals(descr, expected.toUpperCase(), actual); 24 assertEquals(descr, expected.toUpperCase(), actual);
25 } 25 }
26 } else { 26 } else {
27 assertEquals(descr, expected, actual); 27 assertEquals(descr, expected, actual);
28 } 28 }
29 } 29 }
30
31 30
32 function assertEqualsCollectionAutoCase(context, descr, expected, actual) { 31 function assertEqualsCollectionAutoCase(context, descr, expected, actual) {
33 // 32 //
34 // if they aren't the same size, they aren't equal 33 // if they aren't the same size, they aren't equal
35 assertEquals(descr, expected.length, actual.length); 34 assertEquals(descr, expected.length, actual.length);
36 35
37 // 36 //
38 // if there length is the same, then every entry in the expected list 37 // if there length is the same, then every entry in the expected list
39 // must appear once and only once in the actual list 38 // must appear once and only once in the actual list
40 var expectedLen = expected.length; 39 var expectedLen = expected.length;
41 var expectedValue; 40 var expectedValue;
42 var actualLen = actual.length; 41 var actualLen = actual.length;
43 var i; 42 var i;
44 var j; 43 var j;
45 var matches; 44 var matches;
46 for(i = 0; i < expectedLen; i++) { 45 for(i = 0; i < expectedLen; i++) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 94 }
96 if(matches == 0) { 95 if(matches == 0) {
97 assert(descr + ": No match found for " + expectedValue,false); 96 assert(descr + ": No match found for " + expectedValue,false);
98 } 97 }
99 if(matches > 1) { 98 if(matches > 1) {
100 assert(descr + ": Multiple matches found for " + expectedValue, fals e); 99 assert(descr + ": Multiple matches found for " + expectedValue, fals e);
101 } 100 }
102 } 101 }
103 } 102 }
104 103
105
106 function assertEqualsListAutoCase(context, descr, expected, actual) { 104 function assertEqualsListAutoCase(context, descr, expected, actual) {
107 var minLength = expected.length; 105 var minLength = expected.length;
108 if (actual.length < minLength) { 106 if (actual.length < minLength) {
109 minLength = actual.length; 107 minLength = actual.length;
110 } 108 }
111 // 109 //
112 for(var i = 0; i < minLength; i++) { 110 for(var i = 0; i < minLength; i++) {
113 assertEqualsAutoCase(context, descr, expected[i], actual[i]); 111 assertEqualsAutoCase(context, descr, expected[i], actual[i]);
114 } 112 }
115 // 113 //
116 // if they aren't the same size, they aren't equal 114 // if they aren't the same size, they aren't equal
117 assertEquals(descr, expected.length, actual.length); 115 assertEquals(descr, expected.length, actual.length);
118 } 116 }
119 117
120
121 function assertEqualsList(descr, expected, actual) { 118 function assertEqualsList(descr, expected, actual) {
122 var minLength = expected.length; 119 var minLength = expected.length;
123 if (actual.length < minLength) { 120 if (actual.length < minLength) {
124 minLength = actual.length; 121 minLength = actual.length;
125 } 122 }
126 // 123 //
127 for(var i = 0; i < minLength; i++) { 124 for(var i = 0; i < minLength; i++) {
128 if(expected[i] != actual[i]) { 125 if(expected[i] != actual[i]) {
129 assertEquals(descr, expected[i], actual[i]); 126 assertEquals(descr, expected[i], actual[i]);
130 } 127 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 217 }
221 assertEquals(assertID, name, actualName); 218 assertEquals(assertID, name, actualName);
222 } 219 }
223 } 220 }
224 221
225 if(isAbsolute != null) { 222 if(isAbsolute != null) {
226 assertEquals(assertID, isAbsolute, actualPath.substring(0,1) == "/"); 223 assertEquals(assertID, isAbsolute, actualPath.substring(0,1) == "/");
227 } 224 }
228 } 225 }
229 226
230
231 // size() used by assertSize element 227 // size() used by assertSize element
232 function size(collection) 228 function size(collection)
233 { 229 {
234 return collection.length; 230 return collection.length;
235 } 231 }
236 232
237 function same(expected, actual) 233 function same(expected, actual)
238 { 234 {
239 return expected === actual; 235 return expected === actual;
240 } 236 }
(...skipping 17 matching lines...) Expand all
258 return newArray; 254 return newArray;
259 } 255 }
260 256
261 function createTempURI(scheme) { 257 function createTempURI(scheme) {
262 if (scheme == "http") { 258 if (scheme == "http") {
263 return "http://localhost:8080/webdav/tmp" + Math.floor(Math.random() * 100000) + ".xml"; 259 return "http://localhost:8080/webdav/tmp" + Math.floor(Math.random() * 100000) + ".xml";
264 } 260 }
265 return "file:///tmp/domts" + Math.floor(Math.random() * 100000) + ".xml"; 261 return "file:///tmp/domts" + Math.floor(Math.random() * 100000) + ".xml";
266 } 262 }
267 263
268
269
270 function EventMonitor() { 264 function EventMonitor() {
271 this.atEvents = new Array(); 265 this.atEvents = new Array();
272 this.bubbledEvents = new Array(); 266 this.bubbledEvents = new Array();
273 this.capturedEvents = new Array(); 267 this.capturedEvents = new Array();
274 this.allEvents = new Array(); 268 this.allEvents = new Array();
275 } 269 }
276 270
277 EventMonitor.prototype.handleEvent = function(evt) { 271 EventMonitor.prototype.handleEvent = function(evt) {
278 switch(evt.eventPhase) { 272 switch(evt.eventPhase) {
279 case 1: 273 case 1:
280 monitor.capturedEvents[monitor.capturedEvents.length] = evt; 274 monitor.capturedEvents[monitor.capturedEvents.length] = evt;
281 break; 275 break;
282 276
283 case 2: 277 case 2:
284 monitor.atEvents[monitor.atEvents.length] = evt; 278 monitor.atEvents[monitor.atEvents.length] = evt;
285 break; 279 break;
286 280
287 case 3: 281 case 3:
288 monitor.bubbledEvents[monitor.bubbledEvents.length] = evt; 282 monitor.bubbledEvents[monitor.bubbledEvents.length] = evt;
289 break; 283 break;
290 } 284 }
291 monitor.allEvents[monitor.allEvents.length] = evt; 285 monitor.allEvents[monitor.allEvents.length] = evt;
292 } 286 }
293 287
294 function DOMErrorImpl(err) { 288 function DOMErrorImpl(err) {
295 this.severity = err.severity; 289 this.severity = err.severity;
296 this.message = err.message; 290 this.message = err.message;
297 this.type = err.type; 291 this.type = err.type;
298 this.relatedException = err.relatedException; 292 this.relatedException = err.relatedException;
299 this.relatedData = err.relatedData; 293 this.relatedData = err.relatedData;
300 this.location = err.location; 294 this.location = err.location;
301 } 295 }
302 296
303
304
305 function DOMErrorMonitor() { 297 function DOMErrorMonitor() {
306 this.allErrors = new Array(); 298 this.allErrors = new Array();
307 } 299 }
308 300
309 DOMErrorMonitor.prototype.handleError = function(err) { 301 DOMErrorMonitor.prototype.handleError = function(err) {
310 errorMonitor.allErrors[errorMonitor.allErrors.length] = new DOMErrorImpl(err ); 302 errorMonitor.allErrors[errorMonitor.allErrors.length] = new DOMErrorImpl(err );
311 } 303 }
312 304
313 DOMErrorMonitor.prototype.assertLowerSeverity = function(id, severity) { 305 DOMErrorMonitor.prototype.assertLowerSeverity = function(id, severity) {
314 var i; 306 var i;
(...skipping 14 matching lines...) Expand all
329 321
330 function UserDataMonitor() { 322 function UserDataMonitor() {
331 this.allNotifications = new Array(); 323 this.allNotifications = new Array();
332 } 324 }
333 325
334 UserDataMonitor.prototype.handle = function(operation, key, data, src, dst) { 326 UserDataMonitor.prototype.handle = function(operation, key, data, src, dst) {
335 userDataMonitor.allNotifications[userDataMonitor.allNotifications.length] = 327 userDataMonitor.allNotifications[userDataMonitor.allNotifications.length] =
336 new UserDataNotification(operation, key, data, src, dst); 328 new UserDataNotification(operation, key, data, src, dst);
337 } 329 }
338 330
339
340
341 function HTMLBuilder() { 331 function HTMLBuilder() {
342 this.contentType = "application/xhtml+xml"; 332 this.contentType = "application/xhtml+xml";
343 this.supportedContentTypes = [ "application/xhtml+xml" ]; 333 this.supportedContentTypes = [ "application/xhtml+xml" ];
344 334
345 this.supportsAsyncChange = false; 335 this.supportsAsyncChange = false;
346 this.async = false; 336 this.async = false;
347 this.fixedAttributeNames = [ 337 this.fixedAttributeNames = [
348 "validating", "expandEntityReferences", "coalescing", 338 "validating", "expandEntityReferences", "coalescing",
349 "signed", "hasNullString", "ignoringElementContentWhitespace", "namespac eAware", "ignoringComments", "schemaValidating"]; 339 "signed", "hasNullString", "ignoringElementContentWhitespace", "namespac eAware", "ignoringComments", "schemaValidating"];
350 340
351 this.fixedAttributeValues = [false, true, false, true, true , false, true, false, false ]; 341 this.fixedAttributeValues = [false, true, false, true, true , false, true, false, false ];
352 this.configurableAttributeNames = [ ]; 342 this.configurableAttributeNames = [ ];
353 this.configurableAttributeValues = [ ]; 343 this.configurableAttributeValues = [ ];
354 this.initializationError = null; 344 this.initializationError = null;
355 this.initializationFatalError = null; 345 this.initializationFatalError = null;
356 this.skipIncompatibleTests = true; 346 this.skipIncompatibleTests = true;
357 this.documentURLs = new Array(); 347 this.documentURLs = new Array();
358 this.documentVarnames = new Array(); 348 this.documentVarnames = new Array();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 387 }
398 var srcChild = srcNode.firstChild; 388 var srcChild = srcNode.firstChild;
399 while(srcChild != null) { 389 while(srcChild != null) {
400 var cloneChild = this.cloneNode(srcChild, doc); 390 var cloneChild = this.cloneNode(srcChild, doc);
401 if (cloneChild != null) { 391 if (cloneChild != null) {
402 clone.appendChild(cloneChild); 392 clone.appendChild(cloneChild);
403 } 393 }
404 srcChild = srcChild.nextSibling; 394 srcChild = srcChild.nextSibling;
405 } 395 }
406 break; 396 break;
407 397
408 case 3: 398 case 3:
409 clone = doc.createTextNode(srcNode.nodeValue); 399 clone = doc.createTextNode(srcNode.nodeValue);
410 break; 400 break;
411 401
412 case 4: 402 case 4:
413 clone = doc.createCDATASection(srcNode.nodeValue); 403 clone = doc.createCDATASection(srcNode.nodeValue);
414 break; 404 break;
415 405
416 case 5: 406 case 5:
417 clone = doc.createEntityReference(srcNode.nodeName); 407 clone = doc.createEntityReference(srcNode.nodeName);
418 break; 408 break;
419 409
420 case 7: 410 case 7:
421 clone = doc.createProcessingInstruction(srcNode.target, srcNode.data); 411 clone = doc.createProcessingInstruction(srcNode.target, srcNode.data);
422 break; 412 break;
423 413
424 case 8: 414 case 8:
425 clone = doc.createComment(srcNode.nodeValue); 415 clone = doc.createComment(srcNode.nodeValue);
426 break; 416 break;
427 } 417 }
428 return clone; 418 return clone;
429 419
430 } 420 }
431 421
432
433 HTMLBuilder.prototype.load = function(frame, varname, url) { 422 HTMLBuilder.prototype.load = function(frame, varname, url) {
434 if (this.documentVarnames[0] == varname) { 423 if (this.documentVarnames[0] == varname) {
435 return document; 424 return document;
436 } 425 }
437 // 426 //
438 // 427 //
439 // not a perfect way to do this 428 // not a perfect way to do this
440 // Document.cloneNode is implementation dependent but exists in L1 429 // Document.cloneNode is implementation dependent but exists in L1
441 // and implemented in IE. The alternative brute force copy 430 // and implemented in IE. The alternative brute force copy
442 // only works in L2 or higher implementations and can't copy 431 // only works in L2 or higher implementations and can't copy
443 // entity and notation definitions, etc. 432 // entity and notation definitions, etc.
444 var clone = null; 433 var clone = null;
445 try { 434 try {
446 clone = document.cloneNode(true); 435 clone = document.cloneNode(true);
447 } catch(ex) { 436 } catch(ex) {
448 } 437 }
449 if (clone == null) { 438 if (clone == null) {
450 clone = document.implementation.createDocument( 439 clone = document.implementation.createDocument(
451 document.documentElement.namespaceURI, 440 document.documentElement.namespaceURI,
452 document.documentElement.nodeName, 441 document.documentElement.nodeName,
453 null); 442 null);
454 // 443 //
455 // Work-around since 444 // Work-around since
456 // Safari does not create document element 445 // Safari does not create document element
457 // create document. 446 // create document.
458 if (clone.documentElement == null) { 447 if (clone.documentElement == null) {
459 clone.appendChild(clone.createElementNS( 448 clone.appendChild(clone.createElementNS(
460 document.documentElement.namespaceURI, 449 document.documentElement.namespaceURI,
461 document.documentElement.nodeName)); 450 document.documentElement.nodeName));
462 } 451 }
463 var attrs = document.documentElement.attributes; 452 var attrs = document.documentElement.attributes;
464 for(var i = 0; i < attrs.length; i++) { 453 for(var i = 0; i < attrs.length; i++) {
465 var srcAttr = attrs.item(i); 454 var srcAttr = attrs.item(i);
466 clone.documentElement.setAttributeNS( 455 clone.documentElement.setAttributeNS(
467 srcAttr.namespaceURI, srcAttr.nodeName, srcAttr.nodeValue); 456 srcAttr.namespaceURI, srcAttr.nodeName, srcAttr.nodeValue);
468 } 457 }
469 458
470 var srcNode = document.firstChild; 459 var srcNode = document.firstChild;
471 while(srcNode != null && srcNode.nodeType != 1) { 460 while(srcNode != null && srcNode.nodeType != 1) {
472 if (srcNode.nodeType != 10) { 461 if (srcNode.nodeType != 10) {
473 var cloneNode = this.cloneNode(srcNode, clone); 462 var cloneNode = this.cloneNode(srcNode, clone);
474 clone.insertBefore(cloneNode, clone.documentElement); 463 clone.insertBefore(cloneNode, clone.documentElement);
475 } 464 }
476 srcNode = srcNode.nextSibling; 465 srcNode = srcNode.nextSibling;
477 } 466 }
478 srcNode = document.documentElement.nextSibling; 467 srcNode = document.documentElement.nextSibling;
479 while(srcNode != null) { 468 while(srcNode != null) {
480 var cloneNode = this.cloneNode(srcNode, clone); 469 var cloneNode = this.cloneNode(srcNode, clone);
481 clone.appendChild(cloneNode); 470 clone.appendChild(cloneNode);
482 srcNode = srcNode.nextSibling; 471 srcNode = srcNode.nextSibling;
483 } 472 }
484 srcNode = document.documentElement.firstChild; 473 srcNode = document.documentElement.firstChild;
485 while(srcNode != null) { 474 while(srcNode != null) {
486 var cloneNode = this.cloneNode(srcNode, clone); 475 var cloneNode = this.cloneNode(srcNode, clone);
487 if (cloneNode != null) { 476 if (cloneNode != null) {
488 clone.documentElement.appendChild(cloneNode); 477 clone.documentElement.appendChild(cloneNode);
489 } 478 }
490 srcNode = srcNode.nextSibling; 479 srcNode = srcNode.nextSibling;
491 } 480 }
492 } 481 }
493 return clone; 482 return clone;
494 } 483 }
495 484
496 HTMLBuilder.prototype.getImplementationAttribute = function(attr) { 485 HTMLBuilder.prototype.getImplementationAttribute = function(attr) {
497 for (var i = 0; i < this.fixedAttributeNames.length; i++) { 486 for (var i = 0; i < this.fixedAttributeNames.length; i++) {
498 if (this.fixedAttributeNames[i] == attr) { 487 if (this.fixedAttributeNames[i] == attr) {
499 return this.fixedAttributeValues[i]; 488 return this.fixedAttributeValues[i];
500 } 489 }
501 } 490 }
502 throw "Unrecognized implementation attribute: " + attr; 491 throw "Unrecognized implementation attribute: " + attr;
503 } 492 }
504 493
505
506 HTMLBuilder.prototype.setImplementationAttribute = function(attribute, value) { 494 HTMLBuilder.prototype.setImplementationAttribute = function(attribute, value) {
507 var supported = this.getImplementationAttribute(attribute); 495 var supported = this.getImplementationAttribute(attribute);
508 if (supported != value) { 496 if (supported != value) {
509 this.initializationError = "HTML loader does not support " + attribute + "=" + value; 497 this.initializationError = "HTML loader does not support " + attribute + "=" + value;
510 } 498 }
511 } 499 }
512 500
513 HTMLBuilder.prototype.canSetImplementationAttribute = function(attribute, value) { 501 HTMLBuilder.prototype.canSetImplementationAttribute = function(attribute, value) {
514 var supported = this.getImplementationAttribute(attribute); 502 var supported = this.getImplementationAttribute(attribute);
515 return (supported == value); 503 return (supported == value);
516 } 504 }
517 505
518
519
520
521 function createConfiguredBuilder() { 506 function createConfiguredBuilder() {
522 return new HTMLBuilder(); 507 return new HTMLBuilder();
523 } 508 }
524 509
525 function catchInitializationError(buildr, ex) { 510 function catchInitializationError(buildr, ex) {
526 buildr.initializationError = ex; 511 buildr.initializationError = ex;
527 buildr.initializationFatalError = ex; 512 buildr.initializationFatalError = ex;
528 } 513 }
529 514
530
531 function checkFeature(feature, version) 515 function checkFeature(feature, version)
532 { 516 {
533 if (!builder.hasFeature(feature, version)) 517 if (!builder.hasFeature(feature, version))
534 { 518 {
535 // 519 //
536 // don't throw exception so that users can select to ignore the preconditi on 520 // don't throw exception so that users can select to ignore the preconditi on
537 // 521 //
538 builder.initializationError = "builder does not support feature " + feature + " version " + version; 522 builder.initializationError = "builder does not support feature " + feature + " version " + version;
539 } 523 }
540 } 524 }
541 525
542 function setResult(resultType, message) { 526 function setResult(resultType, message) {
543 var testName = getTargetURI(); 527 var testName = getTargetURI();
544 document.title = testName + ":" + resultType; 528 document.title = testName + ":" + resultType;
545 var xhtmlNS = "http://www.w3.org/1999/xhtml"; 529 var xhtmlNS = "http://www.w3.org/1999/xhtml";
546 var newBody = document.createElementNS(xhtmlNS, "body"); 530 var newBody = document.createElementNS(xhtmlNS, "body");
547 var newTable = document.createElementNS(xhtmlNS, "table"); 531 var newTable = document.createElementNS(xhtmlNS, "table");
548 newTable.width = "100%"; 532 newTable.width = "100%";
549 newTable.border = "1"; 533 newTable.border = "1";
550 newBody.appendChild(newTable); 534 newBody.appendChild(newTable);
551 var testRow = newTable.insertRow(-1); 535 var testRow = newTable.insertRow(-1);
552 var testDiv1 = testRow.insertCell(-1); 536 var testDiv1 = testRow.insertCell(-1);
553 testDiv1.appendChild(document.createTextNode("Test")); 537 testDiv1.appendChild(document.createTextNode("Test"));
554 var testDiv2 = testRow.insertCell(-1); 538 var testDiv2 = testRow.insertCell(-1);
555 testDiv2.appendChild(document.createTextNode(testName)); 539 testDiv2.appendChild(document.createTextNode(testName));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 } 575 }
592 576
593 function checkInitialization(buildr, testname) { 577 function checkInitialization(buildr, testname) {
594 return buildr.initializationError; 578 return buildr.initializationError;
595 } 579 }
596 580
597 function preload(docRef, varname, href) { 581 function preload(docRef, varname, href) {
598 return builder.preload(docRef, varname, href); 582 return builder.preload(docRef, varname, href);
599 } 583 }
600 584
601
602 function load(docRef, varname, href) { 585 function load(docRef, varname, href) {
603 return builder.load(docRef, varname, href); 586 return builder.load(docRef, varname, href);
604 } 587 }
605 588
606
607 function getImplementationAttribute(attr) { 589 function getImplementationAttribute(attr) {
608 return builder.getImplementationAttribute(attr); 590 return builder.getImplementationAttribute(attr);
609 } 591 }
610 592
611
612 function setImplementationAttribute(attribute, value) { 593 function setImplementationAttribute(attribute, value) {
613 builder.setImplementationAttribute(attribute, value); 594 builder.setImplementationAttribute(attribute, value);
614 } 595 }
615 596
616 function createXPathEvaluator(doc) { 597 function createXPathEvaluator(doc) {
617 try { 598 try {
618 return doc.getFeature("XPath", null); 599 return doc.getFeature("XPath", null);
619 } 600 }
620 catch(ex) { 601 catch(ex) {
621 } 602 }
622 return doc; 603 return doc;
623 } 604 }
624 605
625
626 function getImplementation() { 606 function getImplementation() {
627 return builder.getImplementation(); 607 return builder.getImplementation();
628 } 608 }
629 609
630 function assertEquals(id, expected, actual) { 610 function assertEquals(id, expected, actual) {
631 var myActual; 611 var myActual;
632 if (expected != actual) { 612 if (expected != actual) {
633 myActual = actual; 613 myActual = actual;
634 if (actual == null) { 614 if (actual == null) {
635 myActual = "null"; 615 myActual = "null";
636 } 616 }
637 throw "failure:" + id + ": assertEquals failed, actual " + myActual + ", expected " + expected + "."; 617 throw "failure:" + id + ": assertEquals failed, actual " + myActual + ", expected " + expected + ".";
638 } 618 }
639 } 619 }
640 620
641 function assertNull(id, actual) { 621 function assertNull(id, actual) {
642 if (actual != null) { 622 if (actual != null) {
643 throw "failure:" + id + ": assertNull failed, actual " + actual; 623 throw "failure:" + id + ": assertNull failed, actual " + actual;
644 } 624 }
645 } 625 }
646 626
647
648 function assertTrue(id, actual) { 627 function assertTrue(id, actual) {
649 if (!actual) { 628 if (!actual) {
650 throw "failure:" + id + ": assertTrue failed"; 629 throw "failure:" + id + ": assertTrue failed";
651 } 630 }
652 } 631 }
653 632
654
655 function assertFalse(id, actual) { 633 function assertFalse(id, actual) {
656 if (actual) { 634 if (actual) {
657 throw "failure:" + id + ": assertTrue failed"; 635 throw "failure:" + id + ": assertTrue failed";
658 } 636 }
659 } 637 }
660 638
661 function assertNotNull(id, actual) { 639 function assertNotNull(id, actual) {
662 if (actual == null) { 640 if (actual == null) {
663 throw "failure:" + id + ": assertNotNull failed"; 641 throw "failure:" + id + ": assertNotNull failed";
664 } 642 }
665 } 643 }
666 644
667 function fail(id) { 645 function fail(id) {
668 throw "failure:" + id + ": fail"; 646 throw "failure:" + id + ": fail";
669 } 647 }
670 648
671
672
673 function getSuffix(contentType) { 649 function getSuffix(contentType) {
674 switch(contentType) { 650 switch(contentType) {
675 case "text/html": 651 case "text/html":
676 return ".html"; 652 return ".html";
677 653
678 case "text/xml": 654 case "text/xml":
679 return ".xml"; 655 return ".xml";
680 656
681 case "image/svg+xml": 657 case "image/svg+xml":
682 return ".svg"; 658 return ".svg";
683 659
684 case "text/mathml": 660 case "text/mathml":
685 return ".mml"; 661 return ".mml";
686 } 662 }
687 return ".xhtml"; 663 return ".xhtml";
688 } 664 }
689 665
690
691 function getResourceURI(name, scheme, contentType) { 666 function getResourceURI(name, scheme, contentType) {
692 var base = document.documentURI; 667 var base = document.documentURI;
693 if (base == null) { 668 if (base == null) {
694 base = ""; 669 base = "";
695 } else { 670 } else {
696 base = base.substring(0, base.lastIndexOf('/') + 1) + "files/"; 671 base = base.substring(0, base.lastIndexOf('/') + 1) + "files/";
697 } 672 }
698 return base + name + getSuffix(contentType); 673 return base + name + getSuffix(contentType);
699 } 674 }
700 675
701
702
703 function startTest() { 676 function startTest() {
704 677
705 // 678 //
706 // WebKit modification: 18-August-2005 679 // WebKit modification: 18-August-2005
707 // 680 //
708 // Inform the test controller that this test has a text-format result and so sh ould 681 // Inform the test controller that this test has a text-format result and so sh ould
709 // be dumped as text, and also that the dump should not occur automatically. 682 // be dumped as text, and also that the dump should not occur automatically.
710 // 683 //
711 if (window.testRunner) { 684 if (window.testRunner) {
712 testRunner.dumpAsText(); 685 testRunner.dumpAsText();
(...skipping 25 matching lines...) Expand all
738 // 711 //
739 // WebKit modification: 18-August-2005 712 // WebKit modification: 18-August-2005
740 // 713 //
741 // Inform the test controller that this test is complete, so it's time to dump. 714 // Inform the test controller that this test is complete, so it's time to dump.
742 // 715 //
743 if (window.testRunner) { 716 if (window.testRunner) {
744 testRunner.notifyDone(); 717 testRunner.notifyDone();
745 } 718 }
746 // 719 //
747 // End WebKit modification 720 // End WebKit modification
748 // 721 //
749 722
750 } 723 }
OLDNEW
« no previous file with comments | « LayoutTests/dom/xhtml/level2/html/object15.js ('k') | LayoutTests/dom/xhtml/level2/html/table01.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698