Bug 824670 - Tests. r=mounir

This commit is contained in:
Bobby Holley 2013-01-08 10:39:45 -08:00
parent 4a4a0c0bc0
commit 9db284dbf1
9 changed files with 91 additions and 1 deletions

View File

@ -34,6 +34,12 @@ MOCHITEST_CHROME_FILES = \
invalid_entry_point.webapp^headers^ \
invalid_locale_entry_point.webapp \
invalid_locale_entry_point.webapp^headers^ \
invalid_activity_href.webapp \
invalid_activity_href.webapp^headers^ \
invalid_activity_href2.webapp \
invalid_activity_href2.webapp^headers^ \
invalid_message.webapp \
invalid_message.webapp^headers^ \
launch_paths.webapp \
launch_paths.webapp^headers^ \
$(NULL)

View File

@ -1,4 +1,16 @@
{
"name": "Basic App",
"installs_allowed_from": ["*"]
"installs_allowed_from": ["*"],
"activities": {
"without_href": {
"returnValue": true
},
"valid_href": {
"returnvalue": true,
"href": "/foo.html"
}
},
"messages": [
{ "valid_message_href": "/bar.html" }
]
}

View File

@ -0,0 +1,14 @@
{
"name": "Absolute Activity Href App",
"description": "App with an invalid activity href",
"installs_allowed_from": [ "*" ],
"activities": {
"without_href": { },
"absolute_href": {
"href": "http://www.mozilla.org"
},
"valid_href": {
"href": "/transfer.html"
}
}
}

View File

@ -0,0 +1 @@
Content-Type: application/x-web-app-manifest+json

View File

@ -0,0 +1,14 @@
{
"name": "data:URI Activity Href App",
"description": "App with an invalid activity href",
"installs_allowed_from": [ "*" ],
"activities": {
"without_href": { },
"valid_href": {
"href": "/transfer.html"
},
"invalid_href": {
"href": "data:text/html;base64,PGh0bWw+DQo8aGVhZD4NCjwvaGVhZD4NCjxib2R5Pg0KPGI+SGFoITwvYj4NCjwvYm9keT4NCjwvaHRtbD4="
}
}
}

View File

@ -0,0 +1 @@
Content-Type: application/x-web-app-manifest+json

View File

@ -0,0 +1,8 @@
{
"name": "Absolute Message Href App",
"description": "App with an invalid message href",
"installs_allowed_from": [ "*" ],
"messages": [
{ "absolute_href": "http://www.mozilla.org" }
]
}

View File

@ -0,0 +1 @@
Content-Type: application/x-web-app-manifest+json

View File

@ -29,6 +29,9 @@ var steps = [
invalidLaunchPath2,
invalidEntryPoint,
invalidLocaleEntryPoint,
invalidActivityHref,
invalidActivityHref2,
invalidMessage,
fileURL,
originNotAllowed,
originAllowed,
@ -144,6 +147,36 @@ function invalidLocaleEntryPoint(next) {
};
}
function invalidActivityHref(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/invalid_activity_href.webapp";
confirmNextInstall();
navigator.mozApps.install(url, null).onerror = function onInstallError() {
is(this.error.name, "INVALID_MANIFEST", "Manifest has non-relative URI for activity href");
next();
};
}
function invalidActivityHref2(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/invalid_activity_href2.webapp";
confirmNextInstall();
navigator.mozApps.install(url, null).onerror = function onInstallError() {
is(this.error.name, "INVALID_MANIFEST", "Manifest has data: URI for activity href");
next();
};
}
function invalidMessage(next) {
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/invalid_message.webapp";
confirmNextInstall();
navigator.mozApps.install(url, null).onerror = function onInstallError() {
is(this.error.name, "INVALID_MANIFEST", "Manifest has absolute message href");
next();
};
}
function installPackageNotImplemented(next) {
ok(!("installPackage" in navigator.mozApps),
"installPackage not in navigator.mozApps");