electron/spec/chromium-spec.coffee

56 lines
1.6 KiB
CoffeeScript
Raw Normal View History

2013-12-27 06:58:13 +00:00
assert = require 'assert'
path = require 'path'
2013-12-27 06:58:13 +00:00
2013-12-15 16:31:40 +00:00
describe 'chromium feature', ->
fixtures = path.resolve __dirname, 'fixtures'
describe 'heap snapshot', ->
it 'does not crash', ->
process.atomBinding('v8_util').takeHeapSnapshot()
describe 'sending request of http protocol urls', ->
it 'does not crash', ->
@timeout 5000
$.get 'https://api.github.com/zen'
describe 'navigator.webkitGetUserMedia', ->
it 'calls its callbacks', (done) ->
@timeout 5000
navigator.webkitGetUserMedia audio: true, video: false,
-> done()
-> done()
2013-12-27 06:58:13 +00: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-10 14:42:03 +00:00
describe 'iframe', ->
page = path.join fixtures, 'pages', 'change-parent.html'
beforeEach ->
global.changedByIframe = false
2014-03-10 14:42:03 +00:00
it 'can not modify parent by default', (done) ->
iframe = $('<iframe>')
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 14:42:03 +00: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