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

Side by Side Diff: LayoutTests/fast/dom/event-target-arguments.html

Issue 1233483002: Add counters for add/removeEventListener() called with one argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: No [Conditional] support Created 5 years, 5 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
« no previous file with comments | « no previous file | LayoutTests/fast/dom/event-target-arguments-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script> 2 <script src="../../resources/js-test.js"></script>
3 <body> 3 <body>
4 <script> 4 <script>
5 description('EventTarget.addEventListener and EventTarget.removeEventLister shou ld throw on invalid arguments.'); 5 description('EventTarget.addEventListener and EventTarget.removeEventLister shou ld throw on invalid arguments.');
6 6
7 function listener(event) 7 function listener(event)
8 { 8 {
9 } 9 }
10 10
11 debug('Signature:') 11 debug('Signature:')
12 debug('void addEventListener(DOMString type, EventListener listener, optional bo olean useCapture)'); 12 debug('void addEventListener(DOMString type, EventListener listener, optional bo olean useCapture)');
13 // FIXME: should throw on missing arguments: http://crbug.com/353484 13 // FIXME: should throw on missing arguments: http://crbug.com/353484
14 // shouldThrow('document.addEventListener()'); 14 // shouldThrow('document.addEventListener()');
15 // shouldThrow('document.addEventListener("foo")'); 15 // shouldThrow('document.addEventListener("foo")');
16 var AddEventListenerNoArguments = 656;
17 shouldBeFalse('internals.isUseCounted(document, AddEventListenerNoArguments)');
16 shouldBe('document.addEventListener()', 'undefined'); 18 shouldBe('document.addEventListener()', 'undefined');
19 shouldBeTrue('internals.isUseCounted(document, AddEventListenerNoArguments)');
20 var AddEventListenerOneArgument = 657;
21 shouldBeFalse('internals.isUseCounted(document, AddEventListenerOneArgument)');
17 shouldBe('document.addEventListener("foo")', 'undefined'); 22 shouldBe('document.addEventListener("foo")', 'undefined');
23 shouldBeTrue('internals.isUseCounted(document, AddEventListenerOneArgument)');
18 shouldNotThrow('document.addEventListener("foo", listener)'); 24 shouldNotThrow('document.addEventListener("foo", listener)');
19 shouldNotThrow('document.addEventListener("", listener)'); 25 shouldNotThrow('document.addEventListener("", listener)');
20 shouldNotThrow('document.addEventListener("", function(){})'); 26 shouldNotThrow('document.addEventListener("", function(){})');
21 shouldNotThrow('document.addEventListener("bar", listener, false)'); 27 shouldNotThrow('document.addEventListener("bar", listener, false)');
22 shouldNotThrow('document.addEventListener("bar", listener, true)'); 28 shouldNotThrow('document.addEventListener("bar", listener, true)');
23 // null 29 // null
24 shouldBe('document.addEventListener(null)', 'undefined'); 30 shouldBe('document.addEventListener(null)', 'undefined');
25 shouldNotThrow('document.addEventListener(null, listener)'); // converted to "nu ll" 31 shouldNotThrow('document.addEventListener(null, listener)'); // converted to "nu ll"
26 // FIXME: throw on |null|: http://crbug.com/249598 32 // FIXME: throw on |null|: http://crbug.com/249598
27 // shouldThrow('document.addEventListener("foo", null)'); 33 // shouldThrow('document.addEventListener("foo", null)');
28 shouldBe('document.addEventListener("foo", null)', 'undefined'); 34 shouldBe('document.addEventListener("foo", null)', 'undefined');
29 shouldNotThrow('document.addEventListener("zork", listener, null)'); 35 shouldNotThrow('document.addEventListener("zork", listener, null)');
30 // undefined 36 // undefined
31 // FIXME: behavior of undefined for mandatory arguments is unclear, but 37 // FIXME: behavior of undefined for mandatory arguments is unclear, but
32 // probably should throw 38 // probably should throw
33 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=23532 39 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=23532
34 shouldBe('document.addEventListener(undefined)', 'undefined'); 40 shouldBe('document.addEventListener(undefined)', 'undefined');
35 // shouldThrow('document.addEventListener(undefined, listener)'); 41 // shouldThrow('document.addEventListener(undefined, listener)');
36 // shouldThrow('document.addEventListener("foo", undefined)'); 42 // shouldThrow('document.addEventListener("foo", undefined)');
37 shouldBe('document.addEventListener(undefined, listener)', 'undefined'); 43 shouldBe('document.addEventListener(undefined, listener)', 'undefined');
38 shouldBe('document.addEventListener("foo", undefined)', 'undefined'); 44 shouldBe('document.addEventListener("foo", undefined)', 'undefined');
39 shouldNotThrow('document.addEventListener("zork", listener, undefined)'); 45 shouldNotThrow('document.addEventListener("zork", listener, undefined)');
40 46
41 debug(''); 47 debug('');
42 debug('Signature:'); 48 debug('Signature:');
43 debug('void removeEventListener(DOMString type, EventListener listener, optional boolean useCapture)'); 49 debug('void removeEventListener(DOMString type, EventListener listener, optional boolean useCapture)');
44 // FIXME: should throw on missing arguments: http://crbug.com/353484 50 // FIXME: should throw on missing arguments: http://crbug.com/353484
45 // shouldThrow('document.removeEventListener()'); 51 // shouldThrow('document.removeEventListener()');
46 // shouldThrow('document.removeEventListener("foo")'); 52 // shouldThrow('document.removeEventListener("foo")');
53 var RemoveEventListenerNoArguments = 658;
54 shouldBeFalse('internals.isUseCounted(document, RemoveEventListenerNoArguments)' );
47 shouldBe('document.removeEventListener()', 'undefined'); 55 shouldBe('document.removeEventListener()', 'undefined');
56 shouldBeTrue('internals.isUseCounted(document, RemoveEventListenerNoArguments)') ;
57 var RemoveEventListenerOneArgument = 659;
58 shouldBeFalse('internals.isUseCounted(document, RemoveEventListenerOneArgument)' );
48 shouldBe('document.removeEventListener("foo")', 'undefined'); 59 shouldBe('document.removeEventListener("foo")', 'undefined');
60 shouldBeTrue('internals.isUseCounted(document, RemoveEventListenerOneArgument)') ;
49 shouldNotThrow('document.removeEventListener("foo", listener)'); 61 shouldNotThrow('document.removeEventListener("foo", listener)');
50 shouldNotThrow('document.removeEventListener("foo", listener, true)'); 62 shouldNotThrow('document.removeEventListener("foo", listener, true)');
51 shouldNotThrow('document.removeEventListener("bar", listener, false)'); 63 shouldNotThrow('document.removeEventListener("bar", listener, false)');
52 shouldNotThrow('document.removeEventListener("bar", listener, false)'); 64 shouldNotThrow('document.removeEventListener("bar", listener, false)');
53 shouldNotThrow('document.removeEventListener("bar", listener, true)'); 65 shouldNotThrow('document.removeEventListener("bar", listener, true)');
54 // null 66 // null
55 shouldBe('document.removeEventListener(null)', 'undefined'); 67 shouldBe('document.removeEventListener(null)', 'undefined');
56 shouldNotThrow('document.removeEventListener(null, listener)'); // converted to "null" 68 shouldNotThrow('document.removeEventListener(null, listener)'); // converted to "null"
57 // FIXME: throw on |null|: http://crbug.com/249598 69 // FIXME: throw on |null|: http://crbug.com/249598
58 // shouldThrow('document.removeEventListener("foo", null)'); 70 // shouldThrow('document.removeEventListener("foo", null)');
59 shouldBe('document.removeEventListener("foo", null)', 'undefined'); 71 shouldBe('document.removeEventListener("foo", null)', 'undefined');
60 shouldNotThrow('document.removeEventListener("zork", listener, null)'); 72 shouldNotThrow('document.removeEventListener("zork", listener, null)');
61 // undefined 73 // undefined
62 // FIXME: behavior of undefined for mandatory arguments is unclear, but 74 // FIXME: behavior of undefined for mandatory arguments is unclear, but
63 // probably should throw 75 // probably should throw
64 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=23532 76 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=23532
65 shouldBe('document.removeEventListener(undefined)', 'undefined'); 77 shouldBe('document.removeEventListener(undefined)', 'undefined');
66 // shouldthrow('document.removeeventlistener("foo", undefined)'); 78 // shouldthrow('document.removeeventlistener("foo", undefined)');
67 // shouldthrow('document.removeeventlistener(undefined, listener)'); 79 // shouldthrow('document.removeeventlistener(undefined, listener)');
68 shouldBe('document.removeEventListener(undefined, listener)', 'undefined'); 80 shouldBe('document.removeEventListener(undefined, listener)', 'undefined');
69 shouldBe('document.removeEventListener("foo", undefined)', 'undefined'); 81 shouldBe('document.removeEventListener("foo", undefined)', 'undefined');
70 shouldNotThrow('document.removeEventListener("zork", listener, undefined)'); 82 shouldNotThrow('document.removeEventListener("zork", listener, undefined)');
71 </script> 83 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/event-target-arguments-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698