Bug 952927 - Part 3: Added xpcshell-test for raw data functionality. r=mcmanus

This commit is contained in:
Pranav Kant 2014-03-07 08:55:16 -05:00
Родитель 93c3ec4d4c
Коммит 0e8e6db5c6
2 изменённых файлов: 32 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,31 @@
var rawData = new Uint8Array([65,66,67,68]);
var data = String.fromCharCode.apply(null, rawData);
function UDPSocketListener(){}
UDPSocketListener.prototype = {
QueryInterface : XPCOMUtils.generateQI([Ci.nsIUDPSocketListener]),
onPacketReceived : function(aSocket, aMessage){
var mData = String.fromCharCode.apply(null, aMessage.rawData);
do_check_eq(mData, data);
do_check_eq(mData, aMessage.data);
do_test_finished();
},
onStopListening: function(aSocket, aStatus){}
};
function run_test(){
var socket = Cc["@mozilla.org/network/udp-socket;1"].createInstance(Ci.nsIUDPSocket);
socket.init(-1, true);
do_print("Port assigned : " + socket.port);
socket.asyncListen(new UDPSocketListener());
var written = socket.send("127.0.0.1", socket.port, rawData, rawData.length);
do_check_eq(written, data.length);
do_test_pending();
}

Просмотреть файл

@ -173,6 +173,7 @@ skip-if = os == "android"
# Allocating 4GB might actually succeed on 64 bit machines
skip-if = bits != 32
[test_bug935499.js]
[test_bug952927.js]
[test_doomentry.js]
[test_cacheflags.js]
# Bug 675039: intermittent fail on Android-armv6