2013-12-27 10:58:13 +04:00
|
|
|
assert = require 'assert'
|
2014-05-08 05:20:01 +04:00
|
|
|
http = require 'http'
|
2014-03-04 18:04:41 +04:00
|
|
|
path = require 'path'
|
2013-12-27 10:58:13 +04:00
|
|
|
|
2013-12-15 20:31:40 +04:00
|
|
|
describe 'chromium feature', ->
|
2014-03-04 18:04:41 +04:00
|
|
|
fixtures = path.resolve __dirname, 'fixtures'
|
|
|
|
|
2013-12-06 18:23:02 +04:00
|
|
|
describe 'heap snapshot', ->
|
|
|
|
it 'does not crash', ->
|
|
|
|
process.atomBinding('v8_util').takeHeapSnapshot()
|
|
|
|
|
|
|
|
describe 'sending request of http protocol urls', ->
|
2014-05-08 05:20:01 +04:00
|
|
|
it 'does not crash', (done) ->
|
2014-05-07 19:12:24 +04:00
|
|
|
@timeout 5000
|
2014-05-08 05:20:01 +04:00
|
|
|
server = http.createServer (req, res) ->
|
|
|
|
res.end()
|
|
|
|
server.close()
|
|
|
|
done()
|
|
|
|
server.listen 0, '127.0.0.1', ->
|
|
|
|
{port} = server.address()
|
|
|
|
$.get "http://127.0.0.1:#{port}"
|
2013-12-06 18:23:02 +04:00
|
|
|
|
|
|
|
describe 'navigator.webkitGetUserMedia', ->
|
|
|
|
it 'calls its callbacks', (done) ->
|
|
|
|
@timeout 5000
|
|
|
|
navigator.webkitGetUserMedia audio: true, video: false,
|
|
|
|
-> done()
|
|
|
|
-> done()
|
2013-12-27 10:58:13 +04:00
|
|
|
|
2014-05-29 16:23:28 +04:00
|
|
|
describe 'navigator.language', ->
|
|
|
|
it 'should not be empty', ->
|
|
|
|
assert.notEqual navigator.language, ''
|
|
|
|
|
2013-12-27 10:58:13 +04:00
|
|
|
describe 'window.open', ->
|
|
|
|
it 'returns a BrowserWindow object', ->
|
|
|
|
b = window.open 'about:blank', 'test', 'show=no'
|
|
|
|
assert.equal b.constructor.name, 'BrowserWindow'
|
|
|
|
b.destroy()
|
2014-03-04 18:04:41 +04:00
|
|
|
|
2014-03-10 18:42:03 +04:00
|
|
|
describe 'iframe', ->
|
|
|
|
page = path.join fixtures, 'pages', 'change-parent.html'
|
|
|
|
|
|
|
|
beforeEach ->
|
2014-03-04 18:04:41 +04:00
|
|
|
global.changedByIframe = false
|
|
|
|
|
2014-03-10 18:42:03 +04:00
|
|
|
it 'can not modify parent by default', (done) ->
|
|
|
|
iframe = $('<iframe>')
|
2014-03-04 18:04:41 +04:00
|
|
|
iframe.hide()
|
|
|
|
iframe.attr 'src', "file://#{page}"
|
|
|
|
iframe.appendTo 'body'
|
|
|
|
isChanged = ->
|
|
|
|
iframe.remove()
|
|
|
|
assert.equal global.changedByIframe, false
|
|
|
|
done()
|
|
|
|
setTimeout isChanged, 30
|
2014-03-10 18:42:03 +04:00
|
|
|
|
|
|
|
it 'can modify parent when sanbox is set to none', (done) ->
|
|
|
|
iframe = $('<iframe sandbox="none">')
|
|
|
|
iframe.hide()
|
|
|
|
iframe.attr 'src', "file://#{page}"
|
|
|
|
iframe.appendTo 'body'
|
|
|
|
isChanged = ->
|
|
|
|
iframe.remove()
|
|
|
|
assert.equal global.changedByIframe, true
|
|
|
|
done()
|
|
|
|
setTimeout isChanged, 30
|
2014-05-14 12:10:33 +04:00
|
|
|
|
|
|
|
describe 'creating a Uint8Array under browser side', ->
|
|
|
|
it 'does not crash', ->
|
|
|
|
RUint8Array = require('remote').getGlobal 'Uint8Array'
|
|
|
|
new RUint8Array
|
2014-05-18 18:37:59 +04:00
|
|
|
|
|
|
|
describe 'webgl', ->
|
|
|
|
it 'can be get as context in canvas', ->
|
2014-05-19 06:00:59 +04:00
|
|
|
return if process.platform is 'linux'
|
2014-05-18 18:37:59 +04:00
|
|
|
webgl = document.createElement('canvas').getContext 'webgl'
|
|
|
|
assert.notEqual webgl, null
|
2014-07-09 11:55:01 +04:00
|
|
|
|
|
|
|
describe 'web workers', ->
|
|
|
|
it 'Worker can work', (done) ->
|
|
|
|
worker = new Worker('../fixtures/workers/worker.js')
|
|
|
|
message = 'ping'
|
|
|
|
worker.onmessage = (event) ->
|
|
|
|
assert.equal event.data, message
|
|
|
|
worker.terminate()
|
|
|
|
done()
|
|
|
|
worker.postMessage message
|
|
|
|
|
|
|
|
it 'SharedWorker can work', (done) ->
|
|
|
|
worker = new SharedWorker('../fixtures/workers/shared_worker.js')
|
|
|
|
message = 'ping'
|
|
|
|
worker.port.onmessage = (event) ->
|
|
|
|
assert.equal event.data, message
|
|
|
|
done()
|
|
|
|
worker.port.postMessage message
|