Handle negative numbers on length input.
Merge pull request #212 from shans/handle_negatives

Handle negative numbers on length input.
Rewriting the test framework (to be closer to testharness) and porting all tests.

My goals where:
 * Make the tests more readable;
 * Make the tests non-flaky or timing dependent;
 * Make the tests faster by removing setTimeout and other slow operations;
 * Make basic performance analysis work (by excluding loading time);
 * Make our custom test changes possible to send upstream;

The code has been split into three files;
 * testharness_styles.js - Contains the extra asserts and code for dealing with styles
 * testharness_timing.js - Contains the code to allow testharness deal with time.
 * testharness_bootstrap.js - Contains the small remaining code which auto-includes all the testharness pieces

== Adding assert functions for checking style properties ==
First thing I have added is a bunch of assert functions which cover our common
check use case. These are the form of the existing assert_equal and other
assert functions.

	assert_style(<object>, <style dictionary>);
	assert_style(document.getElementById('id'), {'width': '24px'});

	assert_dom_style(<index>, <query selector>, <style dictionary>);
	assert_dom_style(0, '#id',   {'width': '24px'});
	assert_dom_style(5, '.anim', {'width': '24px'});

== Automatic test name generation ==
Another small change is that we don't name our tests very often, so I've
extended generate_tests to allow a "null" input name and automatically create
them.

	generate_tests(assert_equals, [
	    [null, 1+1, 2],
	    [null, 1+0, 1]
	    ])

equivalent to;

	generate_tests(assert_equals, [
	    ["assert_equals(2, 2)", 1+1, 2],
	    ["assert_equals(2, 2)", 1+0, 1]
	    ])

It even does a smarter job with assert_style and assert_dom_style giving the
current names like;
	An anonymous div assert_style({'width': '24px'})
or
	objectid assert_style({'width': '24px'})

They could be made even nicer....

== Teaching test-harness.js about timing ==

To replace the setTimeout and .currentTime changing I needed to teaching
test-harness.js about timing. I did this by adding two new functions which
mirror the original test and generate_tests functions. Internally it uses
testharness's async_tests and a custom time tracking system so they all appear
in the testharness report as expected.

test_at function
	test(<function>, <name>);
	test_at(<time to test at>, <function>, <name>);

For example;
	test(function() {assert_true(true)}, "assert_true with true")
	test_at(0.5, function() {assert_true(true)}, "assert_true with true at 0.5")

generation_tests_at function
	generate_tests(<test_function>, <list of parameters>, <properties>, <common parameters>)
	generate_tests_at(<test_function>, <list of parameters>, <properties>, <common parameters>)

For example;
	generate_tests(assert_equals, [
	     ["Sum one and one", 1+1, 2],
	     ["Sum one and zero", 1+0, 1]
	     ])
	generate_tests_at(0.5, assert_equals, [
	     ["Sum one and one", 1+1, 2],
	     ["Sum one and zero", 1+0, 1]
	     ])

The existing code is changed in the following ways;

=== Changes to *-checks.js ===

The old code which reads;
	check(document.querySelectorAll('.anim')[0],{'width':'50px'},0.5);
	check(document.querySelectorAll('.anim')[1],{'width':'50px'},0.5);
	check(document.querySelectorAll('.anim')[2],{'width':'50px'},0.5);

becomes
	test_at(0.5, function(){ assert_dom_style('.anim', 0, {'width':'50px'}); }, null);
	test_at(0.5, function(){ assert_dom_style('.anim', 1, {'width':'50px'}); }, null);
	test_at(0.5, function(){ assert_dom_style('.anim', 2, {'width':'50px'}); }, null);

which becomes
	generate_tests_at(0.0, assert_dom_style, [
		[null, 0, '.anim', {'width':'50px'}],
		[null, 1, '.anim', {'width':'50px'}],
		[null, 2, '.anim', {'width':'50px'}]
	    ]);

=== Changes to setTimeout tests ===
For setTimeout tests the changes are less drastic and more readable.

var animFunc = {left: ["100px", "200px"]};

// Test that the animation interval uses inclusive start and end bounds.
var elem1 = document.getElementById("anim1");
var player1 =
    document.timeline.play(new Animation(elem1, animFunc, 1.0));

test_at(
    0.0,
    function() { assert_equals(getComputedStyle(elem1).left, "100px") },
    "Start bound should be inclusive");

test_at(
    1.0,
    function() { assert_equals(getComputedStyle(elem1).left, "200px") },
    "End bound should be inclusive");
Fixing the finished posting to Python test runner.
Reworking the API for assert_style to be as discussed on pull request.

asserts that elements returned from a query selector have a list of styles.

Assert the element with id #hello is 100px wide;
    assert_styles(document.getElementById('hello'), {'width': '100px'})
    assert_styles('#hello'), {'width': '100px'})

Assert all divs are 100px wide;
    assert_styles(document.getElementsByTagName('div'), {'width': '100px'})
    assert_styles('div', {'width': '100px'})

Assert all objects with class "red" are 100px wide;
    assert_styles(document.getElementsByClassName('red'), {'width': '100px'})
    assert_styles('.red', {'width': '100px'})

Assert first div is 100px wide, second div is 200px wide;
    assert_styles(document.getElementsByTagName('div'),
                  [{'width': '100px'}, {'width': '200px'}])
    assert_styles('div',
                  [{'width': '100px'}, {'width': '200px'}])
Fix typo with accumulateOperation
Remove last remains of per-keyframe timing functions
Merge pull request #213 from mithro/anim-rewrite-squash

Rewriting the test framework (to be closer to testharness) and porting all tests.
new DOM methods.
Ensure query selector specified in assert_styles actually matches
Merge pull request #215 from steveblock/groupedAnimationEffect

Fix typo with accumulateOperation
Merge pull request #216 from dstockwell/more-test-checks

Ensure query selector specified in assert_styles actually matches
Changed getPlayer() method to readonly player attribute.
Merge pull request #217 from mikelawther/rename

Changed getPlayer() method to readonly player attribute.
Teach polyfill about new DOM-style operations on TimedItems and TimingGroups.
Removed test cases that shouldn't be reintroduced.
Merge pull request #218 from shans/newDOM

Teach polyfill about new DOM-style operations
Added strict flag
Fixed global variable assignment
More of the same