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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/svg/script-tests/animation-events.js

Issue 2112373002: Fold fast/svg/script-tests/animation-events.js into the test using it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actually move the test... Created 4 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
OLDNEW
(Empty)
1 function getObject(interface) {
2 switch(interface) {
3 case "SVGAnimateElement":
4 var e = document.createElementNS("http://www.w3.org/2000/svg", "anim ate");
5 assert_true(e instanceof SVGAnimateElement);
6 return e;
7 case "SVGAnimateMotionElement":
8 var e = document.createElementNS("http://www.w3.org/2000/svg", "anim ateMotion");
9 assert_true(e instanceof SVGAnimateMotionElement);
10 return e;
11 case "SVGAnimateTransformElement":
12 var e = document.createElementNS("http://www.w3.org/2000/svg", "anim ateTransform");
13 assert_true(e instanceof SVGAnimateTransformElement);
14 return e;
15 case "SVGSetElement":
16 var e = document.createElementNS("http://www.w3.org/2000/svg", "set" );
17 assert_true(e instanceof SVGSetElement);
18 return e;
19 }
20 assert_unreached();
21 }
22 function testSet(interface, attribute) {
23 test(function() {
24 var object = getObject(interface);
25 function nop() {}
26 assert_equals(object[attribute], null, "Initially null");
27 object[attribute] = nop;
28 assert_equals(object[attribute], nop, "Return same function");
29 object[attribute] = "";
30 assert_equals(object[attribute], null, "Return null after setting string ");
31 object[attribute] = null;
32 assert_equals(object[attribute], null, "Finally null");
33 }, "Set " + interface + "." + attribute);
34 }
35 function testReflect(interface, attribute) {
36 test(function() {
37 var element = getObject(interface);
38 assert_false(element.hasAttribute(attribute), "Initially missing");
39 element.setAttribute(attribute, "return");
40 assert_equals(element.getAttribute(attribute), "return", "Return same st ring");
41 assert_equals(typeof element[attribute], "function", "Convert to functio n");
42 element.removeAttribute(attribute);
43 }, "Reflect " + interface + "." + attribute);
44 }
45 // Object.propertyIsEnumerable cannot be used because it doesn't
46 // work with properties inherited through the prototype chain.
47 function getEnumerable(interface) {
48 var enumerable = {};
49 for (var attribute in getObject(interface)) {
50 enumerable[attribute] = true;
51 }
52 return enumerable;
53 }
54 function testEventHandlerMapping(attribute, eventname) {
55 async_test(function(t) {
56 var element = getObject("SVGAnimateElement");
57 assert_false(element.hasAttribute(attribute), "Initially missing");
58 element[attribute] = function() {
59 t.step(function (){assert_true(true); t.done();});
60 };
61 var event = new CustomEvent(eventname);
62 element.dispatchEvent(event);
63 }, "Event " + eventname + " maps to " + attribute);
64 }
65 var enumerableCache = {};
66 function testEnumerate(interface, attribute) {
67 if (!(interface in enumerableCache)) {
68 enumerableCache[interface] = getEnumerable(interface);
69 }
70 test(function() {
71 assert_true(enumerableCache[interface][attribute]);
72 }, "Enumerate " + interface + "." + attribute);
73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698