Chromium Code Reviews| Index: remoting/webapp/crd/js/xhr_unittest.js |
| diff --git a/remoting/webapp/crd/js/xhr_unittest.js b/remoting/webapp/crd/js/xhr_unittest.js |
| index ea32042abe9f6c60cbfc3322af9ee19b201febe2..5d562a3c1480ba804b44c230ad6a4b77f42aab69 100644 |
| --- a/remoting/webapp/crd/js/xhr_unittest.js |
| +++ b/remoting/webapp/crd/js/xhr_unittest.js |
| @@ -11,14 +11,7 @@ |
| 'use strict'; |
| -module('xhr', { |
|
John Williams
2015/03/17 19:22:37
A call to QUnit module is still needed here to set
|
| - setup: function() { |
| - }, |
| - teardown: function() { |
| - } |
| -}); |
| - |
| -test('urlencodeParamHash', function() { |
| +QUnit.test('urlencodeParamHash', function() { |
| QUnit.equal( |
| remoting.xhr.urlencodeParamHash({}), |
| ''); |
| @@ -33,8 +26,9 @@ test('urlencodeParamHash', function() { |
| 'k1=v1&k2=v2'); |
| }); |
| -asyncTest('basic GET', function() { |
| +QUnit.test('basic GET', function(assert) { |
| sinon.useFakeXMLHttpRequest(); |
| + var done = assert.async(); |
| var request = remoting.xhr.start({ |
| method: 'GET', |
| url: 'http://foo.com', |
| @@ -42,7 +36,7 @@ asyncTest('basic GET', function() { |
| QUnit.ok(xhr === request); |
| QUnit.equal(xhr.status, 200); |
| QUnit.equal(xhr.responseText, 'body'); |
| - QUnit.start(); |
| + done(); |
| } |
| }); |
| QUnit.equal(request.method, 'GET'); |
| @@ -53,7 +47,8 @@ asyncTest('basic GET', function() { |
| request.respond(200, {}, 'body'); |
| }); |
| -asyncTest('GET with param string', function() { |
| +QUnit.test('GET with param string', function(assert) { |
| + var done = assert.async(); |
| sinon.useFakeXMLHttpRequest(); |
| var request = remoting.xhr.start({ |
| method: 'GET', |
| @@ -62,7 +57,7 @@ asyncTest('GET with param string', function() { |
| QUnit.ok(xhr === request); |
| QUnit.equal(xhr.status, 200); |
| QUnit.equal(xhr.responseText, 'body'); |
| - QUnit.start(); |
| + done(); |
| }, |
| urlParams: 'the_param_string' |
| }); |
| @@ -74,7 +69,8 @@ asyncTest('GET with param string', function() { |
| request.respond(200, {}, 'body'); |
| }); |
| -asyncTest('GET with param object', function() { |
| +QUnit.test('GET with param object', function(assert) { |
| + var done = assert.async(); |
| sinon.useFakeXMLHttpRequest(); |
| var request = remoting.xhr.start({ |
| method: 'GET', |
| @@ -83,7 +79,7 @@ asyncTest('GET with param object', function() { |
| QUnit.ok(xhr === request); |
| QUnit.equal(xhr.status, 200); |
| QUnit.equal(xhr.responseText, 'body'); |
| - QUnit.start(); |
| + done(); |
| }, |
| urlParams: {'a': 'b', 'c': 'd'} |
| }); |
| @@ -95,8 +91,9 @@ asyncTest('GET with param object', function() { |
| request.respond(200, {}, 'body'); |
| }); |
| -asyncTest('GET with headers', function() { |
| +QUnit.test('GET with headers', function(assert) { |
| sinon.useFakeXMLHttpRequest(); |
| + var done = assert.async(); |
| var request = remoting.xhr.start({ |
| method: 'GET', |
| url: 'http://foo.com', |
| @@ -104,7 +101,7 @@ asyncTest('GET with headers', function() { |
| QUnit.ok(xhr === request); |
| QUnit.equal(xhr.status, 200); |
| QUnit.equal(xhr.responseText, 'body'); |
| - QUnit.start(); |
| + done(); |
| }, |
| headers: {'Header1': 'headerValue1', 'Header2': 'headerValue2'} |
| }); |
| @@ -123,8 +120,9 @@ asyncTest('GET with headers', function() { |
| }); |
| -asyncTest('GET with credentials', function() { |
| +QUnit.test('GET with credentials', function(assert) { |
| sinon.useFakeXMLHttpRequest(); |
| + var done = assert.async(); |
| var request = remoting.xhr.start({ |
| method: 'GET', |
| url: 'http://foo.com', |
| @@ -132,7 +130,7 @@ asyncTest('GET with credentials', function() { |
| QUnit.ok(xhr === request); |
| QUnit.equal(xhr.status, 200); |
| QUnit.equal(xhr.responseText, 'body'); |
| - QUnit.start(); |
| + done(); |
| }, |
| withCredentials: true |
| }); |
| @@ -144,8 +142,9 @@ asyncTest('GET with credentials', function() { |
| request.respond(200, {}, 'body'); |
| }); |
| -asyncTest('POST with text content', function() { |
| +QUnit.test('POST with text content', function(assert) { |
| sinon.useFakeXMLHttpRequest(); |
| + var done = assert.async(); |
| var request = remoting.xhr.start({ |
| method: 'POST', |
| url: 'http://foo.com', |
| @@ -153,7 +152,7 @@ asyncTest('POST with text content', function() { |
| QUnit.ok(xhr === request); |
| QUnit.equal(xhr.status, 200); |
| QUnit.equal(xhr.responseText, 'body'); |
| - QUnit.start(); |
| + done(); |
| }, |
| textContent: 'the_content_string' |
| }); |
| @@ -165,8 +164,9 @@ asyncTest('POST with text content', function() { |
| request.respond(200, {}, 'body'); |
| }); |
| -asyncTest('POST with form content', function() { |
| +QUnit.test('POST with form content', function(assert) { |
| sinon.useFakeXMLHttpRequest(); |
| + var done = assert.async(); |
| var request = remoting.xhr.start({ |
| method: 'POST', |
| url: 'http://foo.com', |
| @@ -174,7 +174,7 @@ asyncTest('POST with form content', function() { |
| QUnit.ok(xhr === request); |
| QUnit.equal(xhr.status, 200); |
| QUnit.equal(xhr.responseText, 'body'); |
| - QUnit.start(); |
| + done(); |
| }, |
| formContent: {'a': 'b', 'c': 'd'} |
| }); |
| @@ -188,17 +188,18 @@ asyncTest('POST with form content', function() { |
| request.respond(200, {}, 'body'); |
| }); |
| -asyncTest('defaultResponse 200', function() { |
| +QUnit.test('defaultResponse 200', function(assert) { |
| sinon.useFakeXMLHttpRequest(); |
| + var done = assert.async(); |
| var onDone = function() { |
| QUnit.ok(true); |
| - QUnit.start(); |
| + done(); |
| }; |
| var onError = function(error) { |
| QUnit.ok(false); |
| - QUnit.start(); |
| + done(); |
| }; |
| var request = remoting.xhr.start({ |
| @@ -210,17 +211,17 @@ asyncTest('defaultResponse 200', function() { |
| }); |
| -asyncTest('defaultResponse 404', function() { |
| +QUnit.test('defaultResponse 404', function(assert) { |
| sinon.useFakeXMLHttpRequest(); |
| - |
| + var done = assert.async(); |
| var onDone = function() { |
| QUnit.ok(false); |
| - QUnit.start(); |
| + done(); |
| }; |
| var onError = function(error) { |
| QUnit.ok(true); |
| - QUnit.start(); |
| + done(); |
| }; |
| var request = remoting.xhr.start({ |