Add a test for the user agent

This commit is contained in:
Paul Betts 2015-05-05 22:06:15 -07:00
parent 22f51372f5
commit 50c913fe92
2 changed files with 19 additions and 0 deletions

7
spec/fixtures/pages/useragent.html vendored Normal file
View file

@ -0,0 +1,7 @@
<html>
<body>
<script type="text/javascript" charset="utf-8">
console.log(navigator.userAgent);
</script>
</body>
</html>

View file

@ -99,6 +99,18 @@ describe '<webview> tag', ->
webview.src = "file://#{fixtures}/pages/referrer.html" webview.src = "file://#{fixtures}/pages/referrer.html"
document.body.appendChild webview document.body.appendChild webview
describe 'useragent attribute', ->
it 'sets the user agent', (done) ->
referrer = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko'
listener = (e) ->
assert.equal e.message, referrer
webview.removeEventListener 'console-message', listener
done()
webview.addEventListener 'console-message', listener
webview.setAttribute 'useragent', referrer
webview.src = "file://#{fixtures}/pages/useragent.html"
document.body.appendChild webview
describe 'disablewebsecurity attribute', -> describe 'disablewebsecurity attribute', ->
it 'does not disable web security when not set', (done) -> it 'does not disable web security when not set', (done) ->
src = " src = "