|
|
@ -5,6 +5,7 @@ var originalURL,
|
|
|
|
video,
|
|
|
|
video,
|
|
|
|
stream;
|
|
|
|
stream;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe("CameraAccess", () => {
|
|
|
|
beforeEach(function() {
|
|
|
|
beforeEach(function() {
|
|
|
|
var tracks = [{
|
|
|
|
var tracks = [{
|
|
|
|
stop: function() {}
|
|
|
|
stop: function() {}
|
|
|
@ -14,7 +15,7 @@ beforeEach(function() {
|
|
|
|
originalMediaStreamTrack = window.MediaStreamTrack;
|
|
|
|
originalMediaStreamTrack = window.MediaStreamTrack;
|
|
|
|
window.MediaStreamTrack = {};
|
|
|
|
window.MediaStreamTrack = {};
|
|
|
|
window.URL = {
|
|
|
|
window.URL = {
|
|
|
|
createObjectURL(stream) {
|
|
|
|
createObjectURL() {
|
|
|
|
return stream;
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -63,7 +64,7 @@ describe('success', function() {
|
|
|
|
expect(navigator.mediaDevices.getUserMedia.calledOnce).to.equal(true);
|
|
|
|
expect(navigator.mediaDevices.getUserMedia.calledOnce).to.equal(true);
|
|
|
|
expect(video.srcObject).to.deep.equal(stream);
|
|
|
|
expect(video.srcObject).to.deep.equal(stream);
|
|
|
|
done();
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it("should allow deprecated constraints to be used", (done) => {
|
|
|
|
it("should allow deprecated constraints to be used", (done) => {
|
|
|
@ -86,7 +87,7 @@ describe('success', function() {
|
|
|
|
expect(args[0].video.minAspectRatio).not.to.be.defined;
|
|
|
|
expect(args[0].video.minAspectRatio).not.to.be.defined;
|
|
|
|
expect(args[0].video.maxAspectRatio).not.to.be.defined;
|
|
|
|
expect(args[0].video.maxAspectRatio).not.to.be.defined;
|
|
|
|
done();
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -103,7 +104,7 @@ describe('success', function() {
|
|
|
|
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
afterEach(() => {
|
|
|
|
window.MediaStreamTrack = {};
|
|
|
|
window.MediaStreamTrack = {};
|
|
|
|
})
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it("should set deviceId in case facingMode is not supported", (done) => {
|
|
|
|
it("should set deviceId in case facingMode is not supported", (done) => {
|
|
|
|
CameraAccess.request(video, {
|
|
|
|
CameraAccess.request(video, {
|
|
|
@ -116,7 +117,7 @@ describe('success', function() {
|
|
|
|
expect(args[0].video.facingMode).not.to.be.defined;
|
|
|
|
expect(args[0].video.facingMode).not.to.be.defined;
|
|
|
|
expect(args[0].video.deviceId).to.equal("user");
|
|
|
|
expect(args[0].video.deviceId).to.equal("user");
|
|
|
|
done();
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -176,3 +177,4 @@ describe('failure', function() {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|