Index: remoting/webapp/crd/js/xmpp_stream_parser_unittest.js |
diff --git a/remoting/webapp/crd/js/xmpp_stream_parser_unittest.js b/remoting/webapp/crd/js/xmpp_stream_parser_unittest.js |
index ec6cc4530a7a9e2568bea9cc7ee12cc270e8de4b..564d0e3223dcff4fc7ca8c10fd9528e695363e55 100644 |
--- a/remoting/webapp/crd/js/xmpp_stream_parser_unittest.js |
+++ b/remoting/webapp/crd/js/xmpp_stream_parser_unittest.js |
@@ -15,8 +15,8 @@ var onError = function(msg) {}; |
/** @type {remoting.XmppStreamParser} */ |
var parser = null; |
-module('XmppStreamParser', { |
- setup: function() { |
+QUnit.module('XmppStreamParser', { |
+ beforeEach: function() { |
onStanzaStr = sinon.spy(); |
onError = /** @type {function(string):void} */ (sinon.spy()); |
/** @param {Element} stanza */ |
@@ -29,23 +29,23 @@ module('XmppStreamParser', { |
}); |
-test('should parse XMPP stream', function() { |
+QUnit.test('should parse XMPP stream', function() { |
parser.appendData(base.encodeUtf8('<stream><iq>text</iq>')); |
sinon.assert.calledWith(onStanzaStr, '<iq>text</iq>'); |
}); |
-test('should handle multiple incoming stanzas', function() { |
+QUnit.test('should handle multiple incoming stanzas', function() { |
parser.appendData(base.encodeUtf8('<stream><iq>text</iq><iq>more text</iq>')); |
sinon.assert.calledWith(onStanzaStr, '<iq>text</iq>'); |
sinon.assert.calledWith(onStanzaStr, '<iq>more text</iq>'); |
}); |
-test('should ignore whitespace between stanzas', function() { |
+QUnit.test('should ignore whitespace between stanzas', function() { |
parser.appendData(base.encodeUtf8('<stream> <iq>text</iq>')); |
sinon.assert.calledWith(onStanzaStr, '<iq>text</iq>'); |
}); |
-test('should assemble messages from small chunks', function() { |
+QUnit.test('should assemble messages from small chunks', function() { |
parser.appendData(base.encodeUtf8('<stream><i')); |
parser.appendData(base.encodeUtf8('q>')); |
@@ -59,23 +59,24 @@ test('should assemble messages from small chunks', function() { |
sinon.assert.calledWith(onStanzaStr, '<iq>😃</iq>'); |
}); |
-test('should stop parsing on errors', function() { |
+QUnit.test('should stop parsing on errors', function() { |
parser.appendData(base.encodeUtf8('<stream>error<iq>text</iq>')); |
sinon.assert.calledWith(onError); |
sinon.assert.notCalled(onStanzaStr); |
}); |
-test('should fail on invalid stream header', function() { |
+QUnit.test('should fail on invalid stream header', function() { |
parser.appendData(base.encodeUtf8('<stream p=\'>')); |
sinon.assert.calledWith(onError); |
}); |
-test('should fail on loose text', function() { |
+QUnit.test('should fail on loose text', function() { |
parser.appendData(base.encodeUtf8('stream')); |
sinon.assert.calledWith(onError); |
}); |
-test('should fail on loose text with incomplete UTF-8 sequences', function() { |
+QUnit.test('should fail on loose text with incomplete UTF-8 sequences', |
+ function() { |
var buffer = base.encodeUtf8('<stream>Ñ„') |
// Crop last byte. |
buffer = buffer.slice(0, buffer.byteLength - 1); |
@@ -83,7 +84,7 @@ test('should fail on loose text with incomplete UTF-8 sequences', function() { |
sinon.assert.calledWith(onError); |
}); |
-test('should fail on incomplete UTF-8 sequences', function() { |
+QUnit.test('should fail on incomplete UTF-8 sequences', function() { |
var buffer = base.encodeUtf8('<stream><iq>Ñ„') |
// Crop last byte. |
buffer = buffer.slice(0, buffer.byteLength - 1); |