Skip to content

Commit

Permalink
entire test suite, still several bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
David Clarke committed Feb 25, 2012
1 parent 55873df commit 411ac21
Show file tree
Hide file tree
Showing 25 changed files with 3,182 additions and 47 deletions.
9 changes: 9 additions & 0 deletions fake_hosting.js
@@ -0,0 +1,9 @@

var SERVERS = {"_primary":"http://127.0.0.1:8088",
"basic_app":"http://www.example.com:80/tests/dom/tests/mochitest/webapps/servers/basic_app/",
"app_with_simple_service":"http://127.0.0.1:57043",
"bad_content_type":"http://127.0.0.1:57044"};


//"basic_app":"http://127.0.0.1:57045","json_syntax_error":"http://127.0.0.1:57046","manifest_with_bom":"http://127.0.0.1:57047","missing_required_field":"http://127.0.0.1:57048","no_delegated_install":"http://127.0.0.1:57049","no_mgmt_api_off_repo_origin":"http://127.0.0.1:57050","demo":"http://127.0.0.1:57051","demopaid":"http://127.0.0.1:57052","mozillaball":"http://127.0.0.1:57053","mozillahead":"http://127.0.0.1:57054","tasktracker":"http://127.0.0.1:57055","app1":"http://127.0.0.1:57056","app2":"http://127.0.0.1:57057"};

19 changes: 19 additions & 0 deletions fake_hosting.sjs
@@ -0,0 +1,19 @@
const CC = Components.Constructor;
const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
"nsIBinaryInputStream",
"setInputStream");

function handleRequest(request, response) {
var host = request.host;
var port = request.port;
var path = request.path;
var file;

getObjectState("SERVER_ROOT", function(serverRoot)
{
file = serverRoot.getFile("tests/dom/tests/mochitest/webapps/servers/basic_app/" + path);
});
response.write(file);
}


2 changes: 2 additions & 0 deletions servers/README.md
@@ -0,0 +1,2 @@
Each directory here will be run in its own webserver
running on localhost by the test harness at ../run.js
42 changes: 42 additions & 0 deletions servers/app_that_eats_images/backchannel.html
@@ -0,0 +1,42 @@
<html>
<body>
This page contains javascript that can be included in an iframe and
upon recieving commands over jschannel will serve up gunk from local storage.
</body>
<script src="/servers.js"></script>
<!-- jschannel, that's how our parent will control us -->
<script src="/jschannel.js"></script>
<!-- finally, define our handlers that'll be invoked over jschannel by the parent -->
<script>

function myonload() {
// update repo origin for the test environment
if (navigator.mozApps.setRepoOrigin) {
navigator.mozApps.setRepoOrigin(SERVERS['_primary']);
}

var chan = Channel.build({
window: window.parent,
origin: "*",
scope: "test"
});

chan.bind("getLastImage", function(trans) {
return window.localStorage.getItem("lastImage");
});
}
</script>
<!-- a tricky bit here, we need to include the repo API js. Well wait
-- to bind our JSChannel until the browser decides to load it. -->
<script>
var includeJsURL = SERVERS['_primary'] + "/jsapi/include.js";
var scriptTag = document.createElement("script");
scriptTag.src = includeJsURL;
scriptTag.onreadystatechange = function () {
if (this.readyState == 'complete') myonload();
};
scriptTag.onload = myonload;
document.getElementsByTagName('head')[0].appendChild(scriptTag);
</script>

</html>
17 changes: 17 additions & 0 deletions servers/app_that_eats_images/image_handler.html
@@ -0,0 +1,17 @@
<!DOCTYPE html>

<script src="/servers.js"></script>
<script src="jschannel.js"></script>
<script>

var chan = Channel.build({window: window.parent, origin: "*", scope: "openwebapps_conduit"});
chan.bind("image.send", function(trans, s) {
window.localStorage.setItem("lastImage", s.data);
return null;
});

</script>
</head>
</html>

</script>

0 comments on commit 411ac21

Please sign in to comment.