Bug 781620 - Bridge the DOM webapps registry with nsIPrincipal::GetStatus() - Part 3 : updating tests. [r=mounir]
authorFabrice Desré <fabrice@mozilla.com>
Wed, 29 Aug 2012 07:31:10 -0700
changeset 105814 45181e6a27114a88ee98dd5e11c11a7aa40f88cb
parent 105813 0633977cfcc328f2c02d0a23ef64781165f0b319
child 105815 a4d2747686d250ed9b0eaed9376d8bdde6dbc117
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersmounir
bugs781620
milestone18.0a1
Bug 781620 - Bridge the DOM webapps registry with nsIPrincipal::GetStatus() - Part 3 : updating tests. [r=mounir]
caps/tests/mochitest/test_principal_extendedorigin_appid_appstatus.html
--- a/caps/tests/mochitest/test_principal_extendedorigin_appid_appstatus.html
+++ b/caps/tests/mochitest/test_principal_extendedorigin_appid_appstatus.html
@@ -8,17 +8,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <title>Test for nsIPrincipal extendedOrigin, appStatus and appId</title>
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=758258">Mozilla Bug 758258</a>
 <p id="display"></p>
 <div id="content">
-  
+
 </div>
 <pre id="test">
 <script type="application/javascript;version=1.7">
 
 /** Test for Bug 758258 **/
 
 var Ci = Components.interfaces;
 
@@ -124,23 +124,23 @@ var gData = [
     src: "file:///tmp/",
     isapp: false,
     test: [ "eo-unique" ],
   },
   {
     app: "http://example.org/manifest.webapp",
     src: "file:///",
     isapp: true,
-    test: [ "eo-unique" ],
+    test: [ "eo-unique", "in-app-not-installed" ],
   },
   {
     app: "http://example.org/manifest.webapp",
     src: "file:///tmp/",
     isapp: true,
-    test: [ "eo-unique" ],
+    test: [ "eo-unique", "in-app-not-installed" ],
   },
   // iframe inside an app is part of the app.
   {
     app: "http://example.org/manifest.webapp",
     src: "http://example.org/",
     isapp: true,
     child: {
       src: "http://example.org/chrome/",
@@ -276,22 +276,21 @@ function checkIFrame(aFrame, data) {
        data.src.replace('file:///tmp/', 'file:///private/tmp/'),
        'the correct URL should have been loaded');
   } else {
     is(principal.URI.spec, data.src,
        'the correct URL should have been loaded');
   }
 
   if (data.isapp) {
-    is(principal.appStatus, Ci.nsIPrincipal.APP_STATUS_INSTALLED,
-       'this should be an installed app');
-    isnot(principal.appId, Ci.nsIScriptSecurityManager.NO_APP_ID,
-          "installed app should have a valid appId");
-    isnot(principal.appId, Ci.nsIScriptSecurityManager.UNKNOWN_APP_ID,
-          "installed app should have a valid appId");
+    if (data.test.indexOf("in-app-not-installed") != -1) {
+      is(principal.appStatus, Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED, 'this should not be an installed app');
+    } else {
+      is(principal.appStatus, Ci.nsIPrincipal.APP_STATUS_INSTALLED, 'this should be an installed app');
+    }
   } else {
     is(principal.appStatus, Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED,
        'this should not be an installed app');
     is(principal.appId, Ci.nsIScriptSecurityManager.NO_APP_ID,
        "principals from non-installed app should have NO_APP_ID");
   }
 
   if (!data.isapp && !data.browser) {