Changeset 92513 in webkit
- Timestamp:
- Aug 5, 2011 2:07:50 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r92502 r92513 1 2011-08-05 Anders Carlsson <andersca@apple.com> 2 3 Future proof an Objective-C test 4 https://bugs.webkit.org/show_bug.cgi?id=65788 5 6 Don't check explicitly for class names; just check that the objects are instances of the right classes. 7 8 * platform/mac/fast/dom/wrapper-classes-objc-expected.txt: 9 * platform/mac/fast/dom/wrapper-classes-objc.html: 10 1 11 2011-08-05 Anders Carlsson <andersca@apple.com> 2 12 -
trunk/LayoutTests/platform/mac/fast/dom/wrapper-classes-objc-expected.txt
r76208 r92513 176 176 JavaScript types 177 177 178 PASS objCWrapper Class(null) is 'nil'179 PASS objCWrapper Class(undefined) is 'WebUndefined'180 PASS objCWrapper Class(0) is 'NSCFNumber'181 PASS objCWrapper Class(1) is 'NSCFNumber'182 PASS objCWrapper Class(false) is 'NSCFBoolean'183 PASS objCWrapper Class(true) is 'NSCFBoolean'184 PASS objCWrapper Class('') is 'NSCFString'185 PASS objCWrapper Class({ }) is 'WebScriptObject'186 PASS objCWrapper Class([ ]) is 'WebScriptObject'178 PASS objCWrapperIsInstanceOf(null, 'nil') is true 179 PASS objCWrapperIsInstanceOf(undefined, 'WebUndefined') is true 180 PASS objCWrapperIsInstanceOf(0, 'NSNumber') is true 181 PASS objCWrapperIsInstanceOf(1, 'NSNumber') is true 182 PASS objCWrapperIsInstanceOf(false, 'NSNumber') is true 183 PASS objCWrapperIsInstanceOf(true, 'NSNumber') is true 184 PASS objCWrapperIsInstanceOf('', 'NSString') is true 185 PASS objCWrapperIsInstanceOf({ }, 'WebScriptObject') is true 186 PASS objCWrapperIsInstanceOf([ ], 'WebScriptObject') is true 187 187 PASS objCObjectOfClass('NSNull') is null 188 188 PASS typeof objCObjectOfClass('') is 'undefined' -
trunk/LayoutTests/platform/mac/fast/dom/wrapper-classes-objc.html
r80456 r92513 17 17 if (window.layoutTestController) 18 18 layoutTestController.waitUntilDone(); 19 20 function objCWrapperIsInstanceOf(node, className) 21 { 22 if (!window.objCController) 23 return "only works under DumpRenderTree"; 24 return !!objCController.isObjectInstanceOf(node, className); 25 } 19 26 20 27 function objCWrapperClass(node) … … 266 273 debug(''); 267 274 268 shouldBe ("objCWrapperClass(null)", "'nil'");269 shouldBe ("objCWrapperClass(undefined)", "'WebUndefined'");270 shouldBe ("objCWrapperClass(0)", "'NSCFNumber'");271 shouldBe ("objCWrapperClass(1)", "'NSCFNumber'");272 shouldBe ("objCWrapperClass(false)", "'NSCFBoolean'");273 shouldBe ("objCWrapperClass(true)", "'NSCFBoolean'");274 shouldBe ("objCWrapperClass('')", "'NSCFString'");275 shouldBe ("objCWrapperClass({ })", "'WebScriptObject'");276 shouldBe ("objCWrapperClass([ ])", "'WebScriptObject'");275 shouldBeTrue("objCWrapperIsInstanceOf(null, 'nil')"); 276 shouldBeTrue("objCWrapperIsInstanceOf(undefined, 'WebUndefined')"); 277 shouldBeTrue("objCWrapperIsInstanceOf(0, 'NSNumber')"); 278 shouldBeTrue("objCWrapperIsInstanceOf(1, 'NSNumber')"); 279 shouldBeTrue("objCWrapperIsInstanceOf(false, 'NSNumber')"); 280 shouldBeTrue("objCWrapperIsInstanceOf(true, 'NSNumber')"); 281 shouldBeTrue("objCWrapperIsInstanceOf('', 'NSString')"); 282 shouldBeTrue("objCWrapperIsInstanceOf({ }, 'WebScriptObject')"); 283 shouldBeTrue("objCWrapperIsInstanceOf([ ], 'WebScriptObject')"); 277 284 278 285 shouldBe("objCObjectOfClass('NSNull')", "null"); // can't test with typeof because typeof null is 'object' -
trunk/Tools/ChangeLog
r92497 r92513 1 2011-08-05 Anders Carlsson <andersca@apple.com> 2 3 Future proof an Objective-C test 4 https://bugs.webkit.org/show_bug.cgi?id=65788 5 6 Reviewed by Dan Bernstein. 7 8 Add isObjectInstanceOf to ObjCController. 9 10 * DumpRenderTree/mac/ObjCController.m: 11 (+[ObjCController isSelectorExcludedFromWebScript:]): 12 (+[ObjCController webScriptNameForSelector:]): 13 (-[ObjCController isObject:instanceOf:]): 14 1 15 2011-08-05 Adam Barth <abarth@webkit.org> 2 16 -
trunk/Tools/DumpRenderTree/mac/ObjCController.m
r74733 r92513 67 67 if (0 68 68 || aSelector == @selector(classNameOf:) 69 || aSelector == @selector(isObject:instanceOf:) 69 70 || aSelector == @selector(objectOfClass:) 70 71 || aSelector == @selector(arrayOfString) … … 88 89 if (aSelector == @selector(classNameOf:)) 89 90 return @"className"; 91 if (aSelector == @selector(isObject:instanceOf:)) 92 return @"isObjectInstanceOf"; 90 93 if (aSelector == @selector(objectOfClass:)) 91 94 return @"objectOfClass"; … … 114 117 } 115 118 119 - (BOOL)isObject:(id)object instanceOf:(NSString *)aClass 120 { 121 if (!object) 122 return [aClass isEqualToString:@"nil"]; 123 124 return [object isKindOfClass:NSClassFromString(aClass)]; 125 } 126 116 127 - (NSString *)classNameOf:(id)object 117 128 {
Note: See TracChangeset
for help on using the changeset viewer.