Merge lp:~abreu-alexandre/unity-webapps-qml/fix-local-script-handling into lp:unity-webapps-qml

Proposed by Alexandre Abreu
Status: Merged
Approved by: Alexandre Abreu
Approved revision: 143
Merged at revision: 143
Proposed branch: lp:~abreu-alexandre/unity-webapps-qml/fix-local-script-handling
Merge into: lp:unity-webapps-qml
Diff against target: 590 lines (+161/-85)
17 files modified
debian/control (+1/-1)
src/Ubuntu/UnityWebApps/UnityWebApps.js (+14/-15)
src/Ubuntu/UnityWebApps/UnityWebApps.qml (+2/-2)
src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js (+42/-24)
src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model.cpp (+0/-3)
tests/autopilot/data/all-in-same-folder/script.user.js (+3/-1)
tests/autopilot/data/all-in-same-folder/webapp-properties.json (+2/-2)
tests/autopilot/data/unity-webapps-normal/manifest.json (+6/-4)
tests/autopilot/data/unity-webapps-normal/script.user.js (+3/-1)
tests/autopilot/data/unity-webapps-with-altered-ua-string/manifest.json (+3/-3)
tests/autopilot/data/unity-webapps-with-altered-ua-string/script.user.js (+3/-1)
tests/autopilot/qml/FullWebViewApp.qml (+2/-1)
tests/autopilot/qml/WebviewBackendOxide.qml (+3/-2)
tests/autopilot/unity_webapps_qml/tests/__init__.py (+41/-11)
tests/autopilot/unity_webapps_qml/tests/test_installedWebapp.py (+27/-5)
tests/autopilot/unity_webapps_qml/tests/test_launcher.py (+9/-7)
tests/autopilot/unity_webapps_qml/tests/test_mediaplayer.py (+0/-2)
To merge this branch: bzr merge lp:~abreu-alexandre/unity-webapps-qml/fix-local-script-handling
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
WebApps Pending
Review via email: mp+245969@code.launchpad.net

Commit message

When using a webapp-properties file for an unamed webapp the user script does not get injected.

Description of the change

When using a webapp-properties file for an unamed webapp the user script does not get injected.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-11-22 00:43:42 +0000
3+++ debian/control 2015-01-09 15:55:30 +0000
4@@ -28,7 +28,7 @@
5
6 Package: unity-webapps-qml
7 Architecture: any
8-Depends: liboxideqt-qmlplugin (>= 1.2.0) | qml-module-qtwebkit,
9+Depends: liboxideqt-qmlplugin (>= 1.3.0) | qml-module-qtwebkit,
10 qtdeclarative5-qtquick2-plugin,
11 qtdeclarative5-unity-action-plugin,
12 qtdeclarative5-ubuntu-ui-toolkit-plugin | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles,
13
14=== modified file 'src/Ubuntu/UnityWebApps/UnityWebApps.js'
15--- src/Ubuntu/UnityWebApps/UnityWebApps.js 2014-11-21 21:12:26 +0000
16+++ src/Ubuntu/UnityWebApps/UnityWebApps.js 2015-01-09 15:55:30 +0000
17@@ -40,7 +40,6 @@
18 this._injected_unity_api_path = injected_api_path;
19 this._bindeeProxies = bindeeProxies;
20 this._backends = null;
21- this._userscripts = [];
22 this._accessPolicy = accessPolicy;
23 this._callbackManager = UnityWebAppsUtils.makeCallbackManager();
24
25@@ -50,16 +49,22 @@
26 _UnityWebApps.prototype = {
27
28 cleanup: function() {
29- if (this._bindeeProxies.cleanup && typeof(this._bindeeProxies.cleanup) == 'function')
30+ if (this._bindeeProxies.cleanup
31+ && typeof(this._bindeeProxies.cleanup) == 'function') {
32 this._bindeeProxies.cleanup();
33+ }
34 },
35
36 proxies: function() {
37 return this._bindeeProxies;
38 },
39
40- setUserScriptsToInject: function(userscripts) {
41- this._userscripts = userscripts;
42+ injectWebappUserScripts: function(userscripts) {
43+ if (this._bindeeProxies) {
44+ this._bindeeProxies.injectUserScripts(
45+ userscripts.map(function(script) {
46+ return Qt.resolvedUrl(script); }));
47+ }
48 },
49
50 setBackends: function(backends) {
51@@ -75,24 +80,18 @@
52 var cb = this._onMessageReceivedCallback.bind(self);
53 self._bindeeProxies.messageReceivedConnect(cb);
54
55- this._onLoadingStartedCallback();
56+ this._injectCoreBindingUserScripts();
57 },
58
59 /**
60 * \internal
61 *
62 */
63- _onLoadingStartedCallback: function () {
64- var scripts = [this._injected_unity_api_path];
65- for(var i = 0; i < this._userscripts.length; ++i) {
66- scripts.push(Qt.resolvedUrl(this._userscripts[i]));
67+ _injectCoreBindingUserScripts: function () {
68+ if (this._bindeeProxies) {
69+ this._bindeeProxies.injectUserScripts(
70+ [Qt.resolvedUrl(this._injected_unity_api_path)]);
71 }
72-
73- for (i = 0; i < scripts.length; ++i)
74- console.debug('Injecting webapps script[' + i + '] : '
75- + scripts[i]);
76-
77- this._bindeeProxies.injectUserScripts(scripts);
78 },
79
80 /**
81
82=== modified file 'src/Ubuntu/UnityWebApps/UnityWebApps.qml'
83--- src/Ubuntu/UnityWebApps/UnityWebApps.qml 2014-11-25 19:38:40 +0000
84+++ src/Ubuntu/UnityWebApps/UnityWebApps.qml 2015-01-09 15:55:30 +0000
85@@ -234,7 +234,7 @@
86 __getPolicyForContent(settings),
87 customClientApiFileUrl && customClientApiFileUrl.length !== 0
88 ? customClientApiFileUrl
89- : Qt.resolvedUrl('unity-webapps-api.js'));
90+ : 'unity-webapps-api.js');
91
92 internal.instance = instance;
93
94@@ -374,7 +374,7 @@
95 if (__isValidWebAppForModel(name)) {
96 if (internal.instance) {
97 var userScripts = __gatherWebAppUserscriptsIfAny(name);
98- internal.instance.setUserScriptsToInject(userScripts);
99+ internal.instance.injectWebappUserScripts(userScripts);
100 }
101 __navigateToWebappHomepageInBindee(name);
102 }
103
104=== modified file 'src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js'
105--- src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js 2014-11-22 00:43:42 +0000
106+++ src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js 2015-01-09 15:55:30 +0000
107@@ -63,14 +63,12 @@
108 this.webview = webview;
109 this.disposer = disposer;
110 this.makeSignalDisconnecter = makeSignalDisconnecter;
111- this._userScriptInjected = false;
112 this._WEBAPPS_USER_SCRIPT_CONTEXT = "oxide://main-world";
113+ this._injectedUserScripts = [];
114+ this._scriptMessageReceivedHandler = null;
115 }
116 OxideWebviewAdapter.prototype = {
117 injectUserScripts: function(userScriptUrls) {
118- if (this._userScriptInjected)
119- return;
120-
121 var context = this.webview.context;
122 if (!context) {
123 console.error('No context found for the current Oxide webview. Cannot inject user scripts.');
124@@ -78,25 +76,33 @@
125 }
126
127 for (var i = 0; i < userScriptUrls.length; ++i) {
128- var scriptStart = "import com.canonical.Oxide 1.0 as Oxide; Oxide.UserScript { context:";
129+ var script = userScriptUrls[i];
130+ if (this._injectedUserScripts.some(
131+ function(e) { return e === script; })) {
132+ console.log('Skipping already injected script: ' + script)
133+ continue;
134+ }
135+
136+ var scriptStart = "import com.canonical.Oxide 1.0 as Oxide; \
137+Oxide.UserScript { ";
138 var scriptEnd = " }";
139- var statement = scriptStart +
140- '"' +
141- this._WEBAPPS_USER_SCRIPT_CONTEXT +
142- '"' +
143- '; matchAllFrames: false; emulateGreasemonkey: true; url: "' +
144- userScriptUrls[i] +
145- '";'
146+ var statement = scriptStart
147+ + 'context: "' + this._WEBAPPS_USER_SCRIPT_CONTEXT + '";'
148+ + 'matchAllFrames: false;'
149+ + 'emulateGreasemonkey: true;'
150+ + 'url: "' + script + '";'
151 + scriptEnd;
152
153- context.addUserScript(Qt.createQmlObject(statement, this.webview));
154+ context.addUserScript(
155+ Qt.createQmlObject(statement, this.webview));
156 }
157-
158- this._userScriptInjected = true;
159+ this._injectedUserScripts.push(script);
160 },
161 sendToPage: function (message) {
162 this.webview.rootFrame.sendMessageNoReply(
163- this._WEBAPPS_USER_SCRIPT_CONTEXT, "UnityWebappApi-Host-Message", JSON.parse(message));
164+ this._WEBAPPS_USER_SCRIPT_CONTEXT,
165+ "UnityWebappApi-Host-Message",
166+ JSON.parse(message));
167 },
168 loadingStartedConnect: function (onLoadingStarted) {
169 function handler(loadEvent) {
170@@ -109,17 +115,24 @@
171 this.disposer.addDisposer(this.makeSignalDisconnecter(this.webview.loadingChanged, handler));
172 },
173 messageReceivedConnect: function (onMessageReceived) {
174- function handler(msg, frame) {
175+ function _handler(msg, frame) {
176 onMessageReceived(msg.args);
177 }
178
179- var script = 'import com.canonical.Oxide 1.0 as Oxide; ' +
180- ' Oxide.ScriptMessageHandler { msgId: "UnityWebappApi-Message"; contexts: ["' +
181- this._WEBAPPS_USER_SCRIPT_CONTEXT +
182- '"]; ' +
183- '}';
184- var messageHandler = Qt.createQmlObject(script, this.webview);
185- messageHandler.callback = handler;
186+ if ( ! this._scriptMessageReceivedHandler) {
187+ var script = 'import com.canonical.Oxide 1.0 as Oxide; ' +
188+ ' Oxide.ScriptMessageHandler { '
189+ + 'msgId: "UnityWebappApi-Message"; '
190+ + 'contexts: ["' + this._WEBAPPS_USER_SCRIPT_CONTEXT + '"]; ' +
191+ '}';
192+ this._scriptMessageReceivedHandler =
193+ Qt.createQmlObject(script, this.webview);
194+ }
195+
196+ this._scriptMessageReceivedHandler.callback = _handler;
197+ },
198+ cleanupAdapterInternals: function() {
199+ this._scriptMessageReceivedHandler.callback = function() {};
200 }
201 }
202
203@@ -203,6 +216,11 @@
204 // called from the UnityWebApps side
205 proxy.cleanup = function() {
206 disposer.disposeAndCleanupAll();
207+
208+ if (this.cleanupAdapterInternals
209+ && typeof(this.cleanupAdapterInternals) === "function") {
210+ this.cleanupAdapterInternals();
211+ }
212 };
213
214 return proxy;
215
216=== modified file 'src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model.cpp'
217--- src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model.cpp 2014-11-25 14:54:02 +0000
218+++ src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model.cpp 2015-01-09 15:55:30 +0000
219@@ -198,8 +198,6 @@
220 QFileInfo manifestFileInfo =
221 installationDir.absolutePath() + QDir::separator() + manifestFileName;
222 if ( ! manifestFileInfo.isFile()) {
223- qDebug() << "Skipping" << manifestFileName << "as a webapp definition search: "
224- << manifestFileInfo.absoluteFilePath();
225 continue;
226 }
227
228@@ -347,7 +345,6 @@
229 installationSearchPath + QDir::separator() + _commonScriptsDirName;
230 READ_USER_SCRIPT(requires,COMMON_BASE_PATH);
231 READ_USER_SCRIPT(scripts,userscriptPath.absolutePath());
232-
233 return script;
234 }
235
236
237=== modified file 'tests/autopilot/data/all-in-same-folder/script.user.js'
238--- tests/autopilot/data/all-in-same-folder/script.user.js 2014-07-08 20:49:12 +0000
239+++ tests/autopilot/data/all-in-same-folder/script.user.js 2015-01-09 15:55:30 +0000
240@@ -1,1 +1,3 @@
241-document.getElementById('content').innerHTML="WebApp Script Injected"
242+window.onload = function() {
243+ document.getElementById('content').innerHTML="WebApp Script Injected"
244+}
245
246=== modified file 'tests/autopilot/data/all-in-same-folder/webapp-properties.json'
247--- tests/autopilot/data/all-in-same-folder/webapp-properties.json 2014-07-08 20:49:12 +0000
248+++ tests/autopilot/data/all-in-same-folder/webapp-properties.json 2015-01-09 15:55:30 +0000
249@@ -1,8 +1,8 @@
250 {
251- "includes": ["http://localhost:*/*"],
252+ "includes": ["http://www.test.com/*"],
253 "name": "ExtendedWebappProperties",
254 "scripts": ["script.user.js"],
255 "domain":"",
256- "homepage":"",
257+ "homepage":"http://www.test.com/",
258 "user-agent-override": "My Override"
259 }
260
261=== modified file 'tests/autopilot/data/unity-webapps-normal/manifest.json'
262--- tests/autopilot/data/unity-webapps-normal/manifest.json 2014-07-08 20:49:12 +0000
263+++ tests/autopilot/data/unity-webapps-normal/manifest.json 2015-01-09 15:55:30 +0000
264@@ -1,7 +1,9 @@
265 {
266- "includes": ["http://localhost:*/*"],
267 "name": "Normal",
268- "scripts": ["script.user.js"],
269- "domain":"",
270- "homepage":""
271+ "domain": "test.com",
272+ "homepage": "http://www.test.com/",
273+ "includes": [
274+ "http://www.test.com/*"
275+ ],
276+ "scripts": [ "script.user.js" ]
277 }
278
279=== modified file 'tests/autopilot/data/unity-webapps-normal/script.user.js'
280--- tests/autopilot/data/unity-webapps-normal/script.user.js 2014-07-08 20:49:12 +0000
281+++ tests/autopilot/data/unity-webapps-normal/script.user.js 2015-01-09 15:55:30 +0000
282@@ -1,1 +1,3 @@
283-document.getElementById('content').innerHTML="WebApp Script Injected"
284+window.onload = function() {
285+ document.getElementById('content').innerHTML="WebApp Script Injected"
286+}
287
288=== modified file 'tests/autopilot/data/unity-webapps-with-altered-ua-string/manifest.json'
289--- tests/autopilot/data/unity-webapps-with-altered-ua-string/manifest.json 2014-07-08 20:49:12 +0000
290+++ tests/autopilot/data/unity-webapps-with-altered-ua-string/manifest.json 2015-01-09 15:55:30 +0000
291@@ -1,8 +1,8 @@
292 {
293- "includes": ["http://localhost:*/*"],
294+ "includes": ["http://www.test.com/*"],
295 "name": "AlteredUAWebapp",
296 "scripts": ["script.user.js"],
297- "domain":"",
298- "homepage":"",
299+ "domain":"test.com",
300+ "homepage":"http://www.test.com/",
301 "user-agent-override": "My Override"
302 }
303
304=== modified file 'tests/autopilot/data/unity-webapps-with-altered-ua-string/script.user.js'
305--- tests/autopilot/data/unity-webapps-with-altered-ua-string/script.user.js 2014-07-08 20:49:12 +0000
306+++ tests/autopilot/data/unity-webapps-with-altered-ua-string/script.user.js 2015-01-09 15:55:30 +0000
307@@ -1,1 +1,3 @@
308-document.getElementById('content').innerHTML="WebApp Script Injected"
309+window.onload = function() {
310+ document.getElementById('content').innerHTML="WebApp Script Injected"
311+}
312
313=== modified file 'tests/autopilot/qml/FullWebViewApp.qml'
314--- tests/autopilot/qml/FullWebViewApp.qml 2014-11-19 20:23:07 +0000
315+++ tests/autopilot/qml/FullWebViewApp.qml 2015-01-09 15:55:30 +0000
316@@ -35,7 +35,8 @@
317 signal resultUpdated(string message)
318
319 function evalInPageUnsafe(expr) {
320- return webView.evaluateCode(expr, true);
321+ var val = webView.evaluateCode(expr, true);
322+ resultUpdated(DomIntrospectionUtils.createResult(val))
323 }
324
325 property string url: ""
326
327=== modified file 'tests/autopilot/qml/WebviewBackendOxide.qml'
328--- tests/autopilot/qml/WebviewBackendOxide.qml 2014-11-21 21:12:26 +0000
329+++ tests/autopilot/qml/WebviewBackendOxide.qml 2015-01-09 15:55:30 +0000
330@@ -1,9 +1,10 @@
331 import QtQuick 2.0
332 import QtTest 1.0
333 import com.canonical.Oxide 1.0 as Oxide
334+import Ubuntu.Web 0.2
335 import Ubuntu.UnityWebApps 0.1
336
337-Oxide.WebView {
338+WebView {
339 id: webView
340 objectName: "webview"
341
342@@ -56,7 +57,7 @@
343 return value ? value.result : undefined;
344 }
345
346- context: Oxide.WebContext {
347+ context: WebContext {
348 userAgent: webView.localUserAgentOverride.length === 0
349 ? "" : webView.localUserAgentOverride
350 userScripts: [
351
352=== modified file 'tests/autopilot/unity_webapps_qml/tests/__init__.py'
353--- tests/autopilot/unity_webapps_qml/tests/__init__.py 2014-11-19 20:23:07 +0000
354+++ tests/autopilot/unity_webapps_qml/tests/__init__.py 2015-01-09 15:55:30 +0000
355@@ -8,9 +8,10 @@
356 """unity-webapps-qml autopilot tests."""
357
358 import os
359+import json
360 import os.path
361
362-from testtools.matchers import Equals
363+from testtools.matchers import Equals, GreaterThan
364 from autopilot.matchers import Eventually
365 from unity_webapps_qml.tests import fake_servers
366
367@@ -80,9 +81,9 @@
368 # we are local
369 base_params.append(
370 '--import={}'.format(
371- os.path.join(os.path.dirname(os.path.realpath(__file__))),
372- '../../../../src'))
373-
374+ os.path.join(
375+ os.path.dirname(os.path.realpath(__file__)),
376+ '../../../../src')))
377 base_params += extra_params
378
379 return base_params
380@@ -101,7 +102,11 @@
381 extra_params))
382 self.assert_url_eventually_loaded(url)
383
384- def launch_application(self, args):
385+ def launch_application(self, args, envvars={}):
386+ if envvars:
387+ for envvar_key in envvars:
388+ self.patch_environment(envvar_key, envvars[envvar_key])
389+
390 self.app = self.launch_test_application(
391 self.get_qml_launcher_path(),
392 *args,
393@@ -133,17 +138,37 @@
394
395 def eval_expression_in_page_unsafe(self, expr):
396 webview = self.get_webviewContainer()
397- return webview.slots.evalInPageUnsafe(expr)
398+ p = self.watcher.num_emissions
399+ webview.slots.evalInPageUnsafe(expr)
400+ self.assertThat(
401+ lambda: self.watcher.num_emissions,
402+ Eventually(GreaterThan(p)))
403+ results = json.loads(
404+ webview.get_signal_emissions(
405+ 'resultUpdated(QString)')[-1][0])
406+ return 'result' in results and results['result'] or None
407
408
409 class WebappsTestCaseBaseWithLocalHttpContentBase(UnityWebappsTestCaseBase):
410+ BASE_URL_SCHEME = 'http://'
411+
412 def setUp(self):
413 super(WebappsTestCaseBaseWithLocalHttpContentBase, self).setUp()
414 self.http_server = fake_servers.WebappsQmlContentHttpServer()
415 self.addCleanup(self.http_server.shutdown)
416- self.base_url = "http://localhost:{}/".format(self.http_server.port)
417-
418- def launch_with_webapp(self, name, webapp_search_path, use_oxide=False):
419+ self.base_url = "{}localhost:{}".format(
420+ self.BASE_URL_SCHEME, self.http_server.port)
421+
422+ def get_base_url_hostname(self):
423+ return self.base_url[len(self.BASE_URL_SCHEME):]
424+
425+ def launch_with_webapp(
426+ self,
427+ name,
428+ webapp_search_path,
429+ envvars={},
430+ use_oxide=False,
431+ expected_homepage=''):
432 self.use_oxide = use_oxide
433 self.launch_application(
434 self.get_launch_params(
435@@ -151,5 +176,10 @@
436 name,
437 webapp_search_path,
438 self.base_url,
439- use_oxide))
440- self.assert_url_eventually_loaded(self.base_url)
441+ use_oxide),
442+ envvars)
443+
444+ url = self.base_url
445+ if expected_homepage:
446+ url = expected_homepage
447+ self.assert_url_eventually_loaded(url)
448
449=== modified file 'tests/autopilot/unity_webapps_qml/tests/test_installedWebapp.py'
450--- tests/autopilot/unity_webapps_qml/tests/test_installedWebapp.py 2014-11-19 20:23:07 +0000
451+++ tests/autopilot/unity_webapps_qml/tests/test_installedWebapp.py 2015-01-09 15:55:30 +0000
452@@ -33,7 +33,13 @@
453 return INSTALLED_HTML_TEST_FILE
454
455 def test_normalWebappFound(self):
456- self.launch_with_webapp('Normal', self.get_webapp_install_folder())
457+ rule = 'MAP *.test.com:80 ' + self.get_base_url_hostname()
458+ self.launch_with_webapp(
459+ 'Normal',
460+ self.get_webapp_install_folder(),
461+ {'UBUNTU_WEBVIEW_HOST_MAPPING_RULES': rule},
462+ False,
463+ 'http://www.test.com/')
464
465 self.assertThat(
466 lambda: self.eval_expression_in_page_unsafe(
467@@ -49,18 +55,26 @@
468 Eventually(Equals("WebApp Script Injected")))
469
470 def test_webappWithUAOverrideFound(self):
471+ rule = 'MAP *.test.com:80 ' + self.get_base_url_hostname()
472 self.launch_with_webapp(
473 'AlteredUAWebapp',
474- self.get_webapp_install_folder(), True)
475+ self.get_webapp_install_folder(),
476+ {'UBUNTU_WEBVIEW_HOST_MAPPING_RULES': rule},
477+ True,
478+ 'http://www.test.com/')
479 self.assertThat(
480 lambda: self.eval_expression_in_page_unsafe(
481 'return navigator.userAgent;'),
482 Eventually(Equals("My Override")))
483
484 def test_webappFoundWithSpecialWebappPropertiesFile(self):
485+ rule = 'MAP *.test.com:80 ' + self.get_base_url_hostname()
486 self.launch_with_webapp(
487 'ExtendedWebappProperties',
488- self.get_webapp_install_folder() + '/all-in-same-folder')
489+ self.get_webapp_install_folder() + '/all-in-same-folder',
490+ {'UBUNTU_WEBVIEW_HOST_MAPPING_RULES': rule},
491+ False,
492+ 'http://www.test.com/')
493
494 self.assertThat(
495 lambda: self.eval_expression_in_page_unsafe(
496@@ -76,18 +90,26 @@
497 Eventually(Equals("WebApp Script Injected")))
498
499 def test_webappPropertiesFileWithUA(self):
500+ rule = 'MAP *.test.com:80 ' + self.get_base_url_hostname()
501 self.launch_with_webapp(
502 'ExtendedWebappProperties',
503- self.get_webapp_install_folder() + '/all-in-same-folder', True)
504+ self.get_webapp_install_folder() + '/all-in-same-folder',
505+ {'UBUNTU_WEBVIEW_HOST_MAPPING_RULES': rule},
506+ True,
507+ 'http://www.test.com/')
508 self.assertThat(
509 lambda: self.eval_expression_in_page_unsafe(
510 'return navigator.userAgent;'),
511 Eventually(Equals("My Override")))
512
513 def test_webappPropertiesNameUpdated(self):
514+ rule = 'MAP *.test.com:80 ' + self.get_base_url_hostname()
515 self.launch_with_webapp(
516 '',
517- self.get_webapp_install_folder() + '/all-in-same-folder')
518+ self.get_webapp_install_folder() + '/all-in-same-folder',
519+ {'UBUNTU_WEBVIEW_HOST_MAPPING_RULES': rule},
520+ False,
521+ 'http://www.test.com/')
522 self.assertThat(
523 lambda: self.eval_expression_in_page_unsafe(
524 'return window.external.getUnityObject("1.0") != null;'),
525
526=== modified file 'tests/autopilot/unity_webapps_qml/tests/test_launcher.py'
527--- tests/autopilot/unity_webapps_qml/tests/test_launcher.py 2014-11-19 20:23:07 +0000
528+++ tests/autopilot/unity_webapps_qml/tests/test_launcher.py 2015-01-09 15:55:30 +0000
529@@ -7,8 +7,6 @@
530
531 import os
532
533-from gi.repository import Unity
534-
535 from testtools.matchers import Equals, NotEquals
536 from testtools import skipUnless
537
538@@ -38,13 +36,14 @@
539
540 @skipUnless(platform.model() == 'Desktop', "Only runs on the Desktop")
541 def test_checkCounts(self):
542+ from gi.repository import Unity
543 self.assertThat(
544 lambda: self.eval_expression_in_page_unsafe(
545 "return document.getElementById('status').innerHTML;"),
546 Eventually(Equals('launcher-updated')))
547
548- launcher_icon = self.unity.launcher.model.get_icon(
549- desktop_id='unitywebappsqmllauncher.desktop')
550+ launcher_icon = Unity.LauncherEntry.get_for_desktop_id(
551+ 'unitywebappsqmllauncher.desktop')
552 self.assertThat(launcher_icon, NotEquals(None))
553
554 expr = """
555@@ -70,17 +69,20 @@
556 "return document.getElementById('status').innerHTML;"),
557 Eventually(Equals('42')))
558
559- # self.assertThat(launcher.get_property('progress'), Equals(0.09375))
560+# self.assertThat(
561+# lambda: launcher_icon.get_property("count"),
562+# Eventually(Equals(42)))
563
564 @skipUnless(platform.model() == 'Desktop', "Only runs on the Desktop")
565 def test_checkProgress(self):
566+ from gi.repository import Unity
567 self.assertThat(
568 lambda: self.eval_expression_in_page_unsafe(
569 "return document.getElementById('status').innerHTML;"),
570 Eventually(Equals('launcher-updated')))
571
572- launcher_icon = self.unity.launcher.model.get_icon(
573- desktop_id='unitywebappsqmllauncher.desktop')
574+ launcher_icon = Unity.LauncherEntry.get_for_desktop_id(
575+ 'unitywebappsqmllauncher.desktop')
576 self.assertThat(launcher_icon, NotEquals(None))
577
578 expr = """
579
580=== modified file 'tests/autopilot/unity_webapps_qml/tests/test_mediaplayer.py'
581--- tests/autopilot/unity_webapps_qml/tests/test_mediaplayer.py 2014-11-19 20:23:07 +0000
582+++ tests/autopilot/unity_webapps_qml/tests/test_mediaplayer.py 2015-01-09 15:55:30 +0000
583@@ -7,8 +7,6 @@
584
585 import os
586
587-from gi.repository import Unity
588-
589 from testtools.matchers import Equals
590 from testtools import skipUnless
591

Subscribers

People subscribed via source and target branches

to all changes: