Add a test for the user agent
This commit is contained in:
parent
22f51372f5
commit
50c913fe92
2 changed files with 19 additions and 0 deletions
7
spec/fixtures/pages/useragent.html
vendored
Normal file
7
spec/fixtures/pages/useragent.html
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
console.log(navigator.userAgent);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -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 = "
|
||||||
|
|
Loading…
Reference in a new issue