Merge lp:~abreu-alexandre/unity-webapps-qml/fix-issues-uncovered-by-qmlplugindump into lp:unity-webapps-qml
- fix-issues-uncovered-by-qmlplugindump
- Merge into trunk
Proposed by
Alexandre Abreu
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 125 | ||||
Proposed branch: | lp:~abreu-alexandre/unity-webapps-qml/fix-issues-uncovered-by-qmlplugindump | ||||
Merge into: | lp:unity-webapps-qml | ||||
Diff against target: |
1031 lines (+453/-253) 27 files modified
debian/unity-webapps-qml-autopilot.install (+1/-0) src/Ubuntu/UnityWebApps/UnityWebApps.qml (+19/-1) src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js (+4/-0) src/Ubuntu/UnityWebApps/plugin/plugin.pro (+0/-2) src/Ubuntu/UnityWebApps/plugin/qml-plugin.cpp (+0/-2) src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-infos.cpp (+2/-1) src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model-filter-proxy.cpp (+0/-76) src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model-filter-proxy.h (+0/-87) src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model.cpp (+1/-1) src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model.h (+1/-1) tests/integration/autopilot/autopilot.pro (+7/-2) tests/integration/autopilot/data/all-in-same-folder/script.user.js (+1/-0) tests/integration/autopilot/data/all-in-same-folder/webapp-properties.json (+8/-0) tests/integration/autopilot/data/unity-webapps-normal/manifest.json (+7/-0) tests/integration/autopilot/data/unity-webapps-normal/script.user.js (+1/-0) tests/integration/autopilot/data/unity-webapps-with-altered-ua-string/manifest.json (+8/-0) tests/integration/autopilot/data/unity-webapps-with-altered-ua-string/script.user.js (+1/-0) tests/integration/autopilot/qml/FullWebViewApp.qml (+48/-23) tests/integration/autopilot/qml/WebviewBackendOxide.qml (+87/-0) tests/integration/autopilot/qml/WebviewBackendWebkit.qml (+19/-0) tests/integration/autopilot/qml/message-server.js (+29/-0) tests/integration/autopilot/unity_webapps_qml/emulators/__init__.py (+0/-7) tests/integration/autopilot/unity_webapps_qml/tests/__init__.py (+66/-31) tests/integration/autopilot/unity_webapps_qml/tests/fake_servers.py (+70/-0) tests/integration/autopilot/unity_webapps_qml/tests/test_installedWebapp.py (+59/-0) tests/integration/test-server.py (+0/-18) tools/qml-launcher/qml-launcher.cpp (+14/-1) |
||||
To merge this branch: | bzr merge lp:~abreu-alexandre/unity-webapps-qml/fix-issues-uncovered-by-qmlplugindump | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
WebApps | Pending | ||
Review via email: mp+226026@code.launchpad.net |
Commit message
Fix issue with qmlplugindump using 100% cpu
Fix and expanded AP tests to properly test the installed webapps case
Description of the change
Fix issue with qmlplugindump using 100% cpu
Fix and expanded AP tests to properly test the installed webapps case
To post a comment you must log in.
- 128. By Alexandre Abreu
-
update debian install file
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Needs Fixing
(continuous-integration)
- 129. By Alexandre Abreu
-
forgotten files
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:129
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
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/unity-webapps-qml-autopilot.install' |
2 | --- debian/unity-webapps-qml-autopilot.install 2013-07-25 04:03:42 +0000 |
3 | +++ debian/unity-webapps-qml-autopilot.install 2014-07-08 20:49:15 +0000 |
4 | @@ -1,3 +1,4 @@ |
5 | tests/integration/autopilot/html/* usr/share/unity-webapps-qml/autopilot-tests/html/ |
6 | +tests/integration/autopilot/data/* usr/share/unity-webapps-qml/autopilot-tests/data/ |
7 | tests/integration/autopilot/qml/* usr/share/unity-webapps-qml/autopilot-tests/qml/ |
8 | usr/lib/python* |
9 | |
10 | === modified file 'src/Ubuntu/UnityWebApps/UnityWebApps.qml' |
11 | --- src/Ubuntu/UnityWebApps/UnityWebApps.qml 2014-06-26 01:46:36 +0000 |
12 | +++ src/Ubuntu/UnityWebApps/UnityWebApps.qml 2014-07-08 20:49:15 +0000 |
13 | @@ -150,6 +150,15 @@ |
14 | */ |
15 | property var _opt_backendProxies: null |
16 | |
17 | + /*! |
18 | + \qmlproperty string UnityWebApps::_opt_homepage |
19 | + |
20 | + Used only for testing. |
21 | + Allows an optional a homepage to be specified when running a local http server. |
22 | + |
23 | + */ |
24 | + property string _opt_homepage: "" |
25 | + |
26 | |
27 | Settings { |
28 | id: settings |
29 | @@ -325,6 +334,9 @@ |
30 | var idx = model.getWebappIndex(webappName); |
31 | var homepage = model.data(idx, UbuntuUnityWebApps.UnityWebappsAppModel.Homepage); |
32 | |
33 | + if (!homepage || homepage.length === 0) { |
34 | + homepage = _opt_homepage; |
35 | + } |
36 | console.debug('Requesting the bindee to navigate to homepage: ' + homepage); |
37 | |
38 | // We recreate a bindee object, but we call any function that requires |
39 | @@ -352,7 +364,7 @@ |
40 | |
41 | Component.onCompleted: { |
42 | if (model) { |
43 | - model.modelChanged.connect(function() { __setupNamedWebappEnvironment() }); |
44 | + __setupNamedWebappEnvironment(); |
45 | } |
46 | } |
47 | |
48 | @@ -360,6 +372,12 @@ |
49 | \internal |
50 | |
51 | */ |
52 | + onModelChanged: model.modelContentChanged.connect(__setupNamedWebappEnvironment) |
53 | + |
54 | + /*! |
55 | + \internal |
56 | + |
57 | + */ |
58 | onBindeeChanged: { |
59 | // cleanup old refs & go |
60 | webapps.__unbind(); |
61 | |
62 | === modified file 'src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js' |
63 | --- src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js 2014-06-26 01:48:23 +0000 |
64 | +++ src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js 2014-07-08 20:49:15 +0000 |
65 | @@ -71,6 +71,10 @@ |
66 | return; |
67 | |
68 | var context = this.webview.context; |
69 | + if (!context) { |
70 | + console.error('No context found for the current Oxide webview. Cannot inject user scripts.'); |
71 | + return; |
72 | + } |
73 | |
74 | for (var i = 0; i < userScriptUrls.length; ++i) { |
75 | var scriptStart = "import com.canonical.Oxide 1.0 as Oxide; Oxide.UserScript { context:"; |
76 | |
77 | === modified file 'src/Ubuntu/UnityWebApps/plugin/plugin.pro' |
78 | --- src/Ubuntu/UnityWebApps/plugin/plugin.pro 2014-03-25 20:56:01 +0000 |
79 | +++ src/Ubuntu/UnityWebApps/plugin/plugin.pro 2014-07-08 20:49:15 +0000 |
80 | @@ -35,7 +35,6 @@ |
81 | unity-webapps-api-mediaplayer.cpp \ |
82 | unity-webapps-app-model.cpp \ |
83 | unity-webapps-app-manifest-parser.cpp \ |
84 | - unity-webapps-app-model-filter-proxy.cpp \ |
85 | unity-webapps-app-infos.cpp \ |
86 | unity-webapps-desktop-infos.cpp \ |
87 | unity-webapps-icon-utils.cpp \ |
88 | @@ -54,7 +53,6 @@ |
89 | unity-webapps-app-model.h \ |
90 | unity-webapps-app-manifest-parser.h \ |
91 | unity-webapps-common-priv.h \ |
92 | - unity-webapps-app-model-filter-proxy.h \ |
93 | unity-webapps-app-infos.h \ |
94 | unity-webapps-desktop-infos.h \ |
95 | unity-webapps-icon-utils.h \ |
96 | |
97 | === modified file 'src/Ubuntu/UnityWebApps/plugin/qml-plugin.cpp' |
98 | --- src/Ubuntu/UnityWebApps/plugin/qml-plugin.cpp 2014-03-21 20:07:16 +0000 |
99 | +++ src/Ubuntu/UnityWebApps/plugin/qml-plugin.cpp 2014-07-08 20:49:15 +0000 |
100 | @@ -26,7 +26,6 @@ |
101 | #include "unity-webapps-api-messaging-menu.h" |
102 | #include "unity-webapps-api-launcher.h" |
103 | #include "unity-webapps-api-mediaplayer.h" |
104 | -#include "unity-webapps-app-model-filter-proxy.h" |
105 | #include "unity-webapps-app-model.h" |
106 | #include "unity-webapps-app-infos.h" |
107 | |
108 | @@ -55,7 +54,6 @@ |
109 | |
110 | // misc |
111 | qmlRegisterType<UnityWebappsAppModel> (uri, 0, 1, "UnityWebappsAppModel"); |
112 | - qmlRegisterType<UnityWebappsAppModelFilterProxy> (uri, 0, 1, "UnityWebappsAppModelFilterProxy"); |
113 | qmlRegisterType<UnityWebappsCallback> (uri, 0, 1, "UnityWebappsCallback"); |
114 | qmlRegisterType<UnityWebappsAppInfos> (uri, 0, 1, "UnityWebappsAppInfos"); |
115 | |
116 | |
117 | === modified file 'src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-infos.cpp' |
118 | --- src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-infos.cpp 2014-03-07 16:48:42 +0000 |
119 | +++ src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-infos.cpp 2014-07-08 20:49:15 +0000 |
120 | @@ -28,7 +28,8 @@ |
121 | |
122 | |
123 | UnityWebappsAppInfos::UnityWebappsAppInfos(QObject *parent) |
124 | - : QObject(parent) |
125 | + : QObject(parent), |
126 | + _model(NULL) |
127 | {} |
128 | |
129 | UnityWebappsAppInfos::~UnityWebappsAppInfos() |
130 | |
131 | === removed file 'src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model-filter-proxy.cpp' |
132 | --- src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model-filter-proxy.cpp 2014-01-17 15:51:27 +0000 |
133 | +++ src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model-filter-proxy.cpp 1970-01-01 00:00:00 +0000 |
134 | @@ -1,76 +0,0 @@ |
135 | -/* |
136 | - * Copyright 2013 Canonical Ltd. |
137 | - * |
138 | - * This file is part of unity-webapps-qml. |
139 | - * |
140 | - * unity-webapps-qml is free software; you can redistribute it and/or modify |
141 | - * it under the terms of the GNU General Public License as published by |
142 | - * the Free Software Foundation; version 3. |
143 | - * |
144 | - * unity-webapps-qml is distributed in the hope that it will be useful, |
145 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
146 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
147 | - * GNU General Public License for more details. |
148 | - * |
149 | - * You should have received a copy of the GNU General Public License |
150 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
151 | - */ |
152 | - |
153 | -#include "unity-webapps-app-model-filter-proxy.h" |
154 | - |
155 | -#include "unity-webapps-app-model.h" |
156 | - |
157 | - |
158 | -UnityWebappsAppModelFilterProxy::UnityWebappsAppModelFilterProxy(QObject *parent) |
159 | - : QSortFilterProxyModel(parent) |
160 | -{} |
161 | - |
162 | - |
163 | -UnityWebappsAppModelFilterProxy::~UnityWebappsAppModelFilterProxy() |
164 | -{} |
165 | - |
166 | - |
167 | -UnityWebappsAppModel* UnityWebappsAppModelFilterProxy::sourceModel () const |
168 | -{ |
169 | - return sourceModel(); |
170 | -} |
171 | - |
172 | - |
173 | -void UnityWebappsAppModelFilterProxy::setsourceModel (UnityWebappsAppModel * model) |
174 | -{ |
175 | - setSourceModel(model); |
176 | - |
177 | - Q_EMIT sourceModelChanged(); |
178 | -} |
179 | - |
180 | - |
181 | -QString UnityWebappsAppModelFilterProxy::webappName () const |
182 | -{ |
183 | - return _name; |
184 | -} |
185 | - |
186 | - |
187 | -void UnityWebappsAppModelFilterProxy::setwebappName (const QString& name) |
188 | -{ |
189 | - _name = name; |
190 | - |
191 | - Q_EMIT webappNameChanged(); |
192 | -} |
193 | - |
194 | - |
195 | -bool UnityWebappsAppModelFilterProxy::filterAcceptsRow(int source_row, |
196 | - const QModelIndex &source_parent) const |
197 | -{ |
198 | - if (_name.isEmpty() || !sourceModel()) |
199 | - { |
200 | - // filter out everything |
201 | - return false; |
202 | - } |
203 | - |
204 | - QString rowName = |
205 | - sourceModel()->data(sourceModel()->index(source_row, 0, source_parent), |
206 | - UnityWebappsAppModel::Name).toString(); |
207 | - |
208 | - return 0 == _name.toLower().compare(rowName.toLower()); |
209 | -} |
210 | - |
211 | |
212 | === removed file 'src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model-filter-proxy.h' |
213 | --- src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model-filter-proxy.h 2014-01-17 15:51:27 +0000 |
214 | +++ src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model-filter-proxy.h 1970-01-01 00:00:00 +0000 |
215 | @@ -1,87 +0,0 @@ |
216 | -/* |
217 | - * Copyright 2013 Canonical Ltd. |
218 | - * |
219 | - * This file is part of unity-webapps-qml. |
220 | - * |
221 | - * unity-webapps-qml is free software; you can redistribute it and/or modify |
222 | - * it under the terms of the GNU General Public License as published by |
223 | - * the Free Software Foundation; version 3. |
224 | - * |
225 | - * unity-webapps-qml is distributed in the hope that it will be useful, |
226 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
227 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
228 | - * GNU General Public License for more details. |
229 | - * |
230 | - * You should have received a copy of the GNU General Public License |
231 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
232 | - */ |
233 | - |
234 | -#if !defined(__UNITY_WEBAPPS_APP_MODEL_FILTER_PROXY_H__) |
235 | -#define __UNITY_WEBAPPS_APP_MODEL_FILTER_PROXY_H__ |
236 | - |
237 | -// Qt |
238 | -#include <QHash> |
239 | -#include <QSharedPointer> |
240 | -#include <QSortFilterProxyModel> |
241 | - |
242 | - |
243 | -class UnityWebappsAppModel; |
244 | - |
245 | -/*! |
246 | - * \brief The UnityWebappsAppModelFilterProxy class |
247 | - */ |
248 | -class UnityWebappsAppModelFilterProxy : public QSortFilterProxyModel |
249 | -{ |
250 | - Q_OBJECT |
251 | - |
252 | - Q_PROPERTY(QString webappName READ webappName WRITE setwebappName NOTIFY webappNameChanged) |
253 | - Q_PROPERTY(UnityWebappsAppModel * sourceModel READ sourceModel WRITE setsourceModel NOTIFY sourceModelChanged) |
254 | - |
255 | - |
256 | -public: |
257 | - UnityWebappsAppModelFilterProxy(QObject *parent = 0); |
258 | - virtual ~UnityWebappsAppModelFilterProxy(); |
259 | - |
260 | - /*! |
261 | - * \brief webappName |
262 | - * \return |
263 | - */ |
264 | - QString webappName () const; |
265 | - |
266 | - /*! |
267 | - * \brief setwebappName |
268 | - * \param name |
269 | - */ |
270 | - void setwebappName (const QString& name); |
271 | - |
272 | - /*! |
273 | - * \brief sourceModel |
274 | - * \return |
275 | - */ |
276 | - UnityWebappsAppModel * sourceModel() const; |
277 | - |
278 | - /*! |
279 | - * \brief setSourceModel |
280 | - * \param model |
281 | - */ |
282 | - void setsourceModel(UnityWebappsAppModel * model); |
283 | - |
284 | - |
285 | -Q_SIGNALS: |
286 | - |
287 | - void webappNameChanged () const; |
288 | - void sourceModelChanged () const; |
289 | - |
290 | - |
291 | -protected: |
292 | - |
293 | - // From QSortFilterProxyModel::filterAcceptsRow |
294 | - bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const; |
295 | - |
296 | - |
297 | -private: |
298 | - |
299 | - QString _name; |
300 | -}; |
301 | - |
302 | -#endif // __UNITY_WEBAPPS_APP_MODEL_FILTER_PROXY_H__ |
303 | |
304 | === modified file 'src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model.cpp' |
305 | --- src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model.cpp 2014-05-22 08:54:56 +0000 |
306 | +++ src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model.cpp 2014-07-08 20:49:15 +0000 |
307 | @@ -301,7 +301,7 @@ |
308 | content); |
309 | } |
310 | |
311 | - Q_EMIT modelChanged(); |
312 | + Q_EMIT modelContentChanged(); |
313 | } |
314 | |
315 | QString |
316 | |
317 | === modified file 'src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model.h' |
318 | --- src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model.h 2014-05-22 08:54:56 +0000 |
319 | +++ src/Ubuntu/UnityWebApps/plugin/unity-webapps-app-model.h 2014-07-08 20:49:15 +0000 |
320 | @@ -137,7 +137,7 @@ |
321 | Q_SIGNALS: |
322 | |
323 | void searchPathChanged(const QString & path); |
324 | - void modelChanged(); |
325 | + void modelContentChanged(); |
326 | |
327 | |
328 | private Q_SLOTS: |
329 | |
330 | === modified file 'tests/integration/autopilot/autopilot.pro' |
331 | --- tests/integration/autopilot/autopilot.pro 2013-08-26 20:16:16 +0000 |
332 | +++ tests/integration/autopilot/autopilot.pro 2014-07-08 20:49:15 +0000 |
333 | @@ -5,5 +5,10 @@ |
334 | $$system(ls ./html/*) \ |
335 | $$system(ls ./unity_webapps_qml/emulators/*.py) \ |
336 | $$system(ls ./unity_webapps_qml/tests/*.py) \ |
337 | - $$system(ls ./data/installed-webapps/*) |
338 | - |
339 | + $$system(ls ./unity_webapps_qml/*.py) \ |
340 | + $$system(ls ./data/*/*) \ |
341 | + unity_webapps_qml/tests/test_installedWebapp.py \ |
342 | + unity_webapps_qml/tests/fake_servers.py \ |
343 | + qml/WebviewBackendWebkit.qml \ |
344 | + qml/WebviewBackendOxide.qml \ |
345 | + qml/message-server.js |
346 | |
347 | === added directory 'tests/integration/autopilot/data' |
348 | === added directory 'tests/integration/autopilot/data/all-in-same-folder' |
349 | === added file 'tests/integration/autopilot/data/all-in-same-folder/script.user.js' |
350 | --- tests/integration/autopilot/data/all-in-same-folder/script.user.js 1970-01-01 00:00:00 +0000 |
351 | +++ tests/integration/autopilot/data/all-in-same-folder/script.user.js 2014-07-08 20:49:15 +0000 |
352 | @@ -0,0 +1,1 @@ |
353 | +document.getElementById('content').innerHTML="WebApp Script Injected" |
354 | |
355 | === added file 'tests/integration/autopilot/data/all-in-same-folder/webapp-properties.json' |
356 | --- tests/integration/autopilot/data/all-in-same-folder/webapp-properties.json 1970-01-01 00:00:00 +0000 |
357 | +++ tests/integration/autopilot/data/all-in-same-folder/webapp-properties.json 2014-07-08 20:49:15 +0000 |
358 | @@ -0,0 +1,8 @@ |
359 | +{ |
360 | + "includes": ["http://localhost:*/*"], |
361 | + "name": "ExtendedWebappProperties", |
362 | + "scripts": ["script.user.js"], |
363 | + "domain":"", |
364 | + "homepage":"", |
365 | + "user-agent-override": "My Override" |
366 | +} |
367 | |
368 | === added directory 'tests/integration/autopilot/data/unity-webapps-normal' |
369 | === added file 'tests/integration/autopilot/data/unity-webapps-normal/manifest.json' |
370 | --- tests/integration/autopilot/data/unity-webapps-normal/manifest.json 1970-01-01 00:00:00 +0000 |
371 | +++ tests/integration/autopilot/data/unity-webapps-normal/manifest.json 2014-07-08 20:49:15 +0000 |
372 | @@ -0,0 +1,7 @@ |
373 | +{ |
374 | + "includes": ["http://localhost:*/*"], |
375 | + "name": "Normal", |
376 | + "scripts": ["script.user.js"], |
377 | + "domain":"", |
378 | + "homepage":"" |
379 | +} |
380 | |
381 | === added file 'tests/integration/autopilot/data/unity-webapps-normal/script.user.js' |
382 | --- tests/integration/autopilot/data/unity-webapps-normal/script.user.js 1970-01-01 00:00:00 +0000 |
383 | +++ tests/integration/autopilot/data/unity-webapps-normal/script.user.js 2014-07-08 20:49:15 +0000 |
384 | @@ -0,0 +1,1 @@ |
385 | +document.getElementById('content').innerHTML="WebApp Script Injected" |
386 | |
387 | === added directory 'tests/integration/autopilot/data/unity-webapps-with-altered-ua-string' |
388 | === added file 'tests/integration/autopilot/data/unity-webapps-with-altered-ua-string/manifest.json' |
389 | --- tests/integration/autopilot/data/unity-webapps-with-altered-ua-string/manifest.json 1970-01-01 00:00:00 +0000 |
390 | +++ tests/integration/autopilot/data/unity-webapps-with-altered-ua-string/manifest.json 2014-07-08 20:49:15 +0000 |
391 | @@ -0,0 +1,8 @@ |
392 | +{ |
393 | + "includes": ["http://localhost:*/*"], |
394 | + "name": "AlteredUAWebapp", |
395 | + "scripts": ["script.user.js"], |
396 | + "domain":"", |
397 | + "homepage":"", |
398 | + "user-agent-override": "My Override" |
399 | +} |
400 | |
401 | === added file 'tests/integration/autopilot/data/unity-webapps-with-altered-ua-string/script.user.js' |
402 | --- tests/integration/autopilot/data/unity-webapps-with-altered-ua-string/script.user.js 1970-01-01 00:00:00 +0000 |
403 | +++ tests/integration/autopilot/data/unity-webapps-with-altered-ua-string/script.user.js 2014-07-08 20:49:15 +0000 |
404 | @@ -0,0 +1,1 @@ |
405 | +document.getElementById('content').innerHTML="WebApp Script Injected" |
406 | |
407 | === modified file 'tests/integration/autopilot/qml/FullWebViewApp.qml' |
408 | --- tests/integration/autopilot/qml/FullWebViewApp.qml 2014-05-13 17:48:43 +0000 |
409 | +++ tests/integration/autopilot/qml/FullWebViewApp.qml 2014-07-08 20:49:15 +0000 |
410 | @@ -18,10 +18,9 @@ |
411 | |
412 | import QtQuick 2.0 |
413 | import QtQuick.Window 2.0 |
414 | -import QtWebKit 3.0 |
415 | -import QtWebKit.experimental 1.0 |
416 | import Ubuntu.Unity.Action 1.0 as UnityActions |
417 | import Ubuntu.UnityWebApps 0.1 |
418 | +import "." |
419 | |
420 | import "dom-introspection-utils.js" as DomIntrospectionUtils |
421 | |
422 | @@ -36,15 +35,25 @@ |
423 | signal resultUpdated(string message) |
424 | |
425 | function evalInPageUnsafe(expr) { |
426 | - var tid = DomIntrospectionUtils.gentid(); |
427 | - console.log(DomIntrospectionUtils.wrapJsCommands(expr)) |
428 | - webView.experimental.evaluateJavaScript(DomIntrospectionUtils.wrapJsCommands(expr), |
429 | - function(result) { console.log('Result: ' + result); root.resultUpdated(DomIntrospectionUtils.createResult(result)); }); |
430 | + if (webView && webView.experimental) { |
431 | + webView.experimental.evaluateJavaScript(DomIntrospectionUtils.wrapJsCommands(expr), |
432 | + function(result) { |
433 | + console.log('Result: ' + result); |
434 | + root.resultUpdated(DomIntrospectionUtils.createResult(result)); |
435 | + }); |
436 | + } |
437 | + else { |
438 | + root.resultUpdated(DomIntrospectionUtils.createResult(webView.evaluateCode("return navigator.userAgent", true))) |
439 | + } |
440 | } |
441 | |
442 | - property alias url: webView.url |
443 | + property var webView: null |
444 | + |
445 | + property bool useOxide: false |
446 | + property string url: "" |
447 | property string webappName: "" |
448 | property string webappSearchPath: "" |
449 | + property string webappHomepage: "" |
450 | |
451 | UnityActions.ActionManager { |
452 | localContexts: [webappsActionsContext] |
453 | @@ -54,21 +63,37 @@ |
454 | active: true |
455 | } |
456 | |
457 | - WebView { |
458 | - id: webView |
459 | - objectName: "webview" |
460 | - |
461 | + Loader { |
462 | + id: webviewLoader |
463 | + onLoaded: { |
464 | + webView = webviewLoader.item |
465 | + } |
466 | + } |
467 | + |
468 | + Component.onCompleted: { |
469 | + var webviewSource = useOxide ? |
470 | + Qt.resolvedUrl("WebviewBackendOxide.qml") |
471 | + : Qt.resolvedUrl("WebviewBackendWebkit.qml"); |
472 | + var override = webappName && webappModel.exists(webappName) ? |
473 | + webappModel.userAgentOverrideFor(webappName) : "" |
474 | + webviewLoader.setSource(webviewSource, |
475 | + { url: root.url, |
476 | + localUserAgentOverride: override}) |
477 | + } |
478 | + |
479 | + Loader { |
480 | + id: unityWebappsComponentLoader |
481 | anchors.fill: parent |
482 | - width: parent.width |
483 | - height: parent.height |
484 | - |
485 | - experimental.userScripts: [] |
486 | - experimental.preferences.navigatorQtObjectEnabled: true |
487 | - experimental.preferences.developerExtrasEnabled: true |
488 | - |
489 | - function getUnityWebappsProxies() { |
490 | - return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webView); |
491 | - } |
492 | + sourceComponent: webView !== null && webappName.length !== 0 ? unityWebappsComponent : null |
493 | + } |
494 | + |
495 | + UnityWebappsAppModel { |
496 | + id: webappModel |
497 | + searchPath: root.webappSearchPath |
498 | + } |
499 | + |
500 | + Component { |
501 | + id: unityWebappsComponent |
502 | |
503 | UnityWebApps { |
504 | id: webapps |
505 | @@ -76,8 +101,8 @@ |
506 | actionsContext: webappsActionsContext |
507 | name: root.webappName |
508 | bindee: webView |
509 | - //searchPath: '/home/alex/dev/work/webapps/branches/webapps-qml/latest/examples/data/userscripts' |
510 | - model: UnityWebappsAppModel { } |
511 | + _opt_homepage: root.webappHomepage |
512 | + model: webappModel |
513 | } |
514 | } |
515 | } |
516 | |
517 | === added file 'tests/integration/autopilot/qml/WebviewBackendOxide.qml' |
518 | --- tests/integration/autopilot/qml/WebviewBackendOxide.qml 1970-01-01 00:00:00 +0000 |
519 | +++ tests/integration/autopilot/qml/WebviewBackendOxide.qml 2014-07-08 20:49:15 +0000 |
520 | @@ -0,0 +1,87 @@ |
521 | +import QtQuick 2.0 |
522 | +import QtTest 1.0 |
523 | +import com.canonical.Oxide 1.0 as Oxide |
524 | +import Ubuntu.UnityWebApps 0.1 |
525 | + |
526 | +Oxide.WebView { |
527 | + id: webView |
528 | + objectName: "webview" |
529 | + |
530 | + property string localUserAgentOverride: "" |
531 | + |
532 | + function _waitForResult(req, timeout) { |
533 | + var result; |
534 | + var error; |
535 | + req.onreply = function(response) { |
536 | + result = response; |
537 | + error = 0; |
538 | + }; |
539 | + req.onerror = function(error_code, msg) { |
540 | + result = msg; |
541 | + error = error_code; |
542 | + }; |
543 | + webView._waitFor(function() { return error !== undefined; }, |
544 | + timeout); |
545 | + |
546 | + if (error > 0) { |
547 | + console.error('Error:' + error + ', result:' + result) |
548 | + } else if (error === 0) { |
549 | + return result; |
550 | + } else { |
551 | + throw new Error("Message call timed out"); |
552 | + } |
553 | + } |
554 | + |
555 | + function _waitFor(predicate, timeout) { |
556 | + timeout = timeout || 5000000; |
557 | + var end = Date.now() + timeout; |
558 | + var i = Date.now(); |
559 | + while (i < end && !predicate()) { |
560 | + qtest_testResult.wait(50); |
561 | + i = Date.now(); |
562 | + } |
563 | + return predicate(); |
564 | + } |
565 | + |
566 | + function evaluateCode(code, wrap) { |
567 | + var value = webView._waitForResult( |
568 | + webView.rootFrame.sendMessage( |
569 | + "webview-oxide://test/", |
570 | + "EVALUATE-CODE", |
571 | + { code: code, |
572 | + wrap: wrap === undefined ? false : wrap })); |
573 | + return value ? value.result : undefined; |
574 | + } |
575 | + |
576 | + context: Oxide.WebContext { |
577 | + userAgent: webView.localUserAgentOverride.length === 0 ? undefined : webView.localUserAgentOverride |
578 | + userScripts: [ |
579 | + Oxide.UserScript { |
580 | + context: "webview-oxide://test/" |
581 | + url: Qt.resolvedUrl("message-server.js") |
582 | + matchAllFrames: true |
583 | + } |
584 | + ] |
585 | + } |
586 | + |
587 | + function getUnityWebappsProxies() { |
588 | + return UnityWebAppsUtils.makeProxiesForWebViewBindee(webView); |
589 | + } |
590 | + |
591 | + onJavaScriptConsoleMessage: { |
592 | + var msg = "[JS] (%1:%2) %3".arg(sourceId).arg(lineNumber).arg(message) |
593 | + if (level === Oxide.WebView.LogSeverityVerbose) { |
594 | + console.log(msg) |
595 | + } else if (level === Oxide.WebView.LogSeverityInfo) { |
596 | + console.info(msg) |
597 | + } else if (level === Oxide.WebView.LogSeverityWarning) { |
598 | + console.warn(msg) |
599 | + } else if ((level === Oxide.WebView.LogSeverityError) || |
600 | + (level === Oxide.WebView.LogSeverityErrorReport) || |
601 | + (level === Oxide.WebView.LogSeverityFatal)) { |
602 | + console.error(msg) |
603 | + } |
604 | + } |
605 | + |
606 | + TestResult { id: qtest_testResult } |
607 | +} |
608 | |
609 | === added file 'tests/integration/autopilot/qml/WebviewBackendWebkit.qml' |
610 | --- tests/integration/autopilot/qml/WebviewBackendWebkit.qml 1970-01-01 00:00:00 +0000 |
611 | +++ tests/integration/autopilot/qml/WebviewBackendWebkit.qml 2014-07-08 20:49:15 +0000 |
612 | @@ -0,0 +1,19 @@ |
613 | +import QtQuick 2.0 |
614 | +import QtWebKit 3.0 |
615 | +import QtWebKit.experimental 1.0 |
616 | +import Ubuntu.UnityWebApps 0.1 |
617 | + |
618 | +WebView { |
619 | + id: webView |
620 | + objectName: "webview" |
621 | + |
622 | + property string localUserAgentOverride: "" |
623 | + |
624 | + experimental.userScripts: [] |
625 | + experimental.preferences.navigatorQtObjectEnabled: true |
626 | + experimental.preferences.developerExtrasEnabled: true |
627 | + |
628 | + function getUnityWebappsProxies() { |
629 | + return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webView); |
630 | + } |
631 | +} |
632 | |
633 | === added file 'tests/integration/autopilot/qml/message-server.js' |
634 | --- tests/integration/autopilot/qml/message-server.js 1970-01-01 00:00:00 +0000 |
635 | +++ tests/integration/autopilot/qml/message-server.js 2014-07-08 20:49:15 +0000 |
636 | @@ -0,0 +1,29 @@ |
637 | +// Copyright (C) 2014 Canonical Ltd. |
638 | + |
639 | +// This library is free software; you can redistribute it and/or |
640 | +// modify it under the terms of the GNU Lesser General Public |
641 | +// License as published by the Free Software Foundation; either |
642 | +// version 2.1 of the License, or (at your option) any later version. |
643 | + |
644 | +// This library is distributed in the hope that it will be useful, |
645 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
646 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
647 | +// Lesser General Public License for more details. |
648 | + |
649 | +// You should have received a copy of the GNU Lesser General Public |
650 | +// License along with this library; if not, write to the Free Software |
651 | +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
652 | + |
653 | +oxide.addMessageHandler("EVALUATE-CODE", function(msg) { |
654 | + var code = msg.args.code; |
655 | + if (msg.args.wrap) { |
656 | + code = "(function() {" + code + "})()"; |
657 | + } |
658 | + try { |
659 | + var result = eval(code); |
660 | + msg.reply({result: result}); |
661 | + } catch(e) { |
662 | + msg.error("Code threw exception: \"" + e + "\""); |
663 | + } |
664 | +}); |
665 | + |
666 | |
667 | === removed directory 'tests/integration/autopilot/unity_webapps_qml/emulators' |
668 | === removed file 'tests/integration/autopilot/unity_webapps_qml/emulators/__init__.py' |
669 | --- tests/integration/autopilot/unity_webapps_qml/emulators/__init__.py 2013-06-17 14:46:51 +0000 |
670 | +++ tests/integration/autopilot/unity_webapps_qml/emulators/__init__.py 1970-01-01 00:00:00 +0000 |
671 | @@ -1,7 +0,0 @@ |
672 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
673 | -# Copyright 2013 Canonical |
674 | -# |
675 | -# This program is free software: you can redistribute it and/or modify it |
676 | -# under the terms of the GNU General Public License version 3, as published |
677 | -# by the Free Software Foundation. |
678 | - |
679 | |
680 | === modified file 'tests/integration/autopilot/unity_webapps_qml/tests/__init__.py' |
681 | --- tests/integration/autopilot/unity_webapps_qml/tests/__init__.py 2014-04-22 15:40:04 +0000 |
682 | +++ tests/integration/autopilot/unity_webapps_qml/tests/__init__.py 2014-07-08 20:49:15 +0000 |
683 | @@ -15,62 +15,86 @@ |
684 | |
685 | from testtools.matchers import Contains, Equals, GreaterThan |
686 | from autopilot.matchers import Eventually |
687 | +from unity_webapps_qml.tests import fake_servers |
688 | |
689 | from unity.emulators.unity import Unity |
690 | |
691 | from unity.tests import UnityTestCase |
692 | |
693 | +LOCAL_QML_LAUNCHER_APP_PATH = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), '../../../../../tools/qml-launcher/unity-webapps-qml-launcher') |
694 | +INSTALLED_QML_LAUNCHER_APP_PATH = 'unity-webapps-qml-launcher' |
695 | + |
696 | +# TODO create __init__.py.in |
697 | +LOCAL_BROWSER_CONTAINER_PATH = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), '../../qml/FullWebViewApp.qml') |
698 | +INSTALLED_BROWSER_CONTAINER_PATH = '/usr/share/unity-webapps-qml/autopilot-tests/qml/FullWebViewApp.qml' |
699 | + |
700 | +BASE_URL = '' |
701 | + |
702 | class UnityWebappsTestCaseBase(UnityTestCase): |
703 | - LOCAL_QML_LAUNCHER_APP_PATH = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), '../../../../../tools/qml-launcher/unity-webapps-qml-launcher') |
704 | - INSTALLED_QML_LAUNCHER_APP_PATH = 'unity-webapps-qml-launcher' |
705 | - |
706 | - # TODO create __init__.py.in |
707 | - LOCAL_BROWSER_CONTAINER_PATH = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), '../../qml/FullWebViewApp.qml') |
708 | - INSTALLED_BROWSER_CONTAINER_PATH = '/usr/share/unity-webapps-qml/autopilot-tests/qml/FullWebViewApp.qml' |
709 | - |
710 | - BASE_URL = '' |
711 | + def setUp(self): |
712 | + super(UnityWebappsTestCaseBase, self).setUp() |
713 | + self.use_oxide = False |
714 | + |
715 | + def tearDown(self): |
716 | + super(UnityWebappsTestCaseBase, self).tearDown() |
717 | |
718 | def create_file_url(self, path): |
719 | return 'file://' + path |
720 | |
721 | def get_qml_browser_container_path(self): |
722 | - if os.path.exists(self.LOCAL_BROWSER_CONTAINER_PATH): |
723 | - return self.LOCAL_BROWSER_CONTAINER_PATH |
724 | - return self.INSTALLED_BROWSER_CONTAINER_PATH |
725 | + if os.path.exists(LOCAL_BROWSER_CONTAINER_PATH): |
726 | + return LOCAL_BROWSER_CONTAINER_PATH |
727 | + return INSTALLED_BROWSER_CONTAINER_PATH |
728 | |
729 | def get_qml_launcher_path(self): |
730 | - if os.path.exists(self.LOCAL_QML_LAUNCHER_APP_PATH): |
731 | - return self.LOCAL_QML_LAUNCHER_APP_PATH |
732 | - return self.INSTALLED_QML_LAUNCHER_APP_PATH |
733 | - |
734 | - def get_launch_params(self, url): |
735 | - base_params = ['--qml=' + self.get_qml_browser_container_path(), '--url=' + url, '--app-id=unitywebappsqmllauncher', '--webappName=unitywebappsqmllauncher'] |
736 | - if os.path.exists(self.LOCAL_QML_LAUNCHER_APP_PATH): |
737 | + if os.path.exists(LOCAL_QML_LAUNCHER_APP_PATH): |
738 | + return LOCAL_QML_LAUNCHER_APP_PATH |
739 | + return INSTALLED_QML_LAUNCHER_APP_PATH |
740 | + |
741 | + def get_launch_params(self, |
742 | + url, |
743 | + webapp_name='unitywebappsqmllauncher', |
744 | + webapp_search_path="", |
745 | + webapp_homepage="", |
746 | + use_oxide=False): |
747 | + base_params = ['--qml=' + self.get_qml_browser_container_path(), |
748 | + '--app-id=' + webapp_name, |
749 | + '--webappName=' + webapp_name, |
750 | + '--webappSearchPath=' + webapp_search_path] |
751 | + |
752 | + if len(webapp_homepage) != 0: |
753 | + base_params.append('--webappHomepage=' + webapp_homepage) |
754 | + |
755 | + if len(url) != 0: |
756 | + base_params.append('--url=' + url) |
757 | + |
758 | + if use_oxide: |
759 | + base_params.append('--useOxide') |
760 | + |
761 | + if os.path.exists(LOCAL_QML_LAUNCHER_APP_PATH): |
762 | # we are local |
763 | - base_params.append('--import=' + os.path.join (os.path.dirname(os.path.realpath(__file__)), '../../../../../src')) |
764 | + base_params.append('--import=' + os.path.join (os.path.dirname(os.path.realpath(__file__)), |
765 | + '../../../../../src')) |
766 | + |
767 | return base_params |
768 | |
769 | def launch_with_html_filepath(self, html_filepath): |
770 | self.assertThat(os.path.exists(html_filepath), Equals(True)) |
771 | - |
772 | url = self.create_file_url(html_filepath) |
773 | - params = self.get_launch_params(url) |
774 | - |
775 | - print 'Launching test with params:', params |
776 | + |
777 | + self.launch_application(self.get_launch_params(url)) |
778 | + self.assert_url_eventually_loaded(url) |
779 | + |
780 | + def launch_application(self, args): |
781 | + print 'Launching test with params:', args, "with", self.get_qml_launcher_path() |
782 | + |
783 | self.app = self.launch_test_application(self.get_qml_launcher_path(), |
784 | - *params, |
785 | + *args, |
786 | app_type='qt') |
787 | |
788 | - self.assert_url_eventually_loaded(url) |
789 | self.webviewContainer = self.get_webviewContainer() |
790 | self.watcher = self.webviewContainer.watch_signal('resultUpdated(QString)') |
791 | |
792 | - def setUp(self): |
793 | - super(UnityWebappsTestCaseBase, self).setUp() |
794 | - |
795 | - def tearDown(self): |
796 | - super(UnityWebappsTestCaseBase, self).tearDown() |
797 | - |
798 | def pick_app_launcher(self, app_path): |
799 | # force Qt app introspection: |
800 | from autopilot.introspection.qt import QtApplicationLauncher |
801 | @@ -99,3 +123,14 @@ |
802 | results = json.loads(webview.get_signal_emissions('resultUpdated(QString)')[-1][0]) |
803 | return results.has_key('result') and results['result'] or None |
804 | |
805 | +class WebappsTestCaseBaseWithLocalHttpContentBase(UnityWebappsTestCaseBase): |
806 | + def setUp(self): |
807 | + super(WebappsTestCaseBaseWithLocalHttpContentBase, self).setUp() |
808 | + self.http_server = fake_servers.WebappsQmlContentHttpServer() |
809 | + self.addCleanup(self.http_server.shutdown) |
810 | + self.base_url = "http://localhost:{}/".format(self.http_server.port) |
811 | + |
812 | + def launch_with_webapp(self, name, webapp_search_path, use_oxide=False): |
813 | + self.use_oxide = use_oxide |
814 | + self.launch_application(self.get_launch_params("", name, webapp_search_path, self.base_url, use_oxide)) |
815 | + self.assert_url_eventually_loaded(self.base_url) |
816 | |
817 | === added file 'tests/integration/autopilot/unity_webapps_qml/tests/fake_servers.py' |
818 | --- tests/integration/autopilot/unity_webapps_qml/tests/fake_servers.py 1970-01-01 00:00:00 +0000 |
819 | +++ tests/integration/autopilot/unity_webapps_qml/tests/fake_servers.py 2014-07-08 20:49:15 +0000 |
820 | @@ -0,0 +1,70 @@ |
821 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
822 | +# Copyright 2014 Canonical |
823 | +# |
824 | +# This program is free software: you can redistribute it and/or modify it |
825 | +# under the terms of the GNU General Public License version 3, as published |
826 | +# by the Free Software Foundation. |
827 | +# |
828 | +# This program is distributed in the hope that it will be useful, |
829 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
830 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
831 | +# GNU General Public License for more details. |
832 | +# |
833 | +# You should have received a copy of the GNU General Public License |
834 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
835 | + |
836 | +""" Autopilot tests for the unity_webapps_qml package """ |
837 | + |
838 | +import BaseHTTPServer |
839 | +import logging |
840 | +import threading |
841 | + |
842 | + |
843 | +class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): |
844 | + def serve_content(self, content, mime_type='text/html'): |
845 | + self.send_header('Content-type', mime_type) |
846 | + self.end_headers() |
847 | + self.wfile.write(content.encode()) |
848 | + |
849 | + def basic_html_content(self): |
850 | + return """ |
851 | +<html> |
852 | +<head> |
853 | +<title>Some content</title> |
854 | +</head> |
855 | +<body> |
856 | +<div id='content'> |
857 | +This is some content |
858 | +</div> |
859 | +</body> |
860 | +</html> |
861 | + """ |
862 | + |
863 | + def do_GET(self): |
864 | + if self.path == '/': |
865 | + self.send_response(200) |
866 | + self.serve_content(self.basic_html_content()) |
867 | + else: |
868 | + self.send_error(404) |
869 | + |
870 | + |
871 | +class WebappsQmlContentHttpServer(object): |
872 | + def __init__(self): |
873 | + super(WebappsQmlContentHttpServer, self).__init__() |
874 | + self.server = BaseHTTPServer.HTTPServer(("", 0), RequestHandler) |
875 | + self.server.allow_reuse_address = True |
876 | + self.server_thread = threading.Thread(target=self.server.serve_forever) |
877 | + self.server_thread.start() |
878 | + logging.info("now serving on port {}".format(self.server.server_port)) |
879 | + |
880 | + @property |
881 | + def port(self): |
882 | + return self.server.server_port |
883 | + |
884 | + def run(self): |
885 | + self.server.serve_forever() |
886 | + |
887 | + def shutdown(self): |
888 | + self.server.shutdown() |
889 | + self.server.server_close() |
890 | + self.server_thread.join() |
891 | |
892 | === added file 'tests/integration/autopilot/unity_webapps_qml/tests/test_installedWebapp.py' |
893 | --- tests/integration/autopilot/unity_webapps_qml/tests/test_installedWebapp.py 1970-01-01 00:00:00 +0000 |
894 | +++ tests/integration/autopilot/unity_webapps_qml/tests/test_installedWebapp.py 2014-07-08 20:49:15 +0000 |
895 | @@ -0,0 +1,59 @@ |
896 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
897 | +# Copyright 2013 Canonical |
898 | +# |
899 | +# This program is free software: you can redistribute it and/or modify it |
900 | +# under the terms of the GNU General Public License version 3, as published |
901 | +# by the Free Software Foundation. |
902 | + |
903 | +from __future__ import absolute_import |
904 | + |
905 | +import time |
906 | +import os |
907 | + |
908 | +from testtools.matchers import Equals, GreaterThan, NotEquals |
909 | +from autopilot.matchers import Eventually |
910 | + |
911 | +from unity_webapps_qml.tests import WebappsTestCaseBaseWithLocalHttpContentBase |
912 | + |
913 | +LOCAL_HTML_TEST_FILE = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), '../../data') |
914 | +INSTALLED_HTML_TEST_FILE = '/usr/share/unity-webapps-qml/autopilot-tests/data' |
915 | + |
916 | +class InstalledWebappsTestCaseBase(WebappsTestCaseBaseWithLocalHttpContentBase): |
917 | + def setUp(self): |
918 | + super(InstalledWebappsTestCaseBase, self).setUp() |
919 | + |
920 | + def get_webapp_install_folder(self): |
921 | + if os.path.exists(LOCAL_HTML_TEST_FILE): |
922 | + return os.path.abspath(LOCAL_HTML_TEST_FILE) |
923 | + return INSTALLED_HTML_TEST_FILE |
924 | + |
925 | + def test_normalWebappFound(self): |
926 | + self.launch_with_webapp('Normal', self.get_webapp_install_folder()) |
927 | + |
928 | + self.assertThat(lambda: self.eval_expression_in_page_unsafe('return window.external.getUnityObject("1.0") != null;'), Eventually(Equals(True))) |
929 | + |
930 | + expression = """ |
931 | + var contentElement = document.getElementById('content'); |
932 | + return contentElement.innerHTML; |
933 | + """ |
934 | + self.assertThat(lambda: self.eval_expression_in_page_unsafe(expression), Eventually(Equals("WebApp Script Injected"))) |
935 | + |
936 | + def test_webappWithUAOverrideFound(self): |
937 | + self.launch_with_webapp('AlteredUAWebapp', self.get_webapp_install_folder(), True) |
938 | + self.assertThat(lambda: self.eval_expression_in_page_unsafe('return navigator.userAgent;'), Eventually(Equals("My Override"))) |
939 | + |
940 | + def test_webappFoundWithSpecialWebappPropertiesFile(self): |
941 | + self.launch_with_webapp('ExtendedWebappProperties', self.get_webapp_install_folder() + '/all-in-same-folder') |
942 | + |
943 | + self.assertThat(lambda: self.eval_expression_in_page_unsafe('return window.external.getUnityObject("1.0") != null;'), Eventually(Equals(True))) |
944 | + |
945 | + expression = """ |
946 | + var contentElement = document.getElementById('content'); |
947 | + return contentElement.innerHTML; |
948 | + """ |
949 | + self.assertThat(lambda: self.eval_expression_in_page_unsafe(expression), Eventually(Equals("WebApp Script Injected"))) |
950 | + |
951 | + def test_webappPropertiesFileWithUA(self): |
952 | + self.launch_with_webapp('ExtendedWebappProperties', self.get_webapp_install_folder() + '/all-in-same-folder', True) |
953 | + self.assertThat(lambda: self.eval_expression_in_page_unsafe('return navigator.userAgent;'), Eventually(Equals("My Override"))) |
954 | + |
955 | |
956 | === removed file 'tests/integration/test-server.py' |
957 | --- tests/integration/test-server.py 2013-05-29 15:03:32 +0000 |
958 | +++ tests/integration/test-server.py 1970-01-01 00:00:00 +0000 |
959 | @@ -1,18 +0,0 @@ |
960 | -#!/usr/bin/env python |
961 | - |
962 | -import SocketServer |
963 | -import SimpleHTTPServer |
964 | -import urllib |
965 | - |
966 | -PORT = 8181 |
967 | - |
968 | -class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler): |
969 | - def do_GET(self): |
970 | - if self.path == '/': |
971 | - self.path = '/unity-integration.html' |
972 | - return SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) |
973 | - |
974 | -httpd = SocketServer.TCPServer(('0.0.0.0', PORT), Proxy) |
975 | -print "serving at port", PORT |
976 | -httpd.serve_forever() |
977 | - |
978 | |
979 | === modified file 'tools/qml-launcher/qml-launcher.cpp' |
980 | --- tools/qml-launcher/qml-launcher.cpp 2014-04-22 15:40:04 +0000 |
981 | +++ tools/qml-launcher/qml-launcher.cpp 2014-07-08 20:49:15 +0000 |
982 | @@ -68,6 +68,7 @@ |
983 | const QString QML_FILE_IMPORT_ARG_HEADER = "--import="; |
984 | const QString QML_APP_ID_ARG_HEADER = "--app-id="; |
985 | const QString QML_INSPECTOR_ARG_HEADER = "--inspector="; |
986 | + const QString QML_USE_OXIDE_ARG_HEADER = "--useOxide"; |
987 | const QString ARG_HEADER = "--"; |
988 | const QString VALUE_HEADER = "="; |
989 | QHash<QString, QString> properties; |
990 | @@ -75,6 +76,7 @@ |
991 | QString appid; |
992 | QString importPath; |
993 | QString inspector; |
994 | + bool useOxide = false; |
995 | bool maximized = false; |
996 | |
997 | Q_FOREACH(QString argument, app.arguments()) |
998 | @@ -99,6 +101,11 @@ |
999 | inspector = argument.right(argument.count() - QML_INSPECTOR_ARG_HEADER.count()); |
1000 | } |
1001 | else |
1002 | + if (argument.contains(QML_USE_OXIDE_ARG_HEADER)) |
1003 | + { |
1004 | + useOxide = true; |
1005 | + } |
1006 | + else |
1007 | if (argument.contains(QML_MAXIMIZED_ARG)) |
1008 | { |
1009 | maximized = true; |
1010 | @@ -169,7 +176,7 @@ |
1011 | QQmlContext *context = new QQmlContext(engine.rootContext()); |
1012 | |
1013 | QQmlComponent component(&engine, qmlfile); |
1014 | - QObject *object = component.create(context); |
1015 | + QObject *object = component.beginCreate(context); |
1016 | |
1017 | if (!component.isReady()) { |
1018 | qWarning() << component.errorString(); |
1019 | @@ -192,6 +199,12 @@ |
1020 | object->setProperty(it.key().toStdString().c_str(), QUrl(it.value())); |
1021 | } |
1022 | |
1023 | + if (useOxide) { |
1024 | + object->setProperty("useOxide", true); |
1025 | + } |
1026 | + |
1027 | + component.completeCreate(); |
1028 | + |
1029 | if (window) |
1030 | { |
1031 | if (maximized) |
FAILED: Continuous integration, rev:128 jenkins. qa.ubuntu. com/job/ unity-webapps- qml-ci/ 136/ jenkins. qa.ubuntu. com/job/ unity-webapps- qml-utopic- amd64-ci/ 22/console jenkins. qa.ubuntu. com/job/ unity-webapps- qml-utopic- armhf-ci/ 22/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- webapps- qml-ci/ 136/rebuild
http://