Permalink
Browse files

Port JS-only dromeao tests to run in TreeHouse

  • Loading branch information...
1 parent a401b6e commit 71527a7c841101dff341caa8306016a563127f52 @lawnsea committed May 3, 2012
@@ -1,70 +1,70 @@
{
"dromaeo-3d-cube": {
- file: "dromaeo-3d-cube.html",
+ file: "jsonlyrunner.html?dromaeo-3d-cube",
name: "Rotating 3D Cube",
origin: ["Simon Speich", "http://www.speich.net/computer/moztesting/3d.htm"],
desc: "Rotating the individual pixels of a cube. No rendering done.",
category: "Dromaeo JavaScript Tests",
tags: ["object", "array", "property", "math"]
},
"dromaeo-string-base64": {
- file: "dromaeo-string-base64.html",
+ file: "jsonlyrunner.html?dromaeo-string-base64",
name: "Base 64 Encoding and Decoding",
origin: ["Mozilla", "http://mozilla.org/"],
desc: "Encode and decode a random string to base 64.",
category: "Dromaeo JavaScript Tests",
tags: ["string","array","looping","bitops"]
},
"dromaeo-core-eval": {
- file: "dromaeo-core-eval.html",
+ file: "jsonlyrunner.html?dromaeo-core-eval",
name: "Code Evaluation",
origin: ["John Resig", "http://ejohn.org/"],
desc: "Microtests of code evaluation (eval, new Function).",
category: "Dromaeo JavaScript Tests",
tags: ["eval","microtest"]
},
"dromaeo-object-array": {
- file: "dromaeo-object-array.html",
+ file: "jsonlyrunner.html?dromaeo-object-array",
name: "Arrays",
origin: ["John Resig", "http://ejohn.org/"],
desc: "Microtests of arrays (construction, methods, access).",
category: "Dromaeo JavaScript Tests",
tags: ["array","microtest"]
},
"dromaeo-object-regexp": {
- file: "dromaeo-object-regexp.html",
+ file: "jsonlyrunner.html?dromaeo-object-regexp",
name: "Regular Expressions",
origin: ["John Resig", "http://ejohn.org/"],
desc: "Microtests of regular expressions (construction, matching, replace).",
category: "Dromaeo JavaScript Tests",
tags: ["regexp","microtest"]
},
"dromaeo-object-string": {
- file: "dromaeo-object-string.html",
+ file: "jsonlyrunner.html?dromaeo-object-string",
name: "Strings",
origin: ["John Resig", "http://ejohn.org/"],
desc: "Microtests of strings (concatenation, methods).",
category: "Dromaeo JavaScript Tests",
tags: ["string","microtest"]
},
"v8-crypto": {
- file: "v8-crypto.html",
+ file: "jsonlyrunner.html?v8-crypto",
name: "RSA Encryption/Decryption",
origin: ["V8 Benchmark", "http://code.google.com/apis/v8/benchmarks.html"],
desc: "Encrypt a string and then decrypt it again using RSA.",
category: "V8 Benchmark Tests",
tags: ["looping","string","bitops"]
},
"v8-deltablue": {
- file: "v8-deltablue.html",
+ file: "jsonlyrunner.html?v8-deltablue",
name: "DeltaBlue Constraint Solving",
origin: ["V8 Benchmark", "http://code.google.com/apis/v8/benchmarks.html"],
desc: "Computing a number of limitations on a set of values.",
category: "V8 Benchmark Tests",
tags: ["looping","functions"]
},
"v8-earley-boyer": {
- file: "v8-earley-boyer.html",
+ file: "jsonlyrunner.html?v8-earley-boyer",
name: "String Parsing and Searching",
origin: ["V8 Benchmark", "http://code.google.com/apis/v8/benchmarks.html"],
desc: "Tests for parsing languages and searching strings.",
@@ -80,47 +80,47 @@
tags: ["looping","functions","object"]
},
"v8-richards": {
- file: "v8-richards.html",
+ file: "jsonlyrunner.html?v8-richards",
name: "Richards Benchmarks",
origin: ["V8 Benchmark", "http://code.google.com/apis/v8/benchmarks.html"],
desc: "A series of benchmarks to test the quality of system implementation languages.",
category: "V8 Benchmark Tests",
tags: ["functions","object"]
},
"sunspider-3d-morph": {
- file: "sunspider-3d-morph.html",
+ file: "jsonlyrunner.html?sunspider-3d-morph",
name: "3D Mesh Transformation",
origin: ["WebKit", "http://webkit.org/misc/morph.html"],
desc: "Transforming the points of a matrix. No visual output.",
category: "SunSpider JavaScript Tests",
tags: ["array", "looping", "math"]
},
"sunspider-3d-raytrace": {
- file: "sunspider-3d-raytrace.html",
+ file: "jsonlyrunner.html?sunspider-3d-raytrace",
name: "3D Raytrace",
origin: ["Apple", "http://apple.com/"],
desc: "Rendering a scene using raytracing techniques. No visual output.",
category: "SunSpider JavaScript Tests",
tags: ["array", "functions", "math"]
},
"sunspider-access-binary-trees": {
- file: "sunspider-access-binary-trees.html",
+ file: "jsonlyrunner.html?sunspider-access-binary-trees",
name: "Traversing Binary Trees",
origin: ["Language Shootout", "http://shootout.alioth.debian.org/"],
desc: "Moving through an object representation of a binary tree.",
category: "SunSpider JavaScript Tests",
tags: ["object", "recursion"]
},
"sunspider-access-fannkuch": {
- file: "sunspider-access-fannkuch.html",
+ file: "jsonlyrunner.html?sunspider-access-fannkuch",
name: "Fannkuch",
origin: ["Language Shootout", "http://shootout.alioth.debian.org/"],
desc: "Figure out the number of ways in which a set of numbers can be manipulated.",
category: "SunSpider JavaScript Tests",
tags: ["array", "looping"]
},
"sunspider-access-nbody": {
- file: "sunspider-access-nbody.html",
+ file: "jsonlyrunner.html?sunspider-access-nbody",
name: "N-Body Rotation and Gravity",
origin: ["Language Shootout", "http://shootout.alioth.debian.org/"],
desc: "Compute the location of multiple planets based upon rotation and gravity.",
@@ -0,0 +1,75 @@
+<!doctype html>
+<html>
+<head>
+ <title>Runner for JS-only tests</title>
+</head>
+<body>
+ <div id="root"></div>
+ <script src="../demos/dromaeo/tests/workerrunner.js"
+ type="text/x-treehouse-javascript"
+ data-treehouse-sandbox-name="worker1"
+ data-treehouse-sandbox-children="#root"
+ ></script>
+ <script>
+ document.write('<script src="../demos/dromaeo/tests/' +
+ document.location.search.slice(1) + '.js"' +
+ ' type="text/x-treehouse-javascript"' +
+ ' data-treehouse-sandbox-name="worker1"' +
+ '><\/script>');
+ </script>
+ <script src="workerpolicy.js"
+ type="text/x-treehouse-javascript"
+ data-treehouse-sandbox-name="worker1"
+ data-treehouse-policy
+ ></script>
+ <script src="../../../lib/jsdom/ie10-compatibility.js"></script>
+ <script src="../../../lib/require.js"></script>
+ <script>
+ // web worker compat
+ window.doc = document;
+ window.win = window;
+
+ require({
+ baseUrl: '../../../src',
+ packages: [{
+ name: 'jsdom',
+ location: '../lib/jsdom',
+ main: 'jsdom'
+ }, {
+ name: 'node-htmlparser',
+ location: '../lib/jsdom/node-htmlparser'
+ }, {
+ name: 'underscore',
+ location: '../lib/underscore',
+ main: 'underscore'
+ }, {
+ name: 'treehouse',
+ location: './'
+ }]
+ }, [ 'kernel' ], function (kernel) {
+ var started = false;
+ var callback, name;
+
+ kernel.initialize({
+ loaderUrl: '../../../src/loader.js'
+ });
+ var worker = kernel.sandboxes.worker1._worker;
+
+ worker.addEventListener('message', function(event) {
+ if (event.data && !event.data.method) {
+ if (!started) {
+ name = event.data;
+ window.top.registerTest(function (cb) {
+ callback = cb;
+ started = true;
+ worker.postMessage('startEm');
+ });
+ } else {
+ callback(name, event.data);
+ }
+ }
+ }, false);
+ });
+ </script>
+</body>
+</html>
@@ -0,0 +1,6 @@
+setPolicy({
+ '!api': {
+ postMessage: true,
+ addEventListener: true
+ }
+});
Oops, something went wrong. Retry.

0 comments on commit 71527a7

Please sign in to comment.