dom/mobilemessage/tests/marionette/test_incoming.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/ */
     4 MARIONETTE_TIMEOUT = 60000;
     6 SpecialPowers.setBoolPref("dom.sms.enabled", true);
     7 SpecialPowers.addPermission("sms", true, document);
     9 const SENDER = "5555552368"; // the remote number
    10 const RECEIVER = "15555215554"; // the emulator's number
    12 let manager = window.navigator.mozMobileMessage;
    13 ok(manager instanceof MozMobileMessageManager,
    14    "manager is instance of " + manager.constructor);
    16 let body = "Hello SMS world!";
    18 let completed = false;
    19 runEmulatorCmd("sms send " + SENDER + " " + body, function(result) {
    20   log("Sent fake SMS: " + result);
    21   is(result[0], "OK", "Emulator command result");
    22   completed = true;
    23 });
    25 manager.onreceived = function onreceived(event) {
    26   log("Received an SMS!");
    28   let message = event.message;
    29   ok(message instanceof MozSmsMessage, "Message is instanceof MozSmsMessage");
    31   ok(message.threadId, "thread id");
    32   is(message.delivery, "received", "Message delivery");
    33   is(message.deliveryStatus, "success", "Delivery status");
    34   is(message.sender, SENDER, "Message sender");
    35   is(message.receiver, RECEIVER, "Message receiver");
    36   is(message.body, body, "Message body");
    37   is(message.messageClass, "normal", "Message class");
    38   is(message.deliveryTimestamp, 0, "deliveryTimestamp is 0");
    40   cleanUp();
    41 };
    43 function cleanUp() {
    44   if (!completed) {
    45     window.setTimeout(cleanUp, 100);
    46     return;
    47   }
    49   SpecialPowers.removePermission("sms", document);
    50   finish();
    51 }

mercurial