| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library jsTest; | 5 library jsTest; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'dart:typed_data' show ByteBuffer, Int32List; | 9 import 'dart:typed_data' show ByteBuffer, Int32List; |
| 10 import 'dart:indexed_db' show IdbFactory, KeyRange; | 10 import 'dart:indexed_db' show IdbFactory, KeyRange; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 function Liar(){} | 179 function Liar(){} |
| 180 | 180 |
| 181 Liar.prototype.toString = function() { | 181 Liar.prototype.toString = function() { |
| 182 return 1; | 182 return 1; |
| 183 } | 183 } |
| 184 | 184 |
| 185 function identical(o1, o2) { | 185 function identical(o1, o2) { |
| 186 return o1 === o2; | 186 return o1 === o2; |
| 187 } | 187 } |
| 188 | 188 |
| 189 var someProto = { role: "proto" }; |
| 190 var someObject = Object.create(someProto); |
| 191 someObject.role = "object"; |
| 192 |
| 189 """; | 193 """; |
| 190 document.body.append(script); | 194 document.body.append(script); |
| 191 } | 195 } |
| 192 | 196 |
| 193 // Some test are either causing other test to fail in IE9, or they are failing | 197 // Some test are either causing other test to fail in IE9, or they are failing |
| 194 // for unknown reasons | 198 // for unknown reasons |
| 195 // useHtmlConfiguration+ImageData bug: dartbug.com/14355 | 199 // useHtmlConfiguration+ImageData bug: dartbug.com/14355 |
| 196 skipIE9_test(String description, t()) { | 200 skipIE9_test(String description, t()) { |
| 197 if (Platform.supportsTypedData) { | 201 if (Platform.supportsTypedData) { |
| 198 test(description, t); | 202 test(description, t); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 context.deleteProperty('foo2'); | 283 context.deleteProperty('foo2'); |
| 280 }); | 284 }); |
| 281 | 285 |
| 282 test('retrieve same dart Object', () { | 286 test('retrieve same dart Object', () { |
| 283 final obj = new Object(); | 287 final obj = new Object(); |
| 284 context['obj'] = obj; | 288 context['obj'] = obj; |
| 285 expect(context['obj'], same(obj)); | 289 expect(context['obj'], same(obj)); |
| 286 context.deleteProperty('obj'); | 290 context.deleteProperty('obj'); |
| 287 }); | 291 }); |
| 288 | 292 |
| 293 group('caching', () { |
| 294 test('JS->Dart', () { |
| 295 // Test that we are not pulling cached proxy from the prototype |
| 296 // when asking for a proxy for the object. |
| 297 final proto = context['someProto']; |
| 298 expect(proto['role'], same('proto')); |
| 299 final obj = context['someObject']; |
| 300 expect(obj['role'], same('object')); |
| 301 }); |
| 302 }); |
| 303 |
| 289 }); | 304 }); |
| 290 | 305 |
| 291 group('context', () { | 306 group('context', () { |
| 292 | 307 |
| 293 test('read global field', () { | 308 test('read global field', () { |
| 294 expect(context['x'], equals(42)); | 309 expect(context['x'], equals(42)); |
| 295 expect(context['y'], isNull); | 310 expect(context['y'], isNull); |
| 296 }); | 311 }); |
| 297 | 312 |
| 298 test('read global field with underscore', () { | 313 test('read global field with underscore', () { |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 // TODO(jacobr): make this test pass. Currently some type information | 1003 // TODO(jacobr): make this test pass. Currently some type information |
| 989 // is lost when typed arrays are passed between JS and Dart. | 1004 // is lost when typed arrays are passed between JS and Dart. |
| 990 // expect(context.callMethod('isPropertyInstanceOf', ['o', listType]), | 1005 // expect(context.callMethod('isPropertyInstanceOf', ['o', listType]), |
| 991 // isTrue); | 1006 // isTrue); |
| 992 context.deleteProperty('o'); | 1007 context.deleteProperty('o'); |
| 993 } | 1008 } |
| 994 }); | 1009 }); |
| 995 | 1010 |
| 996 }); | 1011 }); |
| 997 }); | 1012 }); |
| 1013 |
| 998 } | 1014 } |
| OLD | NEW |