Bug 1260528 - Tests for notifications that pass an iconUrl are causing leaks, r=kmag
authorbsilverberg <bsilverberg@mozilla.com>
Thu, 31 Mar 2016 12:27:52 -0400
changeset 331983 e212ede373888d9cba55a5e94984bda662e8c19c
parent 331982 a035f41ef23754a8dea677ab52b562e759c4cf50
child 331984 102f375bffd168e6c820b268c10a4051d69ca788
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1260528
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1260528 - Tests for notifications that pass an iconUrl are causing leaks, r=kmag MozReview-Commit-ID: KHdxEfc3OAG
toolkit/components/extensions/test/mochitest/test_ext_notifications.html
--- a/toolkit/components/extensions/test/mochitest/test_ext_notifications.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_notifications.html
@@ -7,16 +7,22 @@
   <script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
 
 <script type="text/javascript">
 "use strict";
 
+// A 1x1 PNG image.
+// Source: https://commons.wikimedia.org/wiki/File:1x1.png (Public Domain)
+let image = atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAA" +
+                 "ACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=");
+const IMAGE_ARRAYBUFFER = Uint8Array.from(image, byte => byte.charCodeAt(0)).buffer;
+
 add_task(function* test_notification() {
   function backgroundScript() {
     let opts = {
       type: "basic",
       title: "Testing Notification",
       message: "Carry on",
     };
 
@@ -136,16 +142,17 @@ add_task(function* test_notifications_em
   yield extension.awaitFinish("getAll empty");
   yield extension.unload();
 });
 
 add_task(function* test_notifications_populated_getAll() {
   function backgroundScript() {
     let opts = {
       type: "basic",
+      iconUrl: "a.png",
       title: "Testing Notification",
       message: "Carry on",
     };
 
     browser.notifications.create("p1", opts).then(() => {
       return browser.notifications.create("p2", opts);
     }).then(() => {
       return browser.notifications.getAll();
@@ -165,16 +172,19 @@ add_task(function* test_notifications_po
     });
   }
 
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
       permissions: ["notifications"],
     },
     background: `(${backgroundScript})()`,
+    files: {
+      "a.png": IMAGE_ARRAYBUFFER,
+    },
   });
   yield extension.startup();
   yield extension.awaitFinish("getAll populated");
   yield extension.unload();
 });
 
 </script>