1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/webapprt/test/chrome/browser_sample.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,20 @@ 1.4 +// This is a sample WebappRT chrome test. It's just a browser-chrome mochitest. 1.5 + 1.6 +Cu.import("resource://webapprt/modules/WebappRT.jsm"); 1.7 + 1.8 +function test() { 1.9 + waitForExplicitFinish(); 1.10 + ok(true, "true is true!"); 1.11 + loadWebapp("sample.webapp", undefined, function onLoad() { 1.12 + is(document.documentElement.getAttribute("title"), 1.13 + WebappRT.config.app.manifest.name, 1.14 + "Window title should be webapp name"); 1.15 + let msg = gAppBrowser.contentDocument.getElementById("msg"); 1.16 + var observer = new MutationObserver(function (mutations) { 1.17 + ok(/^Webapp getSelf OK:/.test(msg.textContent), 1.18 + "The webapp should have successfully installed and updated its msg"); 1.19 + finish(); 1.20 + }); 1.21 + observer.observe(msg, { childList: true }); 1.22 + }); 1.23 +}