I suspect no, but you could still unit test your code if you refactor it slightly:
Create a small factory that returns a
new $window.XMLHttpRequest()
.Then in the services/controllers, instead of calling
new XMLHttpRequest()
directly, inject this factory when you need to make call to the upload()You can unit test the service/controllers by mocking up the factory and injecting it in before the test.
You can even unit test the small factory by mocking up
$window
with anXMLHttpRequest
constructor, and injecting that in before the test.