From 50c913fe92a703027ff2829026d19b4432804cc3 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Tue, 5 May 2015 22:06:15 -0700 Subject: [PATCH] Add a test for the user agent --- spec/fixtures/pages/useragent.html | 7 +++++++ spec/webview-spec.coffee | 12 ++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 spec/fixtures/pages/useragent.html diff --git a/spec/fixtures/pages/useragent.html b/spec/fixtures/pages/useragent.html new file mode 100644 index 000000000000..4e19f5b8276a --- /dev/null +++ b/spec/fixtures/pages/useragent.html @@ -0,0 +1,7 @@ + + + + + diff --git a/spec/webview-spec.coffee b/spec/webview-spec.coffee index 54bc2e78817f..6d624eb9d81b 100644 --- a/spec/webview-spec.coffee +++ b/spec/webview-spec.coffee @@ -99,6 +99,18 @@ describe ' tag', -> webview.src = "file://#{fixtures}/pages/referrer.html" 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', -> it 'does not disable web security when not set', (done) -> src = "