Merge lp:~abreu-alexandre/unity-webapps-qml/port-to-oxide into lp:unity-webapps-qml
- port-to-oxide
- Merge into trunk
Proposed by
Alexandre Abreu
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | David Barth | ||||
Approved revision: | 136 | ||||
Merged at revision: | 136 | ||||
Proposed branch: | lp:~abreu-alexandre/unity-webapps-qml/port-to-oxide | ||||
Merge into: | lp:unity-webapps-qml | ||||
Diff against target: |
2242 lines (+500/-921) 41 files modified
README (+45/-1) debian/control (+2/-3) examples/api-bindings/alarm/main.qml.in (+9/-10) examples/api-bindings/content-hub-exporter/main.qml.in (+8/-10) examples/api-bindings/content-hub/main.qml.in (+8/-10) examples/api-bindings/content-peer-picker/main.qml.in (+8/-10) examples/api-bindings/download-manager/main.qml.in (+8/-10) examples/api-bindings/online-accounts/main.qml.in (+8/-10) examples/api-bindings/runtime-api/main.qml.in (+7/-9) examples/basic-webview/main.qml (+9/-25) examples/examples.pro (+3/-0) examples/facebook-share/content-hub/webapp-facebook.json (+0/-5) examples/facebook-share/manifest.json (+0/-18) examples/facebook-share/unity-webapps-facebook/HubSharer.qml (+0/-41) examples/facebook-share/unity-webapps-facebook/Share.qml (+0/-323) examples/facebook-share/unity-webapps-facebook/facebook.user.js (+0/-47) examples/facebook-share/unity-webapps-facebook/manifest.json (+0/-7) examples/facebook-share/webapp-facebook.application (+0/-11) examples/facebook-share/webapp-facebook.desktop (+0/-9) examples/facebook-share/webapp-facebook.json (+0/-13) examples/facebook-share/webapp-facebook.service (+0/-6) examples/unity-webapps-example-bbcnews/main.qml (+10/-15) examples/unity-webapps-example-facebookmessenger/main.qml (+9/-12) src/Ubuntu/UnityWebApps/UnityWebApps.js (+1/-2) src/Ubuntu/UnityWebApps/UnityWebApps.qml (+16/-7) src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js (+11/-4) src/Ubuntu/UnityWebApps/common/js/unity-backend-messaging-proxy.js (+1/-1) src/Ubuntu/UnityWebApps/unity-webapps-api.js.in (+4/-0) tests/autopilot/autopilot.pro (+0/-1) tests/autopilot/qml/FullWebViewApp.qml (+12/-35) tests/autopilot/qml/WebviewBackendOxide.qml (+8/-3) tests/autopilot/qml/WebviewBackendWebkit.qml (+0/-19) tests/autopilot/unity_webapps_qml/tests/__init__.py (+50/-35) tests/autopilot/unity_webapps_qml/tests/fake_servers.py (+3/-3) tests/autopilot/unity_webapps_qml/tests/test_callbackDispatch.py (+27/-13) tests/autopilot/unity_webapps_qml/tests/test_hud.py (+0/-81) tests/autopilot/unity_webapps_qml/tests/test_injectedOnWebapp.py (+52/-23) tests/autopilot/unity_webapps_qml/tests/test_installedWebapp.py (+49/-18) tests/autopilot/unity_webapps_qml/tests/test_launcher.py (+52/-28) tests/autopilot/unity_webapps_qml/tests/test_mediaplayer.py (+80/-33) tools/qml-launcher/qml-launcher.cpp (+0/-10) |
||||
To merge this branch: | bzr merge lp:~abreu-alexandre/unity-webapps-qml/port-to-oxide | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
WebApps | Pending | ||
Review via email: mp+236115@code.launchpad.net |
Commit message
Port qml bindings to oxide
Description of the change
Port qml bindings to oxide
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Needs Fixing
(continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:138
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
review:
Needs Fixing
(continuous-integration)
- 136. By Alexandre Abreu
-
Port to oxide
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'README' | |||
2 | --- README 2013-06-17 14:46:51 +0000 | |||
3 | +++ README 2014-11-22 00:43:58 +0000 | |||
4 | @@ -1,1 +1,45 @@ | |||
5 | 1 | # | ||
6 | 2 | \ No newline at end of file | 1 | \ No newline at end of file |
7 | 2 | unity-webapps-qml offers a QML component that depending on runtime | ||
8 | 3 | settings and configurations: | ||
9 | 4 | |||
10 | 5 | - allows one to inject the UbuntuTouch Javascript platform bindings, | ||
11 | 6 | |||
12 | 7 | - allows one to inject a restricted set of API bindings when running as a webapp | ||
13 | 8 | (see http://developer.ubuntu.com/publish/webapp/packaging-web-apps/), | ||
14 | 9 | |||
15 | 10 | - allows one to load local javscript snipets that are to be dynamically injected | ||
16 | 11 | in the webview as part of a webapp, | ||
17 | 12 | |||
18 | 13 | The QML component supports Oxide and QtWebkit as a web engine backend. | ||
19 | 14 | |||
20 | 15 | = Building = | ||
21 | 16 | |||
22 | 17 | The build system uses qmake. | ||
23 | 18 | To compile, simply invoke qmake and then make: | ||
24 | 19 | |||
25 | 20 | $ qmake . | ||
26 | 21 | $ make | ||
27 | 22 | |||
28 | 23 | = Running = | ||
29 | 24 | |||
30 | 25 | Some examples are being provided in the examples/ folder. Examples range from | ||
31 | 26 | webapp definitions, to api bindings, etc. | ||
32 | 27 | |||
33 | 28 | = Unit tests = | ||
34 | 29 | |||
35 | 30 | To run the unit tests, you can use the commands below: | ||
36 | 31 | |||
37 | 32 | $ make test | ||
38 | 33 | |||
39 | 34 | = Automated UI tests = | ||
40 | 35 | |||
41 | 36 | The unity-webapps-qml component uses autopilot (https://launchpad.net/autopilot) to test its | ||
42 | 37 | internal sub-componenets. | ||
43 | 38 | To run the tests, you will need to install python3-autopilot and libautopilot-qt. | ||
44 | 39 | Then do the following: | ||
45 | 40 | |||
46 | 41 | $ cd tests/autopilot/ | ||
47 | 42 | $ autopilot3 run unity_webapps_qml | ||
48 | 43 | |||
49 | 44 | You can get a list of all available tests with the following command: | ||
50 | 45 | |||
51 | 46 | $ autopilot3 list unity_webapps_qml | ||
52 | 3 | 47 | ||
53 | === modified file 'debian/control' | |||
54 | --- debian/control 2014-10-14 10:02:49 +0000 | |||
55 | +++ debian/control 2014-11-22 00:43:58 +0000 | |||
56 | @@ -8,7 +8,7 @@ | |||
57 | 8 | libnotify-dev, | 8 | libnotify-dev, |
58 | 9 | # depend on oxide so that we don't build for archs that we can't install on | 9 | # depend on oxide so that we don't build for archs that we can't install on |
59 | 10 | liboxideqtcore0, | 10 | liboxideqtcore0, |
61 | 11 | libqt5webkit5-dev, | 11 | liboxideqt-qmlplugin (>= 1.2.0), |
62 | 12 | libunity-action-qt1-dev, | 12 | libunity-action-qt1-dev, |
63 | 13 | libunity-dev, | 13 | libunity-dev, |
64 | 14 | pkg-config, | 14 | pkg-config, |
65 | @@ -28,8 +28,7 @@ | |||
66 | 28 | 28 | ||
67 | 29 | Package: unity-webapps-qml | 29 | Package: unity-webapps-qml |
68 | 30 | Architecture: any | 30 | Architecture: any |
71 | 31 | Depends: qml-module-qtwebkit, | 31 | Depends: liboxideqt-qmlplugin (>= 1.2.0) | qml-module-qtwebkit, |
70 | 32 | liboxideqt-qmlplugin (>= 1.0), | ||
72 | 33 | qtdeclarative5-qtquick2-plugin, | 32 | qtdeclarative5-qtquick2-plugin, |
73 | 34 | qtdeclarative5-unity-action-plugin, | 33 | qtdeclarative5-unity-action-plugin, |
74 | 35 | qtdeclarative5-ubuntu-ui-toolkit-plugin | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles, | 34 | qtdeclarative5-ubuntu-ui-toolkit-plugin | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles, |
75 | 36 | 35 | ||
76 | === modified file 'examples/api-bindings/alarm/main.qml.in' | |||
77 | --- examples/api-bindings/alarm/main.qml.in 2014-05-08 13:58:56 +0000 | |||
78 | +++ examples/api-bindings/alarm/main.qml.in 2014-11-22 00:43:58 +0000 | |||
79 | @@ -1,9 +1,9 @@ | |||
80 | 1 | import QtQuick 2.0 | 1 | import QtQuick 2.0 |
83 | 2 | import QtWebKit 3.0 | 2 | import com.canonical.Oxide 1.0 |
82 | 3 | import QtWebKit.experimental 1.0 | ||
84 | 4 | import Ubuntu.Components 0.1 | 3 | import Ubuntu.Components 0.1 |
85 | 5 | import Ubuntu.UnityWebApps 0.1 | 4 | import Ubuntu.UnityWebApps 0.1 |
86 | 6 | 5 | ||
87 | 6 | |||
88 | 7 | Item { | 7 | Item { |
89 | 8 | id: root | 8 | id: root |
90 | 9 | focus: true | 9 | focus: true |
91 | @@ -16,17 +16,16 @@ | |||
92 | 16 | anchors.fill: parent | 16 | anchors.fill: parent |
93 | 17 | url: \"file://$$OUT_PWD/alarm/www/index.html\" | 17 | url: \"file://$$OUT_PWD/alarm/www/index.html\" |
94 | 18 | 18 | ||
97 | 19 | experimental.preferences.navigatorQtObjectEnabled: true | 19 | context: WebContext { } |
96 | 20 | experimental.preferences.developerExtrasEnabled: true | ||
98 | 21 | 20 | ||
99 | 22 | function getUnityWebappsProxies() { | 21 | function getUnityWebappsProxies() { |
101 | 23 | return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webview); | 22 | return UnityWebAppsUtils.makeProxiesForWebViewBindee(webview); |
102 | 24 | } | 23 | } |
103 | 24 | } | ||
104 | 25 | 25 | ||
110 | 26 | UnityWebApps { | 26 | UnityWebApps { |
111 | 27 | id: webapps | 27 | id: webapps |
112 | 28 | bindee: webview | 28 | bindee: webview |
113 | 29 | injectExtraUbuntuApis: true | 29 | injectExtraUbuntuApis: true |
109 | 30 | } | ||
114 | 31 | } | 30 | } |
115 | 32 | } | 31 | } |
116 | 33 | 32 | ||
117 | === modified file 'examples/api-bindings/content-hub-exporter/main.qml.in' | |||
118 | --- examples/api-bindings/content-hub-exporter/main.qml.in 2014-05-08 13:58:56 +0000 | |||
119 | +++ examples/api-bindings/content-hub-exporter/main.qml.in 2014-11-22 00:43:58 +0000 | |||
120 | @@ -1,6 +1,5 @@ | |||
121 | 1 | import QtQuick 2.0 | 1 | import QtQuick 2.0 |
124 | 2 | import QtWebKit 3.0 | 2 | import com.canonical.Oxide 1.0 |
123 | 3 | import QtWebKit.experimental 1.0 | ||
125 | 4 | import Ubuntu.Components 0.1 | 3 | import Ubuntu.Components 0.1 |
126 | 5 | import Ubuntu.UnityWebApps 0.1 | 4 | import Ubuntu.UnityWebApps 0.1 |
127 | 6 | 5 | ||
128 | @@ -16,17 +15,16 @@ | |||
129 | 16 | anchors.fill: parent | 15 | anchors.fill: parent |
130 | 17 | url: \"file://$$OUT_PWD/content-hub-exporter/www/index.html\" | 16 | url: \"file://$$OUT_PWD/content-hub-exporter/www/index.html\" |
131 | 18 | 17 | ||
134 | 19 | experimental.preferences.navigatorQtObjectEnabled: true | 18 | context: WebContext { } |
133 | 20 | experimental.preferences.developerExtrasEnabled: true | ||
135 | 21 | 19 | ||
136 | 22 | function getUnityWebappsProxies() { | 20 | function getUnityWebappsProxies() { |
138 | 23 | return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webview); | 21 | return UnityWebAppsUtils.makeProxiesForWebViewBindee(webview); |
139 | 24 | } | 22 | } |
140 | 23 | } | ||
141 | 25 | 24 | ||
147 | 26 | UnityWebApps { | 25 | UnityWebApps { |
148 | 27 | id: webapps | 26 | id: webapps |
149 | 28 | bindee: webview | 27 | bindee: webview |
150 | 29 | injectExtraUbuntuApis: true | 28 | injectExtraUbuntuApis: true |
146 | 30 | } | ||
151 | 31 | } | 29 | } |
152 | 32 | } | 30 | } |
153 | 33 | 31 | ||
154 | === modified file 'examples/api-bindings/content-hub/main.qml.in' | |||
155 | --- examples/api-bindings/content-hub/main.qml.in 2014-05-08 13:58:56 +0000 | |||
156 | +++ examples/api-bindings/content-hub/main.qml.in 2014-11-22 00:43:58 +0000 | |||
157 | @@ -1,6 +1,5 @@ | |||
158 | 1 | import QtQuick 2.0 | 1 | import QtQuick 2.0 |
161 | 2 | import QtWebKit 3.0 | 2 | import com.canonical.Oxide 1.0 |
160 | 3 | import QtWebKit.experimental 1.0 | ||
162 | 4 | import Ubuntu.Components 0.1 | 3 | import Ubuntu.Components 0.1 |
163 | 5 | import Ubuntu.UnityWebApps 0.1 | 4 | import Ubuntu.UnityWebApps 0.1 |
164 | 6 | 5 | ||
165 | @@ -17,17 +16,16 @@ | |||
166 | 17 | anchors.fill: parent | 16 | anchors.fill: parent |
167 | 18 | url: \"file://$$OUT_PWD/content-hub/www/index.html\" | 17 | url: \"file://$$OUT_PWD/content-hub/www/index.html\" |
168 | 19 | 18 | ||
171 | 20 | experimental.preferences.navigatorQtObjectEnabled: true | 19 | context: WebContext { } |
170 | 21 | experimental.preferences.developerExtrasEnabled: true | ||
172 | 22 | 20 | ||
173 | 23 | function getUnityWebappsProxies() { | 21 | function getUnityWebappsProxies() { |
175 | 24 | return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webview); | 22 | return UnityWebAppsUtils.makeProxiesForWebViewBindee(webview); |
176 | 25 | } | 23 | } |
177 | 24 | } | ||
178 | 26 | 25 | ||
184 | 27 | UnityWebApps { | 26 | UnityWebApps { |
185 | 28 | id: webapps | 27 | id: webapps |
186 | 29 | bindee: webview | 28 | bindee: webview |
187 | 30 | injectExtraUbuntuApis: true | 29 | injectExtraUbuntuApis: true |
183 | 31 | } | ||
188 | 32 | } | 30 | } |
189 | 33 | } | 31 | } |
190 | 34 | 32 | ||
191 | === modified file 'examples/api-bindings/content-peer-picker/main.qml.in' | |||
192 | --- examples/api-bindings/content-peer-picker/main.qml.in 2014-05-08 14:21:54 +0000 | |||
193 | +++ examples/api-bindings/content-peer-picker/main.qml.in 2014-11-22 00:43:58 +0000 | |||
194 | @@ -1,6 +1,5 @@ | |||
195 | 1 | import QtQuick 2.0 | 1 | import QtQuick 2.0 |
198 | 2 | import QtWebKit 3.0 | 2 | import com.canonical.Oxide 1.0 |
197 | 3 | import QtWebKit.experimental 1.0 | ||
199 | 4 | import Ubuntu.Components 0.1 | 3 | import Ubuntu.Components 0.1 |
200 | 5 | import Ubuntu.UnityWebApps 0.1 | 4 | import Ubuntu.UnityWebApps 0.1 |
201 | 6 | 5 | ||
202 | @@ -17,17 +16,16 @@ | |||
203 | 17 | anchors.fill: parent | 16 | anchors.fill: parent |
204 | 18 | url: \"file://$$OUT_PWD/content-peer-picker/www/index.html\" | 17 | url: \"file://$$OUT_PWD/content-peer-picker/www/index.html\" |
205 | 19 | 18 | ||
208 | 20 | experimental.preferences.navigatorQtObjectEnabled: true | 19 | context: WebContext { } |
207 | 21 | experimental.preferences.developerExtrasEnabled: true | ||
209 | 22 | 20 | ||
210 | 23 | function getUnityWebappsProxies() { | 21 | function getUnityWebappsProxies() { |
212 | 24 | return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webview); | 22 | return UnityWebAppsUtils.makeProxiesForWebViewBindee(webview); |
213 | 25 | } | 23 | } |
214 | 24 | } | ||
215 | 26 | 25 | ||
221 | 27 | UnityWebApps { | 26 | UnityWebApps { |
222 | 28 | id: webapps | 27 | id: webapps |
223 | 29 | bindee: webview | 28 | bindee: webview |
224 | 30 | injectExtraUbuntuApis: true | 29 | injectExtraUbuntuApis: true |
220 | 31 | } | ||
225 | 32 | } | 30 | } |
226 | 33 | } | 31 | } |
227 | 34 | 32 | ||
228 | === modified file 'examples/api-bindings/download-manager/main.qml.in' | |||
229 | --- examples/api-bindings/download-manager/main.qml.in 2014-05-13 17:48:43 +0000 | |||
230 | +++ examples/api-bindings/download-manager/main.qml.in 2014-11-22 00:43:58 +0000 | |||
231 | @@ -1,6 +1,5 @@ | |||
232 | 1 | import QtQuick 2.0 | 1 | import QtQuick 2.0 |
235 | 2 | import QtWebKit 3.0 | 2 | import com.canonical.Oxide 1.0 |
234 | 3 | import QtWebKit.experimental 1.0 | ||
236 | 4 | import Ubuntu.Components 0.1 | 3 | import Ubuntu.Components 0.1 |
237 | 5 | import Ubuntu.UnityWebApps 0.1 | 4 | import Ubuntu.UnityWebApps 0.1 |
238 | 6 | 5 | ||
239 | @@ -17,17 +16,16 @@ | |||
240 | 17 | anchors.fill: parent | 16 | anchors.fill: parent |
241 | 18 | url: \"file://$$OUT_PWD/download-manager/www/index.html\" | 17 | url: \"file://$$OUT_PWD/download-manager/www/index.html\" |
242 | 19 | 18 | ||
245 | 20 | experimental.preferences.navigatorQtObjectEnabled: true | 19 | context: WebContext { } |
244 | 21 | experimental.preferences.developerExtrasEnabled: true | ||
246 | 22 | 20 | ||
247 | 23 | function getUnityWebappsProxies() { | 21 | function getUnityWebappsProxies() { |
249 | 24 | return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webview); | 22 | return UnityWebAppsUtils.makeProxiesForWebViewBindee(webview); |
250 | 25 | } | 23 | } |
251 | 24 | } | ||
252 | 26 | 25 | ||
258 | 27 | UnityWebApps { | 26 | UnityWebApps { |
259 | 28 | id: webapps | 27 | id: webapps |
260 | 29 | bindee: webview | 28 | bindee: webview |
261 | 30 | injectExtraUbuntuApis: true | 29 | injectExtraUbuntuApis: true |
257 | 31 | } | ||
262 | 32 | } | 30 | } |
263 | 33 | } | 31 | } |
264 | 34 | 32 | ||
265 | === modified file 'examples/api-bindings/online-accounts/main.qml.in' | |||
266 | --- examples/api-bindings/online-accounts/main.qml.in 2014-05-08 13:58:56 +0000 | |||
267 | +++ examples/api-bindings/online-accounts/main.qml.in 2014-11-22 00:43:58 +0000 | |||
268 | @@ -1,6 +1,5 @@ | |||
269 | 1 | import QtQuick 2.0 | 1 | import QtQuick 2.0 |
272 | 2 | import QtWebKit 3.0 | 2 | import com.canonical.Oxide 1.0 |
271 | 3 | import QtWebKit.experimental 1.0 | ||
273 | 4 | import Ubuntu.Components 0.1 | 3 | import Ubuntu.Components 0.1 |
274 | 5 | import Ubuntu.UnityWebApps 0.1 | 4 | import Ubuntu.UnityWebApps 0.1 |
275 | 6 | 5 | ||
276 | @@ -16,17 +15,16 @@ | |||
277 | 16 | anchors.fill: parent | 15 | anchors.fill: parent |
278 | 17 | url: \"file://$$OUT_PWD/online-accounts/www/index.html\" | 16 | url: \"file://$$OUT_PWD/online-accounts/www/index.html\" |
279 | 18 | 17 | ||
282 | 19 | experimental.preferences.navigatorQtObjectEnabled: true | 18 | context: WebContext { } |
281 | 20 | experimental.preferences.developerExtrasEnabled: true | ||
283 | 21 | 19 | ||
284 | 22 | function getUnityWebappsProxies() { | 20 | function getUnityWebappsProxies() { |
286 | 23 | return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webview); | 21 | return UnityWebAppsUtils.makeProxiesForWebViewBindee(webview); |
287 | 24 | } | 22 | } |
288 | 23 | } | ||
289 | 25 | 24 | ||
295 | 26 | UnityWebApps { | 25 | UnityWebApps { |
296 | 27 | id: webapps | 26 | id: webapps |
297 | 28 | bindee: webview | 27 | bindee: webview |
298 | 29 | injectExtraUbuntuApis: true | 28 | injectExtraUbuntuApis: true |
294 | 30 | } | ||
299 | 31 | } | 29 | } |
300 | 32 | } | 30 | } |
301 | 33 | 31 | ||
302 | === modified file 'examples/api-bindings/runtime-api/main.qml.in' | |||
303 | --- examples/api-bindings/runtime-api/main.qml.in 2014-03-26 14:38:17 +0000 | |||
304 | +++ examples/api-bindings/runtime-api/main.qml.in 2014-11-22 00:43:58 +0000 | |||
305 | @@ -1,6 +1,5 @@ | |||
306 | 1 | import QtQuick 2.0 | 1 | import QtQuick 2.0 |
309 | 2 | import QtWebKit 3.0 | 2 | import com.canonical.Oxide 1.0 |
308 | 3 | import QtWebKit.experimental 1.0 | ||
310 | 4 | import Ubuntu.Components 0.1 | 3 | import Ubuntu.Components 0.1 |
311 | 5 | import Ubuntu.UnityWebApps 0.1 | 4 | import Ubuntu.UnityWebApps 0.1 |
312 | 6 | 5 | ||
313 | @@ -17,16 +16,15 @@ | |||
314 | 17 | anchors.fill: parent | 16 | anchors.fill: parent |
315 | 18 | url: \"file://$$OUT_PWD/runtime-api/www/index.html\" | 17 | url: \"file://$$OUT_PWD/runtime-api/www/index.html\" |
316 | 19 | 18 | ||
319 | 20 | experimental.preferences.navigatorQtObjectEnabled: true | 19 | context: WebContext { } |
318 | 21 | experimental.preferences.developerExtrasEnabled: true | ||
320 | 22 | 20 | ||
321 | 23 | function getUnityWebappsProxies() { | 21 | function getUnityWebappsProxies() { |
323 | 24 | return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webview); | 22 | return UnityWebAppsUtils.makeProxiesForWebViewBindee(webview); |
324 | 25 | } | 23 | } |
325 | 24 | } | ||
326 | 26 | 25 | ||
331 | 27 | UnityWebApps { | 26 | UnityWebApps { |
332 | 28 | id: webapps | 27 | id: webapps |
333 | 29 | bindee: webview | 28 | bindee: webview |
330 | 30 | } | ||
334 | 31 | } | 29 | } |
335 | 32 | } | 30 | } |
336 | 33 | 31 | ||
337 | === modified file 'examples/basic-webview/main.qml' | |||
338 | --- examples/basic-webview/main.qml 2014-01-17 15:51:27 +0000 | |||
339 | +++ examples/basic-webview/main.qml 2014-11-22 00:43:58 +0000 | |||
340 | @@ -1,7 +1,6 @@ | |||
341 | 1 | import QtQuick 2.0 | 1 | import QtQuick 2.0 |
342 | 2 | import QtQuick.Window 2.0 | 2 | import QtQuick.Window 2.0 |
345 | 3 | import QtWebKit 3.0 | 3 | import com.canonical.Oxide 1.0 |
344 | 4 | import QtWebKit.experimental 1.0 | ||
346 | 5 | import Ubuntu.UnityWebApps 0.1 | 4 | import Ubuntu.UnityWebApps 0.1 |
347 | 6 | 5 | ||
348 | 7 | Window { | 6 | Window { |
349 | @@ -15,36 +14,21 @@ | |||
350 | 15 | url: "file:///usr/share/unity-webapps-qml/examples/data/html/big-test.html" | 14 | url: "file:///usr/share/unity-webapps-qml/examples/data/html/big-test.html" |
351 | 16 | anchors.fill: parent | 15 | anchors.fill: parent |
352 | 17 | 16 | ||
369 | 18 | experimental.userScripts: [] | 17 | context: WebContext { } |
354 | 19 | experimental.preferences.navigatorQtObjectEnabled: true | ||
355 | 20 | experimental.preferences.developerExtrasEnabled: true | ||
356 | 21 | |||
357 | 22 | experimental.userAgent: { | ||
358 | 23 | return "Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3" | ||
359 | 24 | } | ||
360 | 25 | experimental.onMessageReceived: { | ||
361 | 26 | var msg = null | ||
362 | 27 | try { | ||
363 | 28 | msg = JSON.parse(message.data) | ||
364 | 29 | } catch (error) { | ||
365 | 30 | console.debug('DEBUG:', message.data) | ||
366 | 31 | return | ||
367 | 32 | } | ||
368 | 33 | } | ||
370 | 34 | 18 | ||
371 | 35 | function getUnityWebappsProxies() { | 19 | function getUnityWebappsProxies() { |
373 | 36 | var proxies = UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webView); | 20 | var proxies = UnityWebAppsUtils.makeProxiesForWebViewBindee(webView); |
374 | 37 | 21 | ||
375 | 38 | // override the default navigate to request | 22 | // override the default navigate to request |
376 | 39 | proxies.navigateTo = function(url) {}; | 23 | proxies.navigateTo = function(url) {}; |
377 | 40 | return proxies; | 24 | return proxies; |
378 | 41 | } | 25 | } |
379 | 26 | } | ||
380 | 42 | 27 | ||
387 | 43 | UnityWebApps { | 28 | UnityWebApps { |
388 | 44 | id: webapps | 29 | id: webapps |
389 | 45 | name: "BBCNews" | 30 | name: "BBCNews" |
390 | 46 | bindee: webView | 31 | bindee: webView |
391 | 47 | model: UnityWebappsAppModel { } | 32 | model: UnityWebappsAppModel { } |
386 | 48 | } | ||
392 | 49 | } | 33 | } |
393 | 50 | } | 34 | } |
394 | 51 | 35 | ||
395 | === modified file 'examples/examples.pro' | |||
396 | --- examples/examples.pro 2014-01-17 15:51:27 +0000 | |||
397 | +++ examples/examples.pro 2014-11-22 00:43:58 +0000 | |||
398 | @@ -41,6 +41,9 @@ | |||
399 | 41 | basic_webview_install.path = /usr/share/unity-webapps-qml/examples/basic-webview | 41 | basic_webview_install.path = /usr/share/unity-webapps-qml/examples/basic-webview |
400 | 42 | basic_webview_install.files = $$system(ls basic-webview/*) | 42 | basic_webview_install.files = $$system(ls basic-webview/*) |
401 | 43 | 43 | ||
402 | 44 | html5_api_bindings_install.path = /usr/share/unity-webapps-qml/examples/api-bindings | ||
403 | 45 | html5_api_bindings_install.files = $$system(ls api-bindings/*) | ||
404 | 46 | |||
405 | 44 | webapps_apps_model_install.path = /usr/share/unity-webapps-qml/examples/webapps-apps-model | 47 | webapps_apps_model_install.path = /usr/share/unity-webapps-qml/examples/webapps-apps-model |
406 | 45 | webapps_apps_model_install.files = $$system(ls webapps-app-model/*) | 48 | webapps_apps_model_install.files = $$system(ls webapps-app-model/*) |
407 | 46 | 49 | ||
408 | 47 | 50 | ||
409 | === removed directory 'examples/facebook-share' | |||
410 | === removed directory 'examples/facebook-share/content-hub' | |||
411 | === removed file 'examples/facebook-share/content-hub/webapp-facebook.json' | |||
412 | --- examples/facebook-share/content-hub/webapp-facebook.json 2014-06-17 20:34:32 +0000 | |||
413 | +++ examples/facebook-share/content-hub/webapp-facebook.json 1970-01-01 00:00:00 +0000 | |||
414 | @@ -1,5 +0,0 @@ | |||
415 | 1 | { | ||
416 | 2 | "share": [ | ||
417 | 3 | "pictures" | ||
418 | 4 | ] | ||
419 | 5 | } | ||
420 | 6 | 0 | ||
421 | === removed file 'examples/facebook-share/facebook.png' | |||
422 | 7 | Binary files examples/facebook-share/facebook.png 2014-05-22 08:54:56 +0000 and examples/facebook-share/facebook.png 1970-01-01 00:00:00 +0000 differ | 1 | Binary files examples/facebook-share/facebook.png 2014-05-22 08:54:56 +0000 and examples/facebook-share/facebook.png 1970-01-01 00:00:00 +0000 differ |
423 | === removed file 'examples/facebook-share/manifest.json' | |||
424 | --- examples/facebook-share/manifest.json 2014-06-17 20:34:32 +0000 | |||
425 | +++ examples/facebook-share/manifest.json 1970-01-01 00:00:00 +0000 | |||
426 | @@ -1,18 +0,0 @@ | |||
427 | 1 | { | ||
428 | 2 | "description": "Facebook (webapp version)", | ||
429 | 3 | "framework": "ubuntu-sdk-14.10-dev1", | ||
430 | 4 | "architecture": "all", | ||
431 | 5 | "hooks": { | ||
432 | 6 | "webapp-facebook": { | ||
433 | 7 | "account-application": "webapp-facebook.application", | ||
434 | 8 | "content-hub": "content-hub/webapp-facebook.json", | ||
435 | 9 | "account-service": "webapp-facebook.service", | ||
436 | 10 | "apparmor": "webapp-facebook.json", | ||
437 | 11 | "desktop": "webapp-facebook.desktop" | ||
438 | 12 | } | ||
439 | 13 | }, | ||
440 | 14 | "maintainer": "Webapps Team <webapps@lists.launchpad.net>", | ||
441 | 15 | "name": "com.ubuntu.developer.webapps.webapp-facebook", | ||
442 | 16 | "title": "webapp-facebook", | ||
443 | 17 | "version": "1.0.17.4" | ||
444 | 18 | } | ||
445 | 19 | 0 | ||
446 | === removed directory 'examples/facebook-share/unity-webapps-facebook' | |||
447 | === removed file 'examples/facebook-share/unity-webapps-facebook/HubSharer.qml' | |||
448 | --- examples/facebook-share/unity-webapps-facebook/HubSharer.qml 2014-06-17 20:49:12 +0000 | |||
449 | +++ examples/facebook-share/unity-webapps-facebook/HubSharer.qml 1970-01-01 00:00:00 +0000 | |||
450 | @@ -1,41 +0,0 @@ | |||
451 | 1 | import QtQuick 2.0 | ||
452 | 2 | import Ubuntu.Components 0.1 | ||
453 | 3 | import Ubuntu.Content 0.1 | ||
454 | 4 | |||
455 | 5 | Item { | ||
456 | 6 | id: main | ||
457 | 7 | anchors.fill: parent | ||
458 | 8 | |||
459 | 9 | signal completed(string result) | ||
460 | 10 | |||
461 | 11 | property string fileToShare | ||
462 | 12 | |||
463 | 13 | function _callback(accessToken, fileToShare, message, cb) { | ||
464 | 14 | print ("_callback: " + accessToken); | ||
465 | 15 | print ("_callback: " + fileToShare); | ||
466 | 16 | print ("_callback: " + message); | ||
467 | 17 | |||
468 | 18 | itemComp.url = fileToShare; | ||
469 | 19 | var dataUri = itemComp.toDataURI(); | ||
470 | 20 | var result = {accessToken: accessToken, | ||
471 | 21 | fileToShare: dataUri.toString(), | ||
472 | 22 | message: message}; | ||
473 | 23 | |||
474 | 24 | completed(JSON.stringify(result)); | ||
475 | 25 | } | ||
476 | 26 | |||
477 | 27 | ContentItem { | ||
478 | 28 | id: itemComp | ||
479 | 29 | } | ||
480 | 30 | |||
481 | 31 | Share { | ||
482 | 32 | anchors.fill: parent | ||
483 | 33 | visible: true | ||
484 | 34 | fileToShare: main.fileToShare | ||
485 | 35 | callback: _callback | ||
486 | 36 | provider: "facebook" | ||
487 | 37 | onCanceled: completed(JSON.stringify({status: "cancelled"})) | ||
488 | 38 | onUploadCompleted: console.log (success) | ||
489 | 39 | Component.onCompleted: print ("Page completed " + height + " : " + width) | ||
490 | 40 | } | ||
491 | 41 | } | ||
492 | 42 | 0 | ||
493 | === removed file 'examples/facebook-share/unity-webapps-facebook/Share.qml' | |||
494 | --- examples/facebook-share/unity-webapps-facebook/Share.qml 2014-06-17 21:18:53 +0000 | |||
495 | +++ examples/facebook-share/unity-webapps-facebook/Share.qml 1970-01-01 00:00:00 +0000 | |||
496 | @@ -1,323 +0,0 @@ | |||
497 | 1 | /* | ||
498 | 2 | * Copyright (C) 2012-2013 Canonical, Ltd. | ||
499 | 3 | * | ||
500 | 4 | * This program is free software; you can redistribute it and/or modify | ||
501 | 5 | * it under the terms of the GNU General Public License as published by | ||
502 | 6 | * the Free Software Foundation; version 3. | ||
503 | 7 | * | ||
504 | 8 | * This program is distributed in the hope that it will be useful, | ||
505 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
506 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
507 | 11 | * GNU General Public License for more details. | ||
508 | 12 | * | ||
509 | 13 | * You should have received a copy of the GNU General Public License | ||
510 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
511 | 15 | */ | ||
512 | 16 | |||
513 | 17 | import QtQuick 2.0 | ||
514 | 18 | import QtQuick.Window 2.0 | ||
515 | 19 | import Ubuntu.Components 0.1 | ||
516 | 20 | import Ubuntu.Components.ListItems 0.1 as ListItem | ||
517 | 21 | import Ubuntu.OnlineAccounts 0.1 | ||
518 | 22 | |||
519 | 23 | Rectangle { | ||
520 | 24 | id: root | ||
521 | 25 | anchors.fill: parent | ||
522 | 26 | color: Theme.palette.normal.background | ||
523 | 27 | property string fileToShare | ||
524 | 28 | property var callback | ||
525 | 29 | property string serviceType: "webapps" | ||
526 | 30 | property string provider: "facebook" | ||
527 | 31 | property string userAccountId | ||
528 | 32 | property string accessToken | ||
529 | 33 | property var account | ||
530 | 34 | signal accountSelected | ||
531 | 35 | signal canceled() | ||
532 | 36 | signal uploadCompleted(bool success) | ||
533 | 37 | |||
534 | 38 | onUploadCompleted: { | ||
535 | 39 | activitySpinner.visible = false; | ||
536 | 40 | if (success) | ||
537 | 41 | print ("Successfully posted"); | ||
538 | 42 | else | ||
539 | 43 | print ("Failed to post"); | ||
540 | 44 | } | ||
541 | 45 | |||
542 | 46 | AccountServiceModel { | ||
543 | 47 | id: accounts | ||
544 | 48 | serviceType: root.serviceType | ||
545 | 49 | provider: root.provider | ||
546 | 50 | Component.onCompleted: { | ||
547 | 51 | if (count == 1) { | ||
548 | 52 | srv.objectHandle = get(0, "accountServiceHandle"); | ||
549 | 53 | } | ||
550 | 54 | } | ||
551 | 55 | } | ||
552 | 56 | |||
553 | 57 | AccountService { | ||
554 | 58 | id: srv | ||
555 | 59 | onObjectHandleChanged: { | ||
556 | 60 | root.account = srv; | ||
557 | 61 | root.account.authenticate(null); | ||
558 | 62 | } | ||
559 | 63 | onAuthenticated: { | ||
560 | 64 | root.userAccountId = accountId; | ||
561 | 65 | root.accessToken = reply.AccessToken; | ||
562 | 66 | shareComponent.visible = true; | ||
563 | 67 | sharemenu.visible = false; | ||
564 | 68 | } | ||
565 | 69 | } | ||
566 | 70 | |||
567 | 71 | |||
568 | 72 | Rectangle { | ||
569 | 73 | id: shareComponent | ||
570 | 74 | objectName: "shareComponent" | ||
571 | 75 | anchors.fill: parent | ||
572 | 76 | color: Theme.palette.normal.background | ||
573 | 77 | visible: false | ||
574 | 78 | |||
575 | 79 | Column { | ||
576 | 80 | anchors.fill: parent | ||
577 | 81 | spacing: units.gu(1) | ||
578 | 82 | |||
579 | 83 | Item { | ||
580 | 84 | id: serviceHeader | ||
581 | 85 | y: 0 | ||
582 | 86 | anchors.left: parent.left | ||
583 | 87 | anchors.right: parent.right | ||
584 | 88 | anchors.topMargin: units.gu(1) | ||
585 | 89 | anchors.leftMargin: units.gu(1) | ||
586 | 90 | anchors.rightMargin: units.gu(1) | ||
587 | 91 | height: childrenRect.height | ||
588 | 92 | |||
589 | 93 | ListItem.Subtitled { | ||
590 | 94 | anchors { | ||
591 | 95 | left: parent.left | ||
592 | 96 | right: parent.right | ||
593 | 97 | } | ||
594 | 98 | iconName: root.account.provider.iconName | ||
595 | 99 | text: root.account.provider.displayName | ||
596 | 100 | subText: root.account.displayName | ||
597 | 101 | showDivider: false | ||
598 | 102 | } | ||
599 | 103 | } | ||
600 | 104 | |||
601 | 105 | ListItem.ThinDivider {} | ||
602 | 106 | |||
603 | 107 | UbuntuShape { | ||
604 | 108 | id: messageArea | ||
605 | 109 | objectName: "messageArea" | ||
606 | 110 | anchors.left: parent.left | ||
607 | 111 | anchors.right: parent.right | ||
608 | 112 | anchors.topMargin: units.gu(1) | ||
609 | 113 | anchors.leftMargin: units.gu(1) | ||
610 | 114 | anchors.rightMargin: units.gu(1) | ||
611 | 115 | |||
612 | 116 | height: units.gu(20) | ||
613 | 117 | color: "#f2f2f2" | ||
614 | 118 | |||
615 | 119 | TextEdit { | ||
616 | 120 | id: message | ||
617 | 121 | color: "#333333" | ||
618 | 122 | anchors.top: parent.top | ||
619 | 123 | anchors.left: snapshot.right | ||
620 | 124 | anchors.bottom: parent.bottom | ||
621 | 125 | anchors.margins: units.gu(1) | ||
622 | 126 | wrapMode: Text.Wrap | ||
623 | 127 | width: parent.width - snapshot.width - | ||
624 | 128 | snapshot.anchors.margins * 2 - | ||
625 | 129 | message.anchors.leftMargin - message.anchors.rightMargin | ||
626 | 130 | clip: true | ||
627 | 131 | font.pixelSize: FontUtils.sizeToPixels("medium") | ||
628 | 132 | font.weight: Font.Light | ||
629 | 133 | focus: true | ||
630 | 134 | } | ||
631 | 135 | |||
632 | 136 | ActivityIndicator { | ||
633 | 137 | id: activitySpinner | ||
634 | 138 | anchors.centerIn: message | ||
635 | 139 | visible: false | ||
636 | 140 | running: visible | ||
637 | 141 | } | ||
638 | 142 | |||
639 | 143 | UbuntuShape { | ||
640 | 144 | id: snapshot | ||
641 | 145 | anchors.top: parent.top | ||
642 | 146 | anchors.left: parent.left | ||
643 | 147 | anchors.margins: units.gu(1) | ||
644 | 148 | width: units.gu(10) | ||
645 | 149 | height: units.gu(10) | ||
646 | 150 | |||
647 | 151 | image: Image { | ||
648 | 152 | source: fileToShare | ||
649 | 153 | sourceSize.height: snapshot.height | ||
650 | 154 | sourceSize.width: snapshot.width | ||
651 | 155 | fillMode: Image.PreserveAspectCrop | ||
652 | 156 | } | ||
653 | 157 | } | ||
654 | 158 | } | ||
655 | 159 | |||
656 | 160 | Item { | ||
657 | 161 | id: actionsBar | ||
658 | 162 | anchors.left: parent.left | ||
659 | 163 | anchors.right: parent.right | ||
660 | 164 | anchors.topMargin: units.gu(2) | ||
661 | 165 | anchors.leftMargin: units.gu(1) | ||
662 | 166 | anchors.rightMargin: units.gu(1) | ||
663 | 167 | height: childrenRect.height | ||
664 | 168 | |||
665 | 169 | Button { | ||
666 | 170 | objectName: "cancelButton" | ||
667 | 171 | anchors.left: parent.left | ||
668 | 172 | text: i18n.dtr("ubuntu-ui-extras", "Cancel") | ||
669 | 173 | color: "#cccccc" | ||
670 | 174 | width: units.gu(10) | ||
671 | 175 | height: units.gu(4) | ||
672 | 176 | onClicked: canceled() | ||
673 | 177 | } | ||
674 | 178 | |||
675 | 179 | Button { | ||
676 | 180 | objectName: "postButton" | ||
677 | 181 | anchors.right: parent.right | ||
678 | 182 | anchors.top: parent.top | ||
679 | 183 | text: i18n.dtr("ubuntu-ui-extras", "Post") | ||
680 | 184 | color: "#dd4814" | ||
681 | 185 | width: units.gu(10) | ||
682 | 186 | height: units.gu(4) | ||
683 | 187 | enabled: !activitySpinner.visible | ||
684 | 188 | onClicked: { | ||
685 | 189 | activitySpinner.visible = true; | ||
686 | 190 | callback(accessToken, fileToShare, message.text, uploadCompleted); | ||
687 | 191 | } | ||
688 | 192 | } | ||
689 | 193 | } | ||
690 | 194 | |||
691 | 195 | UbuntuShape { | ||
692 | 196 | id: useLocation | ||
693 | 197 | anchors { | ||
694 | 198 | left: parent.left | ||
695 | 199 | leftMargin: units.gu(1) | ||
696 | 200 | topMargin: units.gu(1) | ||
697 | 201 | } | ||
698 | 202 | color: selected ? "#cccccc" : "transparent" | ||
699 | 203 | property bool selected: false | ||
700 | 204 | width: units.gu(4.5) | ||
701 | 205 | height: units.gu(4) | ||
702 | 206 | |||
703 | 207 | AbstractButton { | ||
704 | 208 | anchors.fill: parent | ||
705 | 209 | onClicked: parent.selected = !parent.selected | ||
706 | 210 | Image { | ||
707 | 211 | source: "assets/icon_location.png" | ||
708 | 212 | anchors.centerIn: parent | ||
709 | 213 | height: parent.height * 0.75 | ||
710 | 214 | fillMode: Image.PreserveAspectFit | ||
711 | 215 | smooth: true | ||
712 | 216 | } | ||
713 | 217 | } | ||
714 | 218 | } | ||
715 | 219 | |||
716 | 220 | Label { | ||
717 | 221 | anchors.left: useLocation.right | ||
718 | 222 | anchors.baseline: useLocation.top | ||
719 | 223 | anchors.baselineOffset: units.gu(3) | ||
720 | 224 | anchors.leftMargin: units.gu(1) | ||
721 | 225 | text: i18n.dtr("ubuntu-ui-extras", "Include location") | ||
722 | 226 | fontSize: "small" | ||
723 | 227 | } | ||
724 | 228 | |||
725 | 229 | } | ||
726 | 230 | |||
727 | 231 | states: [ | ||
728 | 232 | State { | ||
729 | 233 | name: "landscape-with-keyborad" | ||
730 | 234 | PropertyChanges { | ||
731 | 235 | target: serviceHeader | ||
732 | 236 | y: - serviceHeader.height | ||
733 | 237 | } | ||
734 | 238 | PropertyChanges { | ||
735 | 239 | target: messageArea | ||
736 | 240 | height: units.gu(12) | ||
737 | 241 | } | ||
738 | 242 | } | ||
739 | 243 | ] | ||
740 | 244 | |||
741 | 245 | state: ((Screen.orientation === Qt.LandscapeOrientation) || | ||
742 | 246 | (Screen.orientation === Qt.InvertedLandscapeOrientation)) && | ||
743 | 247 | Qt.inputMethod.visible ? "landscape-with-keyborad" : "" | ||
744 | 248 | } | ||
745 | 249 | |||
746 | 250 | /* Menu listing online accounts */ | ||
747 | 251 | Item { | ||
748 | 252 | id: sharemenu | ||
749 | 253 | anchors.fill: parent | ||
750 | 254 | visible: true | ||
751 | 255 | |||
752 | 256 | signal selected(string accountId, string token) | ||
753 | 257 | |||
754 | 258 | Component.onCompleted: { | ||
755 | 259 | visible = true; | ||
756 | 260 | } | ||
757 | 261 | onSelected: { | ||
758 | 262 | root.userAccountId = accountId; | ||
759 | 263 | root.accessToken = token; | ||
760 | 264 | shareComponent.visible = true; | ||
761 | 265 | sharemenu.visible = false; | ||
762 | 266 | } | ||
763 | 267 | |||
764 | 268 | Component { | ||
765 | 269 | id: acctDelegate | ||
766 | 270 | Item { | ||
767 | 271 | anchors { | ||
768 | 272 | left: parent.left | ||
769 | 273 | right: parent.right | ||
770 | 274 | } | ||
771 | 275 | AccountService { | ||
772 | 276 | id: service | ||
773 | 277 | objectHandle: accountServiceHandle | ||
774 | 278 | onAuthenticated: { | ||
775 | 279 | sharemenu.selected(accountId, reply.AccessToken); | ||
776 | 280 | } | ||
777 | 281 | } | ||
778 | 282 | |||
779 | 283 | height: childrenRect.height | ||
780 | 284 | |||
781 | 285 | ListItem.Subtitled { | ||
782 | 286 | anchors { | ||
783 | 287 | left: parent.left | ||
784 | 288 | right: parent.right | ||
785 | 289 | } | ||
786 | 290 | text: service.provider.displayName | ||
787 | 291 | subText: displayName | ||
788 | 292 | iconName: service.provider.iconName | ||
789 | 293 | __iconHeight: units.gu(5) | ||
790 | 294 | __iconWidth: units.gu(5) | ||
791 | 295 | |||
792 | 296 | onClicked: { | ||
793 | 297 | root.account = service; | ||
794 | 298 | root.account.authenticate(null); | ||
795 | 299 | } | ||
796 | 300 | } | ||
797 | 301 | } | ||
798 | 302 | } | ||
799 | 303 | |||
800 | 304 | ListView { | ||
801 | 305 | anchors { | ||
802 | 306 | top: parent.top | ||
803 | 307 | left: parent.left | ||
804 | 308 | right: parent.right | ||
805 | 309 | } | ||
806 | 310 | height: childrenRect.height | ||
807 | 311 | interactive: false | ||
808 | 312 | model: accounts | ||
809 | 313 | header: ListItem.Header { | ||
810 | 314 | anchors { | ||
811 | 315 | left: parent.left | ||
812 | 316 | right: parent.right | ||
813 | 317 | } | ||
814 | 318 | text: i18n.tr("Select account") | ||
815 | 319 | } | ||
816 | 320 | delegate: acctDelegate | ||
817 | 321 | } | ||
818 | 322 | } | ||
819 | 323 | } | ||
820 | 324 | 0 | ||
821 | === removed directory 'examples/facebook-share/unity-webapps-facebook/assets' | |||
822 | === removed file 'examples/facebook-share/unity-webapps-facebook/assets/avatar_image.jpg' | |||
823 | 325 | Binary files examples/facebook-share/unity-webapps-facebook/assets/avatar_image.jpg 2014-05-23 10:05:07 +0000 and examples/facebook-share/unity-webapps-facebook/assets/avatar_image.jpg 1970-01-01 00:00:00 +0000 differ | 1 | Binary files examples/facebook-share/unity-webapps-facebook/assets/avatar_image.jpg 2014-05-23 10:05:07 +0000 and examples/facebook-share/unity-webapps-facebook/assets/avatar_image.jpg 1970-01-01 00:00:00 +0000 differ |
824 | === removed file 'examples/facebook-share/unity-webapps-facebook/assets/icon_location.png' | |||
825 | 326 | Binary files examples/facebook-share/unity-webapps-facebook/assets/icon_location.png 2014-05-23 10:05:07 +0000 and examples/facebook-share/unity-webapps-facebook/assets/icon_location.png 1970-01-01 00:00:00 +0000 differ | 2 | Binary files examples/facebook-share/unity-webapps-facebook/assets/icon_location.png 2014-05-23 10:05:07 +0000 and examples/facebook-share/unity-webapps-facebook/assets/icon_location.png 1970-01-01 00:00:00 +0000 differ |
826 | === removed file 'examples/facebook-share/unity-webapps-facebook/facebook.user.js' | |||
827 | --- examples/facebook-share/unity-webapps-facebook/facebook.user.js 2014-06-17 20:34:32 +0000 | |||
828 | +++ examples/facebook-share/unity-webapps-facebook/facebook.user.js 1970-01-01 00:00:00 +0000 | |||
829 | @@ -1,47 +0,0 @@ | |||
830 | 1 | var api = external.getUnityObject('1.0'); | ||
831 | 2 | var hub = api.ContentHub; | ||
832 | 3 | var activeTransfer; | ||
833 | 4 | |||
834 | 5 | function _shareRequested(transfer) { | ||
835 | 6 | activeTransfer = transfer; | ||
836 | 7 | transfer.items(function(items) { | ||
837 | 8 | api.launchEmbeddedUI("HubSharer", upload, {"fileToShare": items[0]}); | ||
838 | 9 | }); | ||
839 | 10 | }; | ||
840 | 11 | |||
841 | 12 | hub.onShareRequested(_shareRequested); | ||
842 | 13 | |||
843 | 14 | function upload(res) { | ||
844 | 15 | var results = JSON.parse(res); | ||
845 | 16 | if (results.status == "cancelled") | ||
846 | 17 | activeTransfer.setState(hub.ContentTransfer.State.Aborted); | ||
847 | 18 | |||
848 | 19 | var xhr = new XMLHttpRequest(); | ||
849 | 20 | xhr.open( 'POST', 'https://graph.facebook.com/me/photos?access_token=' + results.accessToken, true ); | ||
850 | 21 | xhr.onload = xhr.onerror = function() { | ||
851 | 22 | if ( xhr.status == 200 ) | ||
852 | 23 | window.location.reload(); | ||
853 | 24 | }; | ||
854 | 25 | |||
855 | 26 | var contentType = results.fileToShare.split(',')[0].split(':')[1]; | ||
856 | 27 | var b64data = results.fileToShare.split(',')[1]; | ||
857 | 28 | |||
858 | 29 | var byteCharacters = atob(b64data); | ||
859 | 30 | var byteNumbers = new Array(byteCharacters.length); | ||
860 | 31 | for (var i = 0; i < byteCharacters.length; i++) { | ||
861 | 32 | byteNumbers[i] = byteCharacters.charCodeAt(i); | ||
862 | 33 | } | ||
863 | 34 | var byteArray = new Uint8Array(byteNumbers); | ||
864 | 35 | |||
865 | 36 | var div = document.createElement('div'); | ||
866 | 37 | div.innerHTML = '<form enctype="multipart/form-data" method="post" id="uploadForm"><textarea id="message" name="message"></textarea></form>'; | ||
867 | 38 | document.getElementsByTagName('body')[0].appendChild(div); | ||
868 | 39 | |||
869 | 40 | var blob = new Blob([byteArray], {type: contentType}); | ||
870 | 41 | |||
871 | 42 | var uploadForm = document.forms.namedItem("uploadForm"); | ||
872 | 43 | var formData = new FormData(uploadForm); | ||
873 | 44 | formData.append('source', blob); | ||
874 | 45 | formData.append('message', results.message); | ||
875 | 46 | xhr.send(formData); | ||
876 | 47 | } | ||
877 | 48 | 0 | ||
878 | === removed file 'examples/facebook-share/unity-webapps-facebook/manifest.json' | |||
879 | --- examples/facebook-share/unity-webapps-facebook/manifest.json 2014-05-23 07:42:14 +0000 | |||
880 | +++ examples/facebook-share/unity-webapps-facebook/manifest.json 1970-01-01 00:00:00 +0000 | |||
881 | @@ -1,7 +0,0 @@ | |||
882 | 1 | { | ||
883 | 2 | "name": "facebook", | ||
884 | 3 | "includes": ["https://*.facebook.com/*"], | ||
885 | 4 | "homepage": "https://m.facebook.com/", | ||
886 | 5 | "domain": "facebook.com", | ||
887 | 6 | "scripts": ["facebook.user.js"] | ||
888 | 7 | } | ||
889 | 8 | 0 | ||
890 | === removed file 'examples/facebook-share/webapp-facebook.application' | |||
891 | --- examples/facebook-share/webapp-facebook.application 2014-05-22 08:54:56 +0000 | |||
892 | +++ examples/facebook-share/webapp-facebook.application 1970-01-01 00:00:00 +0000 | |||
893 | @@ -1,11 +0,0 @@ | |||
894 | 1 | <?xml version="1.0" encoding="UTF-8" ?> | ||
895 | 2 | <application id="com.ubuntu.developer.webapps.webapp-facebook_webapp-facebook"> | ||
896 | 3 | <description>Facebook webapp</description> | ||
897 | 4 | |||
898 | 5 | <services> | ||
899 | 6 | <service id="com.ubuntu.developer.webapps.webapp-facebook_webapp-facebook"> | ||
900 | 7 | <description>Use the service in a webapp</description> | ||
901 | 8 | </service> | ||
902 | 9 | </services> | ||
903 | 10 | |||
904 | 11 | </application> | ||
905 | 12 | 0 | ||
906 | === removed file 'examples/facebook-share/webapp-facebook.desktop' | |||
907 | --- examples/facebook-share/webapp-facebook.desktop 2014-06-17 17:53:45 +0000 | |||
908 | +++ examples/facebook-share/webapp-facebook.desktop 1970-01-01 00:00:00 +0000 | |||
909 | @@ -1,9 +0,0 @@ | |||
910 | 1 | [Desktop Entry] | ||
911 | 2 | Type=Application | ||
912 | 3 | Terminal=false | ||
913 | 4 | Exec=webapp-container --enable-back-forward --webapp='ZmFjZWJvb2s=' --webappModelSearchPath=. --webappUrlPatterns=https?://*.facebook.com/* | ||
914 | 5 | Name=Facebook | ||
915 | 6 | Icon=./facebook.png | ||
916 | 7 | X-Ubuntu-Touch=true | ||
917 | 8 | X-Ubuntu-StageHint=SideStage | ||
918 | 9 | X-Ubuntu-Single-Instance=true | ||
919 | 10 | 0 | ||
920 | === removed file 'examples/facebook-share/webapp-facebook.json' | |||
921 | --- examples/facebook-share/webapp-facebook.json 2014-05-23 13:00:57 +0000 | |||
922 | +++ examples/facebook-share/webapp-facebook.json 1970-01-01 00:00:00 +0000 | |||
923 | @@ -1,13 +0,0 @@ | |||
924 | 1 | { | ||
925 | 2 | "template": "ubuntu-webapp", | ||
926 | 3 | "policy_groups": [ | ||
927 | 4 | "networking", | ||
928 | 5 | "accounts", | ||
929 | 6 | "audio", | ||
930 | 7 | "video", | ||
931 | 8 | "webview", | ||
932 | 9 | "location", | ||
933 | 10 | "content_exchange" | ||
934 | 11 | ], | ||
935 | 12 | "policy_version": 1.2 | ||
936 | 13 | } | ||
937 | 14 | 0 | ||
938 | === removed file 'examples/facebook-share/webapp-facebook.service' | |||
939 | --- examples/facebook-share/webapp-facebook.service 2014-05-23 13:00:57 +0000 | |||
940 | +++ examples/facebook-share/webapp-facebook.service 1970-01-01 00:00:00 +0000 | |||
941 | @@ -1,6 +0,0 @@ | |||
942 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
943 | 2 | <service id="com.ubuntu.developer.webapps.webapp-facebook_webapp-facebook"> | ||
944 | 3 | <type>webapps</type> | ||
945 | 4 | <name>Facebook Webapp</name> | ||
946 | 5 | <provider>facebook</provider> | ||
947 | 6 | </service> | ||
948 | 7 | 0 | ||
949 | === modified file 'examples/unity-webapps-example-bbcnews/main.qml' | |||
950 | --- examples/unity-webapps-example-bbcnews/main.qml 2013-07-31 17:27:00 +0000 | |||
951 | +++ examples/unity-webapps-example-bbcnews/main.qml 2014-11-22 00:43:58 +0000 | |||
952 | @@ -18,8 +18,7 @@ | |||
953 | 18 | 18 | ||
954 | 19 | import QtQuick 2.0 | 19 | import QtQuick 2.0 |
955 | 20 | import QtQuick.Window 2.0 | 20 | import QtQuick.Window 2.0 |
958 | 21 | import QtWebKit 3.0 | 21 | import com.canonical.Oxide 1.0 |
957 | 22 | import QtWebKit.experimental 1.0 | ||
959 | 23 | import Ubuntu.UnityWebApps 0.1 | 22 | import Ubuntu.UnityWebApps 0.1 |
960 | 24 | 23 | ||
961 | 25 | Window { | 24 | Window { |
962 | @@ -33,23 +32,19 @@ | |||
963 | 33 | width: parent.width | 32 | width: parent.width |
964 | 34 | height: parent.height | 33 | height: parent.height |
965 | 35 | 34 | ||
972 | 36 | experimental.userScripts: [] | 35 | context: WebContext { |
973 | 37 | experimental.preferences.navigatorQtObjectEnabled: true | 36 | userAgent: "Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3" |
968 | 38 | experimental.preferences.developerExtrasEnabled: true | ||
969 | 39 | |||
970 | 40 | experimental.userAgent: { | ||
971 | 41 | return "Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3" | ||
974 | 42 | } | 37 | } |
975 | 43 | 38 | ||
976 | 44 | function getUnityWebappsProxies() { | 39 | function getUnityWebappsProxies() { |
978 | 45 | return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webView); | 40 | return UnityWebAppsUtils.makeProxiesForWebViewBindee(webView); |
979 | 46 | } | 41 | } |
980 | 42 | } | ||
981 | 47 | 43 | ||
988 | 48 | UnityWebApps { | 44 | UnityWebApps { |
989 | 49 | id: webapps | 45 | id: webapps |
990 | 50 | name: "BBCNews" | 46 | name: "BBCNews" |
991 | 51 | bindee: webView | 47 | bindee: webView |
992 | 52 | model: UnityWebappsAppModel { searchPath: '/usr/share/unity-webapps-qml/examples/data/userscripts'} | 48 | model: UnityWebappsAppModel { searchPath: '/usr/share/unity-webapps-qml/examples/data/userscripts'} |
987 | 53 | } | ||
993 | 54 | } | 49 | } |
994 | 55 | } | 50 | } |
995 | 56 | 51 | ||
996 | === modified file 'examples/unity-webapps-example-facebookmessenger/main.qml' | |||
997 | --- examples/unity-webapps-example-facebookmessenger/main.qml 2013-07-31 19:27:51 +0000 | |||
998 | +++ examples/unity-webapps-example-facebookmessenger/main.qml 2014-11-22 00:43:58 +0000 | |||
999 | @@ -18,8 +18,7 @@ | |||
1000 | 18 | 18 | ||
1001 | 19 | import QtQuick 2.0 | 19 | import QtQuick 2.0 |
1002 | 20 | import QtQuick.Window 2.0 | 20 | import QtQuick.Window 2.0 |
1005 | 21 | import QtWebKit 3.0 | 21 | import com.canonical.Oxide 1.0 |
1004 | 22 | import QtWebKit.experimental 1.0 | ||
1006 | 23 | import Ubuntu.UnityWebApps 0.1 | 22 | import Ubuntu.UnityWebApps 0.1 |
1007 | 24 | 23 | ||
1008 | 25 | Window { | 24 | Window { |
1009 | @@ -33,19 +32,17 @@ | |||
1010 | 33 | width: parent.width | 32 | width: parent.width |
1011 | 34 | height: parent.height | 33 | height: parent.height |
1012 | 35 | 34 | ||
1016 | 36 | experimental.userScripts: [] | 35 | context: WebContext { } |
1014 | 37 | experimental.preferences.navigatorQtObjectEnabled: true | ||
1015 | 38 | experimental.preferences.developerExtrasEnabled: true | ||
1017 | 39 | 36 | ||
1018 | 40 | function getUnityWebappsProxies() { | 37 | function getUnityWebappsProxies() { |
1020 | 41 | return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webView); | 38 | return UnityWebAppsUtils.makeProxiesForWebViewBindee(webView); |
1021 | 42 | } | 39 | } |
1022 | 40 | } | ||
1023 | 43 | 41 | ||
1030 | 44 | UnityWebApps { | 42 | UnityWebApps { |
1031 | 45 | id: webapps | 43 | id: webapps |
1032 | 46 | name: "FacebookMessenger" | 44 | name: "FacebookMessenger" |
1033 | 47 | bindee: webView | 45 | bindee: webView |
1034 | 48 | model: UnityWebappsAppModel { searchPath: '/usr/share/unity-webapps-qml/examples/data/userscripts'} | 46 | model: UnityWebappsAppModel { searchPath: '/usr/share/unity-webapps-qml/examples/data/userscripts'} |
1029 | 49 | } | ||
1035 | 50 | } | 47 | } |
1036 | 51 | } | 48 | } |
1037 | 52 | 49 | ||
1038 | === modified file 'src/Ubuntu/UnityWebApps/UnityWebApps.js' | |||
1039 | --- src/Ubuntu/UnityWebApps/UnityWebApps.js 2014-07-18 13:43:55 +0000 | |||
1040 | +++ src/Ubuntu/UnityWebApps/UnityWebApps.js 2014-11-22 00:43:58 +0000 | |||
1041 | @@ -75,8 +75,7 @@ | |||
1042 | 75 | var cb = this._onMessageReceivedCallback.bind(self); | 75 | var cb = this._onMessageReceivedCallback.bind(self); |
1043 | 76 | self._bindeeProxies.messageReceivedConnect(cb); | 76 | self._bindeeProxies.messageReceivedConnect(cb); |
1044 | 77 | 77 | ||
1047 | 78 | cb = this._onLoadingStartedCallback.bind(self); | 78 | this._onLoadingStartedCallback(); |
1046 | 79 | self._bindeeProxies.loadingStartedConnect(cb); | ||
1048 | 80 | }, | 79 | }, |
1049 | 81 | 80 | ||
1050 | 82 | /** | 81 | /** |
1051 | 83 | 82 | ||
1052 | === modified file 'src/Ubuntu/UnityWebApps/UnityWebApps.qml' | |||
1053 | --- src/Ubuntu/UnityWebApps/UnityWebApps.qml 2014-07-18 21:46:57 +0000 | |||
1054 | +++ src/Ubuntu/UnityWebApps/UnityWebApps.qml 2014-11-22 00:43:58 +0000 | |||
1055 | @@ -168,17 +168,20 @@ | |||
1056 | 168 | property string _opt_homepage: "" | 168 | property string _opt_homepage: "" |
1057 | 169 | 169 | ||
1058 | 170 | 170 | ||
1059 | 171 | /*! | ||
1060 | 172 | \qmlsignal UnityWebApps::userScriptsInjected() | ||
1061 | 173 | |||
1062 | 174 | This signal is emitted when the component has completed its initialization and | ||
1063 | 175 | the userscripts have been injected into the binded webview. | ||
1064 | 176 | */ | ||
1065 | 177 | signal userScriptsInjected() | ||
1066 | 178 | |||
1067 | 179 | |||
1068 | 171 | Settings { | 180 | Settings { |
1069 | 172 | id: settings | 181 | id: settings |
1070 | 173 | injectExtraContentShareCapabilities: name && name.length && name.length !== 0 | 182 | injectExtraContentShareCapabilities: name && name.length && name.length !== 0 |
1071 | 174 | } | 183 | } |
1072 | 175 | 184 | ||
1073 | 176 | /* | ||
1074 | 177 | Loader { | ||
1075 | 178 | id: apiBindingModelComponentLoader | ||
1076 | 179 | sourceComponent: settings.injectExtraUbuntuApis ? apiBindingModelComponent : undefined | ||
1077 | 180 | } | ||
1078 | 181 | */ | ||
1079 | 182 | 185 | ||
1080 | 183 | /*! | 186 | /*! |
1081 | 184 | \internal | 187 | \internal |
1082 | @@ -237,6 +240,8 @@ | |||
1083 | 237 | 240 | ||
1084 | 238 | if (internal.backends) | 241 | if (internal.backends) |
1085 | 239 | internal.instance.setBackends(internal.backends) | 242 | internal.instance.setBackends(internal.backends) |
1086 | 243 | |||
1087 | 244 | userScriptsInjected(); | ||
1088 | 240 | } | 245 | } |
1089 | 241 | 246 | ||
1090 | 242 | /*! | 247 | /*! |
1091 | @@ -392,7 +397,11 @@ | |||
1092 | 392 | \internal | 397 | \internal |
1093 | 393 | 398 | ||
1094 | 394 | */ | 399 | */ |
1096 | 395 | onModelChanged: model.modelContentChanged.connect(__setupNamedWebappEnvironment) | 400 | onModelChanged: { |
1097 | 401 | if (model) { | ||
1098 | 402 | model.modelContentChanged.connect(__setupNamedWebappEnvironment) | ||
1099 | 403 | } | ||
1100 | 404 | } | ||
1101 | 396 | 405 | ||
1102 | 397 | /*! | 406 | /*! |
1103 | 398 | \internal | 407 | \internal |
1104 | 399 | 408 | ||
1105 | === modified file 'src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js' | |||
1106 | --- src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js 2014-10-08 17:16:47 +0000 | |||
1107 | +++ src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js 2014-11-22 00:43:58 +0000 | |||
1108 | @@ -64,7 +64,7 @@ | |||
1109 | 64 | this.disposer = disposer; | 64 | this.disposer = disposer; |
1110 | 65 | this.makeSignalDisconnecter = makeSignalDisconnecter; | 65 | this.makeSignalDisconnecter = makeSignalDisconnecter; |
1111 | 66 | this._userScriptInjected = false; | 66 | this._userScriptInjected = false; |
1113 | 67 | this._WEBAPPS_USER_SCRIPT_CONTEXT = "oxide://UnityWebappsApi"; | 67 | this._WEBAPPS_USER_SCRIPT_CONTEXT = "oxide://main-world"; |
1114 | 68 | } | 68 | } |
1115 | 69 | OxideWebviewAdapter.prototype = { | 69 | OxideWebviewAdapter.prototype = { |
1116 | 70 | injectUserScripts: function(userScriptUrls) { | 70 | injectUserScripts: function(userScriptUrls) { |
1117 | @@ -79,12 +79,19 @@ | |||
1118 | 79 | 79 | ||
1119 | 80 | for (var i = 0; i < userScriptUrls.length; ++i) { | 80 | for (var i = 0; i < userScriptUrls.length; ++i) { |
1120 | 81 | var scriptStart = "import com.canonical.Oxide 1.0 as Oxide; Oxide.UserScript { context:"; | 81 | var scriptStart = "import com.canonical.Oxide 1.0 as Oxide; Oxide.UserScript { context:"; |
1122 | 82 | var scriptEnd = "}"; | 82 | var scriptEnd = " }"; |
1123 | 83 | var statement = scriptStart + | 83 | var statement = scriptStart + |
1126 | 84 | '"' + this._WEBAPPS_USER_SCRIPT_CONTEXT + '"' + | 84 | '"' + |
1127 | 85 | '; matchAllFrames: false; url: "' + userScriptUrls[i] + '";' + scriptEnd; | 85 | this._WEBAPPS_USER_SCRIPT_CONTEXT + |
1128 | 86 | '"' + | ||
1129 | 87 | '; matchAllFrames: false; emulateGreasemonkey: true; url: "' + | ||
1130 | 88 | userScriptUrls[i] + | ||
1131 | 89 | '";' | ||
1132 | 90 | + scriptEnd; | ||
1133 | 91 | |||
1134 | 86 | context.addUserScript(Qt.createQmlObject(statement, this.webview)); | 92 | context.addUserScript(Qt.createQmlObject(statement, this.webview)); |
1135 | 87 | } | 93 | } |
1136 | 94 | |||
1137 | 88 | this._userScriptInjected = true; | 95 | this._userScriptInjected = true; |
1138 | 89 | }, | 96 | }, |
1139 | 90 | sendToPage: function (message) { | 97 | sendToPage: function (message) { |
1140 | 91 | 98 | ||
1141 | === modified file 'src/Ubuntu/UnityWebApps/common/js/unity-backend-messaging-proxy.js' | |||
1142 | --- src/Ubuntu/UnityWebApps/common/js/unity-backend-messaging-proxy.js 2014-03-28 13:21:47 +0000 | |||
1143 | +++ src/Ubuntu/UnityWebApps/common/js/unity-backend-messaging-proxy.js 2014-11-22 00:43:58 +0000 | |||
1144 | @@ -4,7 +4,7 @@ | |||
1145 | 4 | navigator.qt.postMessage) { | 4 | navigator.qt.postMessage) { |
1146 | 5 | return new UnityQtWebkitBackendMessagingProxy(); | 5 | return new UnityQtWebkitBackendMessagingProxy(); |
1147 | 6 | } | 6 | } |
1149 | 7 | else if (window.oxide) { | 7 | else if (oxide) { |
1150 | 8 | return new UnityOxideBackendMessagingProxy(); | 8 | return new UnityOxideBackendMessagingProxy(); |
1151 | 9 | } | 9 | } |
1152 | 10 | return null; | 10 | return null; |
1153 | 11 | 11 | ||
1154 | === modified file 'src/Ubuntu/UnityWebApps/unity-webapps-api.js.in' | |||
1155 | --- src/Ubuntu/UnityWebApps/unity-webapps-api.js.in 2014-06-04 21:17:00 +0000 | |||
1156 | +++ src/Ubuntu/UnityWebApps/unity-webapps-api.js.in 2014-11-22 00:43:58 +0000 | |||
1157 | @@ -1,3 +1,7 @@ | |||
1158 | 1 | // ==UserScript== | ||
1159 | 2 | // @inject_in_main_world | ||
1160 | 3 | // ==/UserScript== | ||
1161 | 4 | |||
1162 | 1 | /* | 5 | /* |
1163 | 2 | * Copyright 2013 Canonical Ltd. | 6 | * Copyright 2013 Canonical Ltd. |
1164 | 3 | * | 7 | * |
1165 | 4 | 8 | ||
1166 | === modified file 'tests/autopilot/autopilot.pro' | |||
1167 | --- tests/autopilot/autopilot.pro 2014-07-14 19:04:25 +0000 | |||
1168 | +++ tests/autopilot/autopilot.pro 2014-11-22 00:43:58 +0000 | |||
1169 | @@ -20,7 +20,6 @@ | |||
1170 | 20 | $$system(ls ./data/*/*) \ | 20 | $$system(ls ./data/*/*) \ |
1171 | 21 | unity_webapps_qml/tests/test_installedWebapp.py \ | 21 | unity_webapps_qml/tests/test_installedWebapp.py \ |
1172 | 22 | unity_webapps_qml/tests/fake_servers.py \ | 22 | unity_webapps_qml/tests/fake_servers.py \ |
1173 | 23 | qml/WebviewBackendWebkit.qml \ | ||
1174 | 24 | qml/WebviewBackendOxide.qml \ | 23 | qml/WebviewBackendOxide.qml \ |
1175 | 25 | qml/message-server.js \ | 24 | qml/message-server.js \ |
1176 | 26 | $$system(ls ./data/installed-webapps/*) \ | 25 | $$system(ls ./data/installed-webapps/*) \ |
1177 | 27 | 26 | ||
1178 | === modified file 'tests/autopilot/qml/FullWebViewApp.qml' | |||
1179 | --- tests/autopilot/qml/FullWebViewApp.qml 2014-07-18 21:46:57 +0000 | |||
1180 | +++ tests/autopilot/qml/FullWebViewApp.qml 2014-11-22 00:43:58 +0000 | |||
1181 | @@ -35,21 +35,9 @@ | |||
1182 | 35 | signal resultUpdated(string message) | 35 | signal resultUpdated(string message) |
1183 | 36 | 36 | ||
1184 | 37 | function evalInPageUnsafe(expr) { | 37 | function evalInPageUnsafe(expr) { |
1195 | 38 | if (webView && webView.experimental) { | 38 | return webView.evaluateCode(expr, true); |
1186 | 39 | webView.experimental.evaluateJavaScript(DomIntrospectionUtils.wrapJsCommands(expr), | ||
1187 | 40 | function(result) { | ||
1188 | 41 | console.log('Result: ' + result); | ||
1189 | 42 | root.resultUpdated(DomIntrospectionUtils.createResult(result)); | ||
1190 | 43 | }); | ||
1191 | 44 | } | ||
1192 | 45 | else { | ||
1193 | 46 | root.resultUpdated(DomIntrospectionUtils.createResult(webView.evaluateCode("return navigator.userAgent", true))) | ||
1194 | 47 | } | ||
1196 | 48 | } | 39 | } |
1197 | 49 | 40 | ||
1198 | 50 | property var webView: null | ||
1199 | 51 | |||
1200 | 52 | property bool useOxide: false | ||
1201 | 53 | property string url: "" | 41 | property string url: "" |
1202 | 54 | 42 | ||
1203 | 55 | property string apiBackendQmlFileUrl: "" | 43 | property string apiBackendQmlFileUrl: "" |
1204 | @@ -67,24 +55,14 @@ | |||
1205 | 67 | active: true | 55 | active: true |
1206 | 68 | } | 56 | } |
1207 | 69 | 57 | ||
1226 | 70 | Loader { | 58 | WebviewBackendOxide { |
1227 | 71 | id: webviewLoader | 59 | id: webView |
1228 | 72 | onLoaded: { | 60 | url: root.url |
1229 | 73 | webView = webviewLoader.item | 61 | localUserAgentOverride: webappName && webappModel.exists(webappName) |
1230 | 74 | } | 62 | ? webappModel.userAgentOverrideFor(webappName) : "" |
1231 | 75 | } | 63 | } |
1232 | 76 | 64 | ||
1233 | 77 | Component.onCompleted: { | 65 | // Offers a way to override/mock the API backends |
1216 | 78 | var webviewSource = useOxide ? | ||
1217 | 79 | Qt.resolvedUrl("WebviewBackendOxide.qml") | ||
1218 | 80 | : Qt.resolvedUrl("WebviewBackendWebkit.qml"); | ||
1219 | 81 | var override = webappName && webappModel.exists(webappName) ? | ||
1220 | 82 | webappModel.userAgentOverrideFor(webappName) : "" | ||
1221 | 83 | webviewLoader.setSource(webviewSource, | ||
1222 | 84 | { url: root.url, | ||
1223 | 85 | localUserAgentOverride: override}) | ||
1224 | 86 | } | ||
1225 | 87 | |||
1234 | 88 | Loader { | 66 | Loader { |
1235 | 89 | id: apiBackendQmlFileLoader | 67 | id: apiBackendQmlFileLoader |
1236 | 90 | source: apiBackendQmlFileUrl.length !== 0 ? apiBackendQmlFileUrl : "" | 68 | source: apiBackendQmlFileUrl.length !== 0 ? apiBackendQmlFileUrl : "" |
1237 | @@ -93,10 +71,9 @@ | |||
1238 | 93 | Loader { | 71 | Loader { |
1239 | 94 | id: unityWebappsComponentLoader | 72 | id: unityWebappsComponentLoader |
1240 | 95 | anchors.fill: parent | 73 | anchors.fill: parent |
1245 | 96 | sourceComponent: webView !== null ? | 74 | sourceComponent: (apiBackendQmlFileUrl.length !== 0 |
1246 | 97 | (apiBackendQmlFileUrl.length !== 0 ? | 75 | && !apiBackendQmlFileLoader.item) |
1247 | 98 | (apiBackendQmlFileLoader.item ? unityWebappsComponent : undefined) | 76 | ? undefined : unityWebappsComponent |
1244 | 99 | : unityWebappsComponent) : null | ||
1248 | 100 | } | 77 | } |
1249 | 101 | 78 | ||
1250 | 102 | UnityWebappsAppModel { | 79 | UnityWebappsAppModel { |
1251 | 103 | 80 | ||
1252 | === modified file 'tests/autopilot/qml/WebviewBackendOxide.qml' | |||
1253 | --- tests/autopilot/qml/WebviewBackendOxide.qml 2014-07-16 20:15:17 +0000 | |||
1254 | +++ tests/autopilot/qml/WebviewBackendOxide.qml 2014-11-22 00:43:58 +0000 | |||
1255 | @@ -9,6 +9,9 @@ | |||
1256 | 9 | 9 | ||
1257 | 10 | property string localUserAgentOverride: "" | 10 | property string localUserAgentOverride: "" |
1258 | 11 | 11 | ||
1259 | 12 | preferences.localStorageEnabled: true | ||
1260 | 13 | preferences.appCacheEnabled: true | ||
1261 | 14 | |||
1262 | 12 | function _waitForResult(req, timeout) { | 15 | function _waitForResult(req, timeout) { |
1263 | 13 | var result; | 16 | var result; |
1264 | 14 | var error; | 17 | var error; |
1265 | @@ -46,7 +49,7 @@ | |||
1266 | 46 | function evaluateCode(code, wrap) { | 49 | function evaluateCode(code, wrap) { |
1267 | 47 | var value = webView._waitForResult( | 50 | var value = webView._waitForResult( |
1268 | 48 | webView.rootFrame.sendMessage( | 51 | webView.rootFrame.sendMessage( |
1270 | 49 | "webview-oxide://test/", | 52 | "oxide://main-world", |
1271 | 50 | "EVALUATE-CODE", | 53 | "EVALUATE-CODE", |
1272 | 51 | { code: code, | 54 | { code: code, |
1273 | 52 | wrap: wrap === undefined ? false : wrap })); | 55 | wrap: wrap === undefined ? false : wrap })); |
1274 | @@ -54,10 +57,12 @@ | |||
1275 | 54 | } | 57 | } |
1276 | 55 | 58 | ||
1277 | 56 | context: Oxide.WebContext { | 59 | context: Oxide.WebContext { |
1279 | 57 | userAgent: webView.localUserAgentOverride.length === 0 ? "" : webView.localUserAgentOverride | 60 | userAgent: webView.localUserAgentOverride.length === 0 |
1280 | 61 | ? "" : webView.localUserAgentOverride | ||
1281 | 58 | userScripts: [ | 62 | userScripts: [ |
1282 | 59 | Oxide.UserScript { | 63 | Oxide.UserScript { |
1284 | 60 | context: "webview-oxide://test/" | 64 | context: "oxide://main-world" |
1285 | 65 | emulateGreasemonkey: true | ||
1286 | 61 | url: Qt.resolvedUrl("message-server.js") | 66 | url: Qt.resolvedUrl("message-server.js") |
1287 | 62 | matchAllFrames: true | 67 | matchAllFrames: true |
1288 | 63 | } | 68 | } |
1289 | 64 | 69 | ||
1290 | === removed file 'tests/autopilot/qml/WebviewBackendWebkit.qml' | |||
1291 | --- tests/autopilot/qml/WebviewBackendWebkit.qml 2014-07-08 19:27:21 +0000 | |||
1292 | +++ tests/autopilot/qml/WebviewBackendWebkit.qml 1970-01-01 00:00:00 +0000 | |||
1293 | @@ -1,19 +0,0 @@ | |||
1294 | 1 | import QtQuick 2.0 | ||
1295 | 2 | import QtWebKit 3.0 | ||
1296 | 3 | import QtWebKit.experimental 1.0 | ||
1297 | 4 | import Ubuntu.UnityWebApps 0.1 | ||
1298 | 5 | |||
1299 | 6 | WebView { | ||
1300 | 7 | id: webView | ||
1301 | 8 | objectName: "webview" | ||
1302 | 9 | |||
1303 | 10 | property string localUserAgentOverride: "" | ||
1304 | 11 | |||
1305 | 12 | experimental.userScripts: [] | ||
1306 | 13 | experimental.preferences.navigatorQtObjectEnabled: true | ||
1307 | 14 | experimental.preferences.developerExtrasEnabled: true | ||
1308 | 15 | |||
1309 | 16 | function getUnityWebappsProxies() { | ||
1310 | 17 | return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webView); | ||
1311 | 18 | } | ||
1312 | 19 | } | ||
1313 | 20 | 0 | ||
1314 | === modified file 'tests/autopilot/unity_webapps_qml/tests/__init__.py' | |||
1315 | --- tests/autopilot/unity_webapps_qml/tests/__init__.py 2014-07-14 19:01:17 +0000 | |||
1316 | +++ tests/autopilot/unity_webapps_qml/tests/__init__.py 2014-11-22 00:43:58 +0000 | |||
1317 | @@ -9,29 +9,31 @@ | |||
1318 | 9 | 9 | ||
1319 | 10 | import os | 10 | import os |
1320 | 11 | import os.path | 11 | import os.path |
1321 | 12 | import shutil | ||
1322 | 13 | import tempfile | ||
1323 | 14 | import json | ||
1324 | 15 | 12 | ||
1326 | 16 | from testtools.matchers import Contains, Equals, GreaterThan | 13 | from testtools.matchers import Equals |
1327 | 17 | from autopilot.matchers import Eventually | 14 | from autopilot.matchers import Eventually |
1328 | 18 | from unity_webapps_qml.tests import fake_servers | 15 | from unity_webapps_qml.tests import fake_servers |
1329 | 19 | 16 | ||
1335 | 20 | from unity.emulators.unity import Unity | 17 | from autopilot.testcase import AutopilotTestCase |
1336 | 21 | 18 | ||
1337 | 22 | from unity.tests import UnityTestCase | 19 | LOCAL_QML_LAUNCHER_APP_PATH = "{}/{}".format( |
1338 | 23 | 20 | os.path.dirname(os.path.realpath(__file__)), | |
1339 | 24 | LOCAL_QML_LAUNCHER_APP_PATH = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), '../../../../tools/qml-launcher/unity-webapps-qml-launcher') | 21 | '../../../../tools/qml-launcher/unity-webapps-qml-launcher') |
1340 | 22 | |||
1341 | 25 | INSTALLED_QML_LAUNCHER_APP_PATH = 'unity-webapps-qml-launcher' | 23 | INSTALLED_QML_LAUNCHER_APP_PATH = 'unity-webapps-qml-launcher' |
1342 | 26 | 24 | ||
1343 | 27 | # TODO create __init__.py.in | 25 | # TODO create __init__.py.in |
1346 | 28 | LOCAL_BROWSER_CONTAINER_PATH = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), '../../qml/FullWebViewApp.qml') | 26 | LOCAL_BROWSER_CONTAINER_PATH = "{}/{}".format( |
1347 | 29 | INSTALLED_BROWSER_CONTAINER_PATH = '/usr/share/unity-webapps-qml/autopilot-tests/qml/FullWebViewApp.qml' | 27 | os.path.dirname(os.path.realpath(__file__)), |
1348 | 28 | '../../qml/FullWebViewApp.qml') | ||
1349 | 29 | |||
1350 | 30 | INSTALLED_BROWSER_CONTAINER_PATH = \ | ||
1351 | 31 | '/usr/share/unity-webapps-qml/autopilot-tests/qml/FullWebViewApp.qml' | ||
1352 | 30 | 32 | ||
1353 | 31 | BASE_URL = '' | 33 | BASE_URL = '' |
1354 | 32 | 34 | ||
1355 | 33 | class UnityWebappsTestCaseBase(UnityTestCase): | ||
1356 | 34 | 35 | ||
1357 | 36 | class UnityWebappsTestCaseBase(AutopilotTestCase): | ||
1358 | 35 | def setUp(self): | 37 | def setUp(self): |
1359 | 36 | super(UnityWebappsTestCaseBase, self).setUp() | 38 | super(UnityWebappsTestCaseBase, self).setUp() |
1360 | 37 | self.use_oxide = False | 39 | self.use_oxide = False |
1361 | @@ -52,17 +54,18 @@ | |||
1362 | 52 | return LOCAL_QML_LAUNCHER_APP_PATH | 54 | return LOCAL_QML_LAUNCHER_APP_PATH |
1363 | 53 | return INSTALLED_QML_LAUNCHER_APP_PATH | 55 | return INSTALLED_QML_LAUNCHER_APP_PATH |
1364 | 54 | 56 | ||
1372 | 55 | def get_launch_params(self, | 57 | def get_launch_params( |
1373 | 56 | url, | 58 | self, |
1374 | 57 | webapp_name='unitywebappsqmllauncher', | 59 | url, |
1375 | 58 | webapp_search_path="", | 60 | webapp_name='unitywebappsqmllauncher', |
1376 | 59 | webapp_homepage="", | 61 | webapp_search_path="", |
1377 | 60 | use_oxide=False, | 62 | webapp_homepage="", |
1378 | 61 | extra_params=[]): | 63 | use_oxide=False, |
1379 | 64 | extra_params=[]): | ||
1380 | 62 | base_params = ['--qml=' + self.get_qml_browser_container_path(), | 65 | base_params = ['--qml=' + self.get_qml_browser_container_path(), |
1384 | 63 | '--app-id=' + webapp_name, | 66 | '--app-id=' + webapp_name, |
1385 | 64 | '--webappName=' + webapp_name, | 67 | '--webappName=' + webapp_name, |
1386 | 65 | '--webappSearchPath=' + webapp_search_path] | 68 | '--webappSearchPath=' + webapp_search_path] |
1387 | 66 | 69 | ||
1388 | 67 | if len(webapp_homepage) != 0: | 70 | if len(webapp_homepage) != 0: |
1389 | 68 | base_params.append('--webappHomepage=' + webapp_homepage) | 71 | base_params.append('--webappHomepage=' + webapp_homepage) |
1390 | @@ -75,8 +78,10 @@ | |||
1391 | 75 | 78 | ||
1392 | 76 | if os.path.exists(LOCAL_QML_LAUNCHER_APP_PATH): | 79 | if os.path.exists(LOCAL_QML_LAUNCHER_APP_PATH): |
1393 | 77 | # we are local | 80 | # we are local |
1396 | 78 | base_params.append('--import=' + os.path.join (os.path.dirname(os.path.realpath(__file__)), | 81 | base_params.append( |
1397 | 79 | '../../../../src')) | 82 | '--import={}'.format( |
1398 | 83 | os.path.join(os.path.dirname(os.path.realpath(__file__))), | ||
1399 | 84 | '../../../../src')) | ||
1400 | 80 | 85 | ||
1401 | 81 | base_params += extra_params | 86 | base_params += extra_params |
1402 | 82 | 87 | ||
1403 | @@ -86,18 +91,25 @@ | |||
1404 | 86 | self.assertThat(os.path.exists(html_filepath), Equals(True)) | 91 | self.assertThat(os.path.exists(html_filepath), Equals(True)) |
1405 | 87 | url = self.create_file_url(html_filepath) | 92 | url = self.create_file_url(html_filepath) |
1406 | 88 | 93 | ||
1408 | 89 | self.launch_application(self.get_launch_params(url, 'unitywebappsqmllauncher', '', '', False, extra_params)) | 94 | self.launch_application( |
1409 | 95 | self.get_launch_params( | ||
1410 | 96 | url, | ||
1411 | 97 | 'unitywebappsqmllauncher', | ||
1412 | 98 | '', | ||
1413 | 99 | '', | ||
1414 | 100 | False, | ||
1415 | 101 | extra_params)) | ||
1416 | 90 | self.assert_url_eventually_loaded(url) | 102 | self.assert_url_eventually_loaded(url) |
1417 | 91 | 103 | ||
1418 | 92 | def launch_application(self, args): | 104 | def launch_application(self, args): |
1422 | 93 | print 'Launching test with params:', args, "with", self.get_qml_launcher_path() | 105 | self.app = self.launch_test_application( |
1423 | 94 | 106 | self.get_qml_launcher_path(), | |
1421 | 95 | self.app = self.launch_test_application(self.get_qml_launcher_path(), | ||
1424 | 96 | *args, | 107 | *args, |
1425 | 97 | app_type='qt') | 108 | app_type='qt') |
1426 | 98 | 109 | ||
1427 | 99 | self.webviewContainer = self.get_webviewContainer() | 110 | self.webviewContainer = self.get_webviewContainer() |
1429 | 100 | self.watcher = self.webviewContainer.watch_signal('resultUpdated(QString)') | 111 | self.watcher = self.webviewContainer.watch_signal( |
1430 | 112 | 'resultUpdated(QString)') | ||
1431 | 101 | 113 | ||
1432 | 102 | def pick_app_launcher(self, app_path): | 114 | def pick_app_launcher(self, app_path): |
1433 | 103 | # force Qt app introspection: | 115 | # force Qt app introspection: |
1434 | @@ -121,11 +133,8 @@ | |||
1435 | 121 | 133 | ||
1436 | 122 | def eval_expression_in_page_unsafe(self, expr): | 134 | def eval_expression_in_page_unsafe(self, expr): |
1437 | 123 | webview = self.get_webviewContainer() | 135 | webview = self.get_webviewContainer() |
1443 | 124 | prev_emissions = self.watcher.num_emissions | 136 | return webview.slots.evalInPageUnsafe(expr) |
1444 | 125 | webview.slots.evalInPageUnsafe(expr) | 137 | |
1440 | 126 | self.assertThat(lambda: self.watcher.num_emissions, Eventually(GreaterThan(prev_emissions))) | ||
1441 | 127 | results = json.loads(webview.get_signal_emissions('resultUpdated(QString)')[-1][0]) | ||
1442 | 128 | return results.has_key('result') and results['result'] or None | ||
1445 | 129 | 138 | ||
1446 | 130 | class WebappsTestCaseBaseWithLocalHttpContentBase(UnityWebappsTestCaseBase): | 139 | class WebappsTestCaseBaseWithLocalHttpContentBase(UnityWebappsTestCaseBase): |
1447 | 131 | def setUp(self): | 140 | def setUp(self): |
1448 | @@ -136,5 +145,11 @@ | |||
1449 | 136 | 145 | ||
1450 | 137 | def launch_with_webapp(self, name, webapp_search_path, use_oxide=False): | 146 | def launch_with_webapp(self, name, webapp_search_path, use_oxide=False): |
1451 | 138 | self.use_oxide = use_oxide | 147 | self.use_oxide = use_oxide |
1453 | 139 | self.launch_application(self.get_launch_params("", name, webapp_search_path, self.base_url, use_oxide)) | 148 | self.launch_application( |
1454 | 149 | self.get_launch_params( | ||
1455 | 150 | "", | ||
1456 | 151 | name, | ||
1457 | 152 | webapp_search_path, | ||
1458 | 153 | self.base_url, | ||
1459 | 154 | use_oxide)) | ||
1460 | 140 | self.assert_url_eventually_loaded(self.base_url) | 155 | self.assert_url_eventually_loaded(self.base_url) |
1461 | 141 | 156 | ||
1462 | === modified file 'tests/autopilot/unity_webapps_qml/tests/fake_servers.py' | |||
1463 | --- tests/autopilot/unity_webapps_qml/tests/fake_servers.py 2014-07-08 19:27:21 +0000 | |||
1464 | +++ tests/autopilot/unity_webapps_qml/tests/fake_servers.py 2014-11-22 00:43:58 +0000 | |||
1465 | @@ -15,12 +15,12 @@ | |||
1466 | 15 | 15 | ||
1467 | 16 | """ Autopilot tests for the unity_webapps_qml package """ | 16 | """ Autopilot tests for the unity_webapps_qml package """ |
1468 | 17 | 17 | ||
1470 | 18 | import BaseHTTPServer | 18 | import http.server as http |
1471 | 19 | import logging | 19 | import logging |
1472 | 20 | import threading | 20 | import threading |
1473 | 21 | 21 | ||
1474 | 22 | 22 | ||
1476 | 23 | class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): | 23 | class RequestHandler(http.BaseHTTPRequestHandler): |
1477 | 24 | def serve_content(self, content, mime_type='text/html'): | 24 | def serve_content(self, content, mime_type='text/html'): |
1478 | 25 | self.send_header('Content-type', mime_type) | 25 | self.send_header('Content-type', mime_type) |
1479 | 26 | self.end_headers() | 26 | self.end_headers() |
1480 | @@ -51,7 +51,7 @@ | |||
1481 | 51 | class WebappsQmlContentHttpServer(object): | 51 | class WebappsQmlContentHttpServer(object): |
1482 | 52 | def __init__(self): | 52 | def __init__(self): |
1483 | 53 | super(WebappsQmlContentHttpServer, self).__init__() | 53 | super(WebappsQmlContentHttpServer, self).__init__() |
1485 | 54 | self.server = BaseHTTPServer.HTTPServer(("", 0), RequestHandler) | 54 | self.server = http.HTTPServer(("", 0), RequestHandler) |
1486 | 55 | self.server.allow_reuse_address = True | 55 | self.server.allow_reuse_address = True |
1487 | 56 | self.server_thread = threading.Thread(target=self.server.serve_forever) | 56 | self.server_thread = threading.Thread(target=self.server.serve_forever) |
1488 | 57 | self.server_thread.start() | 57 | self.server_thread.start() |
1489 | 58 | 58 | ||
1490 | === modified file 'tests/autopilot/unity_webapps_qml/tests/test_callbackDispatch.py' | |||
1491 | --- tests/autopilot/unity_webapps_qml/tests/test_callbackDispatch.py 2014-07-11 17:13:18 +0000 | |||
1492 | +++ tests/autopilot/unity_webapps_qml/tests/test_callbackDispatch.py 2014-11-22 00:43:58 +0000 | |||
1493 | @@ -7,22 +7,37 @@ | |||
1494 | 7 | 7 | ||
1495 | 8 | from __future__ import absolute_import | 8 | from __future__ import absolute_import |
1496 | 9 | 9 | ||
1497 | 10 | import time | ||
1498 | 11 | import os | 10 | import os |
1499 | 12 | 11 | ||
1501 | 13 | from testtools.matchers import Equals, GreaterThan, NotEquals | 12 | from testtools.matchers import Equals |
1502 | 14 | from autopilot.matchers import Eventually | 13 | from autopilot.matchers import Eventually |
1503 | 15 | 14 | ||
1504 | 16 | from unity_webapps_qml.tests import UnityWebappsTestCaseBase | 15 | from unity_webapps_qml.tests import UnityWebappsTestCaseBase |
1505 | 17 | 16 | ||
1514 | 18 | LOCAL_HTML_TEST_FILE = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), '../../html/test_webapps_callback_dispatch.html') | 17 | LOCAL_HTML_TEST_FILE = "{}/{}".format( |
1515 | 19 | INSTALLED_HTML_TEST_FILE = '/usr/share/unity-webapps-qml/autopilot-tests/html/test_webapps_callback_dispatch.html' | 18 | os.path.dirname(os.path.realpath(__file__)), |
1516 | 20 | 19 | '../../html/test_webapps_callback_dispatch.html') | |
1517 | 21 | LOCAL_JS_TEST_FILE = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), '../../html/test_webapps_callback_dispatch_api.js') | 20 | |
1518 | 22 | INSTALLED_JS_TEST_FILE = '/usr/share/unity-webapps-qml/autopilot-tests/html/test_webapps_callback_dispatch_api.js' | 21 | INSTALLED_HTML_TEST_FILE = \ |
1519 | 23 | 22 | '/usr/share/unity-webapps-qml/autopilot-tests/' \ | |
1520 | 24 | LOCAL_QML_BACKEND_TEST_FILE = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), '../../qml/test_webapps_callback_dispatch_api.qml') | 23 | 'html/test_webapps_callback_dispatch.html' |
1521 | 25 | INSTALLED_QML_BACKEND_TEST_FILE = '/usr/share/unity-webapps-qml/autopilot-tests/qml/test_webapps_callback_dispatch_api.qml' | 24 | |
1522 | 25 | LOCAL_JS_TEST_FILE = "{}/{}".format( | ||
1523 | 26 | os.path.dirname(os.path.realpath(__file__)), | ||
1524 | 27 | '../../html/test_webapps_callback_dispatch_api.js') | ||
1525 | 28 | |||
1526 | 29 | INSTALLED_JS_TEST_FILE = \ | ||
1527 | 30 | '/usr/share/unity-webapps-qml/autopilot-tests/' \ | ||
1528 | 31 | 'html/test_webapps_callback_dispatch_api.js' | ||
1529 | 32 | |||
1530 | 33 | LOCAL_QML_BACKEND_TEST_FILE = "{}/{}".format( | ||
1531 | 34 | os.path.dirname(os.path.realpath(__file__)), | ||
1532 | 35 | '../../qml/test_webapps_callback_dispatch_api.qml') | ||
1533 | 36 | |||
1534 | 37 | INSTALLED_QML_BACKEND_TEST_FILE = \ | ||
1535 | 38 | '/usr/share/unity-webapps-qml/autopilot-tests/' \ | ||
1536 | 39 | 'qml/test_webapps_callback_dispatch_api.qml' | ||
1537 | 40 | |||
1538 | 26 | 41 | ||
1539 | 27 | class WebappsCallbackDispatchTestCaseBase(UnityWebappsTestCaseBase): | 42 | class WebappsCallbackDispatchTestCaseBase(UnityWebappsTestCaseBase): |
1540 | 28 | def setUp(self): | 43 | def setUp(self): |
1541 | @@ -43,7 +58,6 @@ | |||
1542 | 43 | return INSTALLED_JS_TEST_FILE | 58 | return INSTALLED_JS_TEST_FILE |
1543 | 44 | 59 | ||
1544 | 45 | def get_qml_test_file(self): | 60 | def get_qml_test_file(self): |
1545 | 46 | print LOCAL_QML_BACKEND_TEST_FILE | ||
1546 | 47 | if os.path.exists(LOCAL_QML_BACKEND_TEST_FILE): | 61 | if os.path.exists(LOCAL_QML_BACKEND_TEST_FILE): |
1547 | 48 | return os.path.abspath(LOCAL_QML_BACKEND_TEST_FILE) | 62 | return os.path.abspath(LOCAL_QML_BACKEND_TEST_FILE) |
1548 | 49 | return INSTALLED_QML_BACKEND_TEST_FILE | 63 | return INSTALLED_QML_BACKEND_TEST_FILE |
1549 | @@ -55,6 +69,6 @@ | |||
1550 | 55 | Eventually(Equals(True))) | 69 | Eventually(Equals(True))) |
1551 | 56 | 70 | ||
1552 | 57 | self.assertThat( | 71 | self.assertThat( |
1554 | 58 | lambda: self.eval_expression_in_page_unsafe("return document.getElementById('content').innerHTML;"), | 72 | lambda: self.eval_expression_in_page_unsafe( |
1555 | 73 | "return document.getElementById('content').innerHTML;"), | ||
1556 | 59 | Eventually(Equals('callback-loop-count-reached'))) | 74 | Eventually(Equals('callback-loop-count-reached'))) |
1557 | 60 | |||
1558 | 61 | 75 | ||
1559 | === removed file 'tests/autopilot/unity_webapps_qml/tests/test_hud.py' | |||
1560 | --- tests/autopilot/unity_webapps_qml/tests/test_hud.py 2014-04-22 15:40:04 +0000 | |||
1561 | +++ tests/autopilot/unity_webapps_qml/tests/test_hud.py 1970-01-01 00:00:00 +0000 | |||
1562 | @@ -1,81 +0,0 @@ | |||
1563 | 1 | #!/usr/bin/env python | ||
1564 | 2 | # Copyright 2013 Canonical | ||
1565 | 3 | # | ||
1566 | 4 | # This program is free software: you can redistribute it and/or modify it | ||
1567 | 5 | # under the terms of the GNU General Public License version 3, as published | ||
1568 | 6 | # by the Free Software Foundation. | ||
1569 | 7 | |||
1570 | 8 | import os | ||
1571 | 9 | import time | ||
1572 | 10 | |||
1573 | 11 | from testtools.matchers import Equals, GreaterThan, NotEquals | ||
1574 | 12 | from autopilot.matchers import Eventually | ||
1575 | 13 | |||
1576 | 14 | from autopilot import platform | ||
1577 | 15 | |||
1578 | 16 | from unity.emulators.icons import HudLauncherIcon | ||
1579 | 17 | from unity.emulators import ensure_unity_is_running | ||
1580 | 18 | |||
1581 | 19 | from unity_webapps_qml.tests import UnityWebappsTestCaseBase | ||
1582 | 20 | |||
1583 | 21 | class UnityWebappsHudTestCase(UnityWebappsTestCaseBase): | ||
1584 | 22 | LOCAL_HTML_TEST_FILE = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), '../../html/test_webapps_hud.html') | ||
1585 | 23 | INSTALLED_HTML_TEST_FILE = '/usr/share/unity-webapps-qml/autopilot-tests/html/test_webapps_hud.html' | ||
1586 | 24 | |||
1587 | 25 | def get_html_test_file(self): | ||
1588 | 26 | if os.path.exists(self.LOCAL_HTML_TEST_FILE): | ||
1589 | 27 | return os.path.abspath(self.LOCAL_HTML_TEST_FILE) | ||
1590 | 28 | return self.INSTALLED_HTML_TEST_FILE | ||
1591 | 29 | |||
1592 | 30 | def setUp(self): | ||
1593 | 31 | super(UnityWebappsHudTestCase, self).setUp() | ||
1594 | 32 | # On Touch the dbus unity if does is not exposed | ||
1595 | 33 | if platform.model() == 'Desktop': | ||
1596 | 34 | ensure_unity_is_running() | ||
1597 | 35 | self.launch_with_html_filepath(self.get_html_test_file()) | ||
1598 | 36 | |||
1599 | 37 | def test_addAction(self): | ||
1600 | 38 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('status').innerHTML;"), Eventually(Equals('actionadded'))) | ||
1601 | 39 | |||
1602 | 40 | self.unity.hud.ensure_visible() | ||
1603 | 41 | self.addCleanup(self.unity.hud.ensure_hidden) | ||
1604 | 42 | |||
1605 | 43 | self.keyboard.type("Hello") | ||
1606 | 44 | self.keyboard.press_and_release("Enter") | ||
1607 | 45 | |||
1608 | 46 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('content').style.display;"), Eventually(Equals('none'))) | ||
1609 | 47 | |||
1610 | 48 | def test_clearAction(self): | ||
1611 | 49 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('status').innerHTML;"), Eventually(Equals('actionadded'))) | ||
1612 | 50 | expr = """ | ||
1613 | 51 | var e = new CustomEvent ("unity-webapps-do-call", {"detail": JSON.stringify({"name": 'clearAction', 'args': ['Hello']})}); | ||
1614 | 52 | document.dispatchEvent (e); | ||
1615 | 53 | return true; | ||
1616 | 54 | """ | ||
1617 | 55 | self.eval_expression_in_page_unsafe(expr) | ||
1618 | 56 | |||
1619 | 57 | self.unity.hud.ensure_visible() | ||
1620 | 58 | self.addCleanup(self.unity.hud.ensure_hidden) | ||
1621 | 59 | |||
1622 | 60 | self.keyboard.type("Hello") | ||
1623 | 61 | self.keyboard.press_and_release("Enter") | ||
1624 | 62 | self.assertThat(self.eval_expression_in_page_unsafe("return document.getElementById('content').style.display;"), NotEquals('none')) | ||
1625 | 63 | |||
1626 | 64 | def test_clearActions(self): | ||
1627 | 65 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('status').innerHTML;"), Eventually(Equals('actionadded'))) | ||
1628 | 66 | expr = """ | ||
1629 | 67 | var e = new CustomEvent ("unity-webapps-do-call", {"detail": JSON.stringify({"name": 'clearActions', 'args': []})}); | ||
1630 | 68 | document.dispatchEvent (e); | ||
1631 | 69 | return true; | ||
1632 | 70 | """ | ||
1633 | 71 | |||
1634 | 72 | self.eval_expression_in_page_unsafe(expr) | ||
1635 | 73 | |||
1636 | 74 | actions = ['Hello', 'Another action'] | ||
1637 | 75 | for action in actions: | ||
1638 | 76 | self.unity.hud.ensure_visible() | ||
1639 | 77 | self.addCleanup(self.unity.hud.ensure_hidden) | ||
1640 | 78 | self.keyboard.type(action) | ||
1641 | 79 | self.keyboard.press_and_release("Enter") | ||
1642 | 80 | |||
1643 | 81 | self.assertThat(self.eval_expression_in_page_unsafe("return document.getElementById('content').style.display;"), NotEquals('none')) | ||
1644 | 82 | 0 | ||
1645 | === modified file 'tests/autopilot/unity_webapps_qml/tests/test_injectedOnWebapp.py' | |||
1646 | --- tests/autopilot/unity_webapps_qml/tests/test_injectedOnWebapp.py 2014-04-22 15:40:04 +0000 | |||
1647 | +++ tests/autopilot/unity_webapps_qml/tests/test_injectedOnWebapp.py 2014-11-22 00:43:58 +0000 | |||
1648 | @@ -7,51 +7,74 @@ | |||
1649 | 7 | 7 | ||
1650 | 8 | from __future__ import absolute_import | 8 | from __future__ import absolute_import |
1651 | 9 | 9 | ||
1652 | 10 | import time | ||
1653 | 11 | import os | 10 | import os |
1654 | 12 | 11 | ||
1656 | 13 | from testtools.matchers import Equals, GreaterThan, NotEquals | 12 | from testtools.matchers import Equals |
1657 | 14 | from autopilot.matchers import Eventually | 13 | from autopilot.matchers import Eventually |
1658 | 15 | 14 | ||
1659 | 16 | from unity_webapps_qml.tests import UnityWebappsTestCaseBase | 15 | from unity_webapps_qml.tests import UnityWebappsTestCaseBase |
1660 | 17 | 16 | ||
1661 | 17 | LOCAL_HTML_TEST_FILE = "{}/{}".format( | ||
1662 | 18 | os.path.dirname(os.path.realpath(__file__)), | ||
1663 | 19 | '../../html/test_webapps_api_injected.html') | ||
1664 | 20 | |||
1665 | 21 | INSTALLED_HTML_TEST_FILE = \ | ||
1666 | 22 | '/usr/share/unity-webapps-qml/' \ | ||
1667 | 23 | 'autopilot-tests/html/test_webapps_api_injected.html' | ||
1668 | 24 | |||
1669 | 25 | |||
1670 | 18 | class UnityWebappsApiInjectedTestCaseBase(UnityWebappsTestCaseBase): | 26 | class UnityWebappsApiInjectedTestCaseBase(UnityWebappsTestCaseBase): |
1671 | 19 | LOCAL_HTML_TEST_FILE = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), '../../html/test_webapps_api_injected.html') | ||
1672 | 20 | |||
1673 | 21 | INSTALLED_HTML_TEST_FILE = '/usr/share/unity-webapps-qml/autopilot-tests/html/test_webapps_api_injected.html' | ||
1674 | 22 | |||
1675 | 23 | def get_html_test_file(self): | 27 | def get_html_test_file(self): |
1679 | 24 | if os.path.exists(self.LOCAL_HTML_TEST_FILE): | 28 | if os.path.exists(LOCAL_HTML_TEST_FILE): |
1680 | 25 | return os.path.abspath(self.LOCAL_HTML_TEST_FILE) | 29 | return os.path.abspath(LOCAL_HTML_TEST_FILE) |
1681 | 26 | return self.INSTALLED_HTML_TEST_FILE | 30 | return INSTALLED_HTML_TEST_FILE |
1682 | 27 | 31 | ||
1683 | 28 | def setUp(self): | 32 | def setUp(self): |
1684 | 29 | super(UnityWebappsApiInjectedTestCaseBase, self).setUp() | 33 | super(UnityWebappsApiInjectedTestCaseBase, self).setUp() |
1685 | 30 | self.launch_with_html_filepath(self.get_html_test_file()) | 34 | self.launch_with_html_filepath(self.get_html_test_file()) |
1686 | 31 | 35 | ||
1687 | 32 | def test_getUnityObjectFound(self): | 36 | def test_getUnityObjectFound(self): |
1689 | 33 | self.assertThat(lambda: self.eval_expression_in_page_unsafe('return window.external.getUnityObject("1.0") != null'), Eventually(Equals(True))) | 37 | self.assertThat( |
1690 | 38 | lambda: self.eval_expression_in_page_unsafe( | ||
1691 | 39 | 'return window.external.getUnityObject("1.0") != null'), | ||
1692 | 40 | Eventually(Equals(True))) | ||
1693 | 34 | 41 | ||
1694 | 35 | def test_actionsApiFound(self): | 42 | def test_actionsApiFound(self): |
1696 | 36 | self.assertThat(lambda: self.eval_expression_in_page_unsafe('return window.external.getUnityObject("1.0") != null;'), Eventually(Equals(True))) | 43 | self.assertThat( |
1697 | 44 | lambda: self.eval_expression_in_page_unsafe( | ||
1698 | 45 | 'return window.external.getUnityObject("1.0") != null;'), | ||
1699 | 46 | Eventually(Equals(True))) | ||
1700 | 37 | 47 | ||
1701 | 38 | expression = """ | 48 | expression = """ |
1702 | 39 | var unity = window.external.getUnityObject("1.0"); | 49 | var unity = window.external.getUnityObject("1.0"); |
1704 | 40 | return unity.addAction != null && unity.clearActions != null && unity.clearAction != null; | 50 | return unity.addAction != null && |
1705 | 51 | unity.clearActions != null && | ||
1706 | 52 | unity.clearAction != null; | ||
1707 | 41 | """ | 53 | """ |
1709 | 42 | self.assertThat(lambda: self.eval_expression_in_page_unsafe(expression), Eventually(Equals(True))) | 54 | self.assertThat( |
1710 | 55 | lambda: self.eval_expression_in_page_unsafe(expression), | ||
1711 | 56 | Eventually(Equals(True))) | ||
1712 | 43 | 57 | ||
1713 | 44 | def test_notificationApiFound(self): | 58 | def test_notificationApiFound(self): |
1715 | 45 | self.assertThat(lambda: self.eval_expression_in_page_unsafe('return window.external.getUnityObject("1.0") != null;'), Eventually(Equals(True))) | 59 | self.assertThat( |
1716 | 60 | lambda: self.eval_expression_in_page_unsafe( | ||
1717 | 61 | 'return window.external.getUnityObject("1.0") != null;'), | ||
1718 | 62 | Eventually(Equals(True))) | ||
1719 | 46 | 63 | ||
1720 | 47 | expression = """ | 64 | expression = """ |
1721 | 48 | var unity = window.external.getUnityObject("1.0"); | 65 | var unity = window.external.getUnityObject("1.0"); |
1723 | 49 | return unity.Notification != null && unity.Notification.showNotification != null; | 66 | return unity.Notification != null && |
1724 | 67 | unity.Notification.showNotification != null; | ||
1725 | 50 | """ | 68 | """ |
1727 | 51 | self.assertThat(lambda: self.eval_expression_in_page_unsafe(expression), Eventually(Equals(True))) | 69 | self.assertThat( |
1728 | 70 | lambda: self.eval_expression_in_page_unsafe(expression), | ||
1729 | 71 | Eventually(Equals(True))) | ||
1730 | 52 | 72 | ||
1731 | 53 | def test_messagingIndicatorApiFound(self): | 73 | def test_messagingIndicatorApiFound(self): |
1733 | 54 | self.assertThat(lambda: self.eval_expression_in_page_unsafe('return window.external.getUnityObject("1.0") != null;'), Eventually(Equals(True))) | 74 | self.assertThat( |
1734 | 75 | lambda: self.eval_expression_in_page_unsafe( | ||
1735 | 76 | 'return window.external.getUnityObject("1.0") != null;'), | ||
1736 | 77 | Eventually(Equals(True))) | ||
1737 | 55 | 78 | ||
1738 | 56 | expression = """ | 79 | expression = """ |
1739 | 57 | var unity = window.external.getUnityObject("1.0"); | 80 | var unity = window.external.getUnityObject("1.0"); |
1740 | @@ -61,15 +84,21 @@ | |||
1741 | 61 | unity.MessagingIndicator.clearIndicators != null && | 84 | unity.MessagingIndicator.clearIndicators != null && |
1742 | 62 | unity.MessagingIndicator.showIndicator != null; | 85 | unity.MessagingIndicator.showIndicator != null; |
1743 | 63 | """ | 86 | """ |
1745 | 64 | self.assertThat(lambda: self.eval_expression_in_page_unsafe(expression), Eventually(Equals(True))) | 87 | self.assertThat( |
1746 | 88 | lambda: self.eval_expression_in_page_unsafe(expression), | ||
1747 | 89 | Eventually(Equals(True))) | ||
1748 | 65 | 90 | ||
1749 | 66 | def test_ubuntuReadyEventSent(self): | 91 | def test_ubuntuReadyEventSent(self): |
1751 | 67 | self.assertThat(lambda: self.eval_expression_in_page_unsafe('return window.external.getUnityObject("1.0") != null;'), Eventually(Equals(True))) | 92 | self.assertThat( |
1752 | 93 | lambda: self.eval_expression_in_page_unsafe( | ||
1753 | 94 | 'return window.external.getUnityObject("1.0") != null;'), | ||
1754 | 95 | Eventually(Equals(True))) | ||
1755 | 68 | 96 | ||
1756 | 69 | expression = """ | 97 | expression = """ |
1758 | 70 | var api_ready_count = window.localStorage['ubuntu-webapps-api-ready-key']; | 98 | var api_ready_count = |
1759 | 99 | window.localStorage['ubuntu-webapps-api-ready-key']; | ||
1760 | 71 | return api_ready_count != null && api_ready_count > 0; | 100 | return api_ready_count != null && api_ready_count > 0; |
1761 | 72 | """ | 101 | """ |
1765 | 73 | self.assertThat(lambda: self.eval_expression_in_page_unsafe(expression), Eventually(Equals(True))) | 102 | self.assertThat( |
1766 | 74 | 103 | lambda: self.eval_expression_in_page_unsafe(expression), | |
1767 | 75 | 104 | Eventually(Equals(True))) | |
1768 | 76 | 105 | ||
1769 | === modified file 'tests/autopilot/unity_webapps_qml/tests/test_installedWebapp.py' | |||
1770 | --- tests/autopilot/unity_webapps_qml/tests/test_installedWebapp.py 2014-07-16 20:15:17 +0000 | |||
1771 | +++ tests/autopilot/unity_webapps_qml/tests/test_installedWebapp.py 2014-11-22 00:43:58 +0000 | |||
1772 | @@ -7,18 +7,23 @@ | |||
1773 | 7 | 7 | ||
1774 | 8 | from __future__ import absolute_import | 8 | from __future__ import absolute_import |
1775 | 9 | 9 | ||
1776 | 10 | import time | ||
1777 | 11 | import os | 10 | import os |
1778 | 12 | 11 | ||
1780 | 13 | from testtools.matchers import Equals, GreaterThan, NotEquals | 12 | from testtools.matchers import Equals |
1781 | 14 | from autopilot.matchers import Eventually | 13 | from autopilot.matchers import Eventually |
1782 | 15 | 14 | ||
1783 | 16 | from unity_webapps_qml.tests import WebappsTestCaseBaseWithLocalHttpContentBase | 15 | from unity_webapps_qml.tests import WebappsTestCaseBaseWithLocalHttpContentBase |
1784 | 17 | 16 | ||
1789 | 18 | LOCAL_HTML_TEST_FILE = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), '../../data') | 17 | LOCAL_HTML_TEST_FILE = "{}/{}".format( |
1790 | 19 | INSTALLED_HTML_TEST_FILE = '/usr/share/unity-webapps-qml/autopilot-tests/data' | 18 | os.path.dirname(os.path.realpath(__file__)), |
1791 | 20 | 19 | '../../data') | |
1792 | 21 | class InstalledWebappsTestCaseBase(WebappsTestCaseBaseWithLocalHttpContentBase): | 20 | |
1793 | 21 | INSTALLED_HTML_TEST_FILE = \ | ||
1794 | 22 | '/usr/share/unity-webapps-qml/autopilot-tests/data' | ||
1795 | 23 | |||
1796 | 24 | |||
1797 | 25 | class InstalledWebappsTestCaseBase( | ||
1798 | 26 | WebappsTestCaseBaseWithLocalHttpContentBase): | ||
1799 | 22 | def setUp(self): | 27 | def setUp(self): |
1800 | 23 | super(InstalledWebappsTestCaseBase, self).setUp() | 28 | super(InstalledWebappsTestCaseBase, self).setUp() |
1801 | 24 | 29 | ||
1802 | @@ -30,34 +35,60 @@ | |||
1803 | 30 | def test_normalWebappFound(self): | 35 | def test_normalWebappFound(self): |
1804 | 31 | self.launch_with_webapp('Normal', self.get_webapp_install_folder()) | 36 | self.launch_with_webapp('Normal', self.get_webapp_install_folder()) |
1805 | 32 | 37 | ||
1807 | 33 | self.assertThat(lambda: self.eval_expression_in_page_unsafe('return window.external.getUnityObject("1.0") != null;'), Eventually(Equals(True))) | 38 | self.assertThat( |
1808 | 39 | lambda: self.eval_expression_in_page_unsafe( | ||
1809 | 40 | 'return window.external.getUnityObject("1.0") != null;'), | ||
1810 | 41 | Eventually(Equals(True))) | ||
1811 | 34 | 42 | ||
1812 | 35 | expression = """ | 43 | expression = """ |
1813 | 36 | var contentElement = document.getElementById('content'); | 44 | var contentElement = document.getElementById('content'); |
1814 | 37 | return contentElement.innerHTML; | 45 | return contentElement.innerHTML; |
1815 | 38 | """ | 46 | """ |
1817 | 39 | self.assertThat(lambda: self.eval_expression_in_page_unsafe(expression), Eventually(Equals("WebApp Script Injected"))) | 47 | self.assertThat( |
1818 | 48 | lambda: self.eval_expression_in_page_unsafe(expression), | ||
1819 | 49 | Eventually(Equals("WebApp Script Injected"))) | ||
1820 | 40 | 50 | ||
1821 | 41 | def test_webappWithUAOverrideFound(self): | 51 | def test_webappWithUAOverrideFound(self): |
1824 | 42 | self.launch_with_webapp('AlteredUAWebapp', self.get_webapp_install_folder(), True) | 52 | self.launch_with_webapp( |
1825 | 43 | self.assertThat(lambda: self.eval_expression_in_page_unsafe('return navigator.userAgent;'), Eventually(Equals("My Override"))) | 53 | 'AlteredUAWebapp', |
1826 | 54 | self.get_webapp_install_folder(), True) | ||
1827 | 55 | self.assertThat( | ||
1828 | 56 | lambda: self.eval_expression_in_page_unsafe( | ||
1829 | 57 | 'return navigator.userAgent;'), | ||
1830 | 58 | Eventually(Equals("My Override"))) | ||
1831 | 44 | 59 | ||
1832 | 45 | def test_webappFoundWithSpecialWebappPropertiesFile(self): | 60 | def test_webappFoundWithSpecialWebappPropertiesFile(self): |
1834 | 46 | self.launch_with_webapp('ExtendedWebappProperties', self.get_webapp_install_folder() + '/all-in-same-folder') | 61 | self.launch_with_webapp( |
1835 | 62 | 'ExtendedWebappProperties', | ||
1836 | 63 | self.get_webapp_install_folder() + '/all-in-same-folder') | ||
1837 | 47 | 64 | ||
1839 | 48 | self.assertThat(lambda: self.eval_expression_in_page_unsafe('return window.external.getUnityObject("1.0") != null;'), Eventually(Equals(True))) | 65 | self.assertThat( |
1840 | 66 | lambda: self.eval_expression_in_page_unsafe( | ||
1841 | 67 | 'return window.external.getUnityObject("1.0") != null;'), | ||
1842 | 68 | Eventually(Equals(True))) | ||
1843 | 49 | 69 | ||
1844 | 50 | expression = """ | 70 | expression = """ |
1845 | 51 | var contentElement = document.getElementById('content'); | 71 | var contentElement = document.getElementById('content'); |
1846 | 52 | return contentElement.innerHTML; | 72 | return contentElement.innerHTML; |
1847 | 53 | """ | 73 | """ |
1849 | 54 | self.assertThat(lambda: self.eval_expression_in_page_unsafe(expression), Eventually(Equals("WebApp Script Injected"))) | 74 | self.assertThat( |
1850 | 75 | lambda: self.eval_expression_in_page_unsafe(expression), | ||
1851 | 76 | Eventually(Equals("WebApp Script Injected"))) | ||
1852 | 55 | 77 | ||
1853 | 56 | def test_webappPropertiesFileWithUA(self): | 78 | def test_webappPropertiesFileWithUA(self): |
1856 | 57 | self.launch_with_webapp('ExtendedWebappProperties', self.get_webapp_install_folder() + '/all-in-same-folder', True) | 79 | self.launch_with_webapp( |
1857 | 58 | self.assertThat(lambda: self.eval_expression_in_page_unsafe('return navigator.userAgent;'), Eventually(Equals("My Override"))) | 80 | 'ExtendedWebappProperties', |
1858 | 81 | self.get_webapp_install_folder() + '/all-in-same-folder', True) | ||
1859 | 82 | self.assertThat( | ||
1860 | 83 | lambda: self.eval_expression_in_page_unsafe( | ||
1861 | 84 | 'return navigator.userAgent;'), | ||
1862 | 85 | Eventually(Equals("My Override"))) | ||
1863 | 59 | 86 | ||
1864 | 60 | def test_webappPropertiesNameUpdated(self): | 87 | def test_webappPropertiesNameUpdated(self): |
1868 | 61 | self.launch_with_webapp('', self.get_webapp_install_folder() + '/all-in-same-folder') | 88 | self.launch_with_webapp( |
1869 | 62 | self.assertThat(lambda: self.eval_expression_in_page_unsafe('return window.external.getUnityObject("1.0") != null;'), Eventually(Equals(True))) | 89 | '', |
1870 | 63 | 90 | self.get_webapp_install_folder() + '/all-in-same-folder') | |
1871 | 91 | self.assertThat( | ||
1872 | 92 | lambda: self.eval_expression_in_page_unsafe( | ||
1873 | 93 | 'return window.external.getUnityObject("1.0") != null;'), | ||
1874 | 94 | Eventually(Equals(True))) | ||
1875 | 64 | 95 | ||
1876 | === modified file 'tests/autopilot/unity_webapps_qml/tests/test_launcher.py' | |||
1877 | --- tests/autopilot/unity_webapps_qml/tests/test_launcher.py 2013-09-23 19:59:29 +0000 | |||
1878 | +++ tests/autopilot/unity_webapps_qml/tests/test_launcher.py 2014-11-22 00:43:58 +0000 | |||
1879 | @@ -6,78 +6,102 @@ | |||
1880 | 6 | # by the Free Software Foundation. | 6 | # by the Free Software Foundation. |
1881 | 7 | 7 | ||
1882 | 8 | import os | 8 | import os |
1888 | 9 | import time | 9 | |
1889 | 10 | 10 | from gi.repository import Unity | |
1890 | 11 | from gi.repository import Unity, GObject | 11 | |
1891 | 12 | 12 | from testtools.matchers import Equals, NotEquals | |
1887 | 13 | from testtools.matchers import Equals, GreaterThan, NotEquals | ||
1892 | 14 | from testtools import skipUnless | 13 | from testtools import skipUnless |
1893 | 15 | 14 | ||
1894 | 16 | from autopilot import platform | 15 | from autopilot import platform |
1895 | 17 | from autopilot.matchers import Eventually | 16 | from autopilot.matchers import Eventually |
1896 | 18 | 17 | ||
1897 | 19 | from unity.emulators.icons import HudLauncherIcon | ||
1898 | 20 | from unity.emulators import ensure_unity_is_running | ||
1899 | 21 | |||
1900 | 22 | from unity_webapps_qml.tests import UnityWebappsTestCaseBase | 18 | from unity_webapps_qml.tests import UnityWebappsTestCaseBase |
1901 | 23 | 19 | ||
1902 | 20 | LOCAL_HTML_TEST_FILE = "{}/{}".format( | ||
1903 | 21 | os.path.dirname(os.path.realpath(__file__)), | ||
1904 | 22 | '../../html/test_webapps_launcher.html') | ||
1905 | 23 | |||
1906 | 24 | INSTALLED_HTML_TEST_FILE = \ | ||
1907 | 25 | '/usr/share/unity-webapps-qml/' \ | ||
1908 | 26 | 'autopilot-tests/html/test_webapps_launcher.html' | ||
1909 | 27 | |||
1910 | 28 | |||
1911 | 24 | class UnityWebappsLauncherTestCase(UnityWebappsTestCaseBase): | 29 | class UnityWebappsLauncherTestCase(UnityWebappsTestCaseBase): |
1912 | 25 | LOCAL_HTML_TEST_FILE = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), '../../html/test_webapps_launcher.html') | ||
1913 | 26 | INSTALLED_HTML_TEST_FILE = '/usr/share/unity-webapps-qml/autopilot-tests/html/test_webapps_launcher.html' | ||
1914 | 27 | |||
1915 | 28 | def get_html_test_file(self): | 30 | def get_html_test_file(self): |
1919 | 29 | if os.path.exists(self.LOCAL_HTML_TEST_FILE): | 31 | if os.path.exists(LOCAL_HTML_TEST_FILE): |
1920 | 30 | return os.path.abspath(self.LOCAL_HTML_TEST_FILE) | 32 | return os.path.abspath(LOCAL_HTML_TEST_FILE) |
1921 | 31 | return self.INSTALLED_HTML_TEST_FILE | 33 | return INSTALLED_HTML_TEST_FILE |
1922 | 32 | 34 | ||
1923 | 33 | def setUp(self): | 35 | def setUp(self): |
1924 | 34 | super(UnityWebappsLauncherTestCase, self).setUp() | 36 | super(UnityWebappsLauncherTestCase, self).setUp() |
1925 | 35 | # On Touch the dbus unity if does is not exposed | ||
1926 | 36 | if platform.model() == 'Desktop': | ||
1927 | 37 | ensure_unity_is_running() | ||
1928 | 38 | self.launch_with_html_filepath(self.get_html_test_file()) | 37 | self.launch_with_html_filepath(self.get_html_test_file()) |
1929 | 39 | 38 | ||
1930 | 40 | @skipUnless(platform.model() == 'Desktop', "Only runs on the Desktop") | 39 | @skipUnless(platform.model() == 'Desktop', "Only runs on the Desktop") |
1931 | 41 | def test_checkCounts(self): | 40 | def test_checkCounts(self): |
1933 | 42 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('status').innerHTML;"), Eventually(Equals('launcher-updated'))) | 41 | self.assertThat( |
1934 | 42 | lambda: self.eval_expression_in_page_unsafe( | ||
1935 | 43 | "return document.getElementById('status').innerHTML;"), | ||
1936 | 44 | Eventually(Equals('launcher-updated'))) | ||
1937 | 43 | 45 | ||
1939 | 44 | launcher_icon = self.unity.launcher.model.get_icon(desktop_id='unitywebappsqmllauncher.desktop') | 46 | launcher_icon = self.unity.launcher.model.get_icon( |
1940 | 47 | desktop_id='unitywebappsqmllauncher.desktop') | ||
1941 | 45 | self.assertThat(launcher_icon, NotEquals(None)) | 48 | self.assertThat(launcher_icon, NotEquals(None)) |
1942 | 46 | 49 | ||
1943 | 47 | expr = """ | 50 | expr = """ |
1945 | 48 | document.addEventListener('unity-webapps-do-call-response', function(e) { | 51 | document.addEventListener('unity-webapps-do-call-response', |
1946 | 52 | function(e) { | ||
1947 | 49 | var response = e.detail; | 53 | var response = e.detail; |
1948 | 50 | document.getElementById('status').innerHTML = '' + e.detail; | 54 | document.getElementById('status').innerHTML = '' + e.detail; |
1949 | 51 | }); | 55 | }); |
1950 | 52 | 56 | ||
1952 | 53 | var e = new CustomEvent ("unity-webapps-do-call", {"detail": JSON.stringify({"name": 'Launcher.__get', 'with_callback': true, 'args': ['count']})}); | 57 | var e = new CustomEvent ( |
1953 | 58 | "unity-webapps-do-call", | ||
1954 | 59 | {"detail": JSON.stringify( | ||
1955 | 60 | {"name": 'Launcher.__get', | ||
1956 | 61 | 'with_callback': true, | ||
1957 | 62 | 'args': ['count']})}); | ||
1958 | 54 | document.dispatchEvent (e); | 63 | document.dispatchEvent (e); |
1959 | 55 | return true; | 64 | return true; |
1960 | 56 | """ | 65 | """ |
1961 | 57 | self.eval_expression_in_page_unsafe(expr) | 66 | self.eval_expression_in_page_unsafe(expr) |
1962 | 58 | 67 | ||
1964 | 59 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('status').innerHTML;"), Eventually(Equals('42'))) | 68 | self.assertThat( |
1965 | 69 | lambda: self.eval_expression_in_page_unsafe( | ||
1966 | 70 | "return document.getElementById('status').innerHTML;"), | ||
1967 | 71 | Eventually(Equals('42'))) | ||
1968 | 60 | 72 | ||
1969 | 61 | # self.assertThat(launcher.get_property('progress'), Equals(0.09375)) | 73 | # self.assertThat(launcher.get_property('progress'), Equals(0.09375)) |
1970 | 62 | 74 | ||
1971 | 63 | @skipUnless(platform.model() == 'Desktop', "Only runs on the Desktop") | 75 | @skipUnless(platform.model() == 'Desktop', "Only runs on the Desktop") |
1972 | 64 | def test_checkProgress(self): | 76 | def test_checkProgress(self): |
1974 | 65 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('status').innerHTML;"), Eventually(Equals('launcher-updated'))) | 77 | self.assertThat( |
1975 | 78 | lambda: self.eval_expression_in_page_unsafe( | ||
1976 | 79 | "return document.getElementById('status').innerHTML;"), | ||
1977 | 80 | Eventually(Equals('launcher-updated'))) | ||
1978 | 66 | 81 | ||
1980 | 67 | launcher_icon = self.unity.launcher.model.get_icon(desktop_id='unitywebappsqmllauncher.desktop') | 82 | launcher_icon = self.unity.launcher.model.get_icon( |
1981 | 83 | desktop_id='unitywebappsqmllauncher.desktop') | ||
1982 | 68 | self.assertThat(launcher_icon, NotEquals(None)) | 84 | self.assertThat(launcher_icon, NotEquals(None)) |
1983 | 69 | 85 | ||
1984 | 70 | expr = """ | 86 | expr = """ |
1986 | 71 | document.addEventListener('unity-webapps-do-call-response', function(e) { | 87 | document.addEventListener( |
1987 | 88 | 'unity-webapps-do-call-response', function(e) { | ||
1988 | 72 | var response = e.detail; | 89 | var response = e.detail; |
1989 | 73 | document.getElementById('status').innerHTML = '' + e.detail; | 90 | document.getElementById('status').innerHTML = '' + e.detail; |
1990 | 74 | }); | 91 | }); |
1991 | 75 | 92 | ||
1993 | 76 | var e = new CustomEvent ("unity-webapps-do-call", {"detail": JSON.stringify({"name": 'Launcher.__get', 'with_callback': true, 'args': ['progress']})}); | 93 | var e = new CustomEvent ( |
1994 | 94 | "unity-webapps-do-call", | ||
1995 | 95 | {"detail": JSON.stringify( | ||
1996 | 96 | {"name": 'Launcher.__get', | ||
1997 | 97 | 'with_callback': true, | ||
1998 | 98 | 'args': ['progress']})}); | ||
1999 | 77 | document.dispatchEvent (e); | 99 | document.dispatchEvent (e); |
2000 | 78 | return true; | 100 | return true; |
2001 | 79 | """ | 101 | """ |
2002 | 80 | self.eval_expression_in_page_unsafe(expr) | 102 | self.eval_expression_in_page_unsafe(expr) |
2003 | 81 | 103 | ||
2006 | 82 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('status').innerHTML;"), Eventually(Equals('0.09375'))) | 104 | self.assertThat( |
2007 | 83 | 105 | lambda: self.eval_expression_in_page_unsafe( | |
2008 | 106 | "return document.getElementById('status').innerHTML;"), | ||
2009 | 107 | Eventually(Equals('0.09375'))) | ||
2010 | 84 | 108 | ||
2011 | === modified file 'tests/autopilot/unity_webapps_qml/tests/test_mediaplayer.py' | |||
2012 | --- tests/autopilot/unity_webapps_qml/tests/test_mediaplayer.py 2013-09-23 19:59:29 +0000 | |||
2013 | +++ tests/autopilot/unity_webapps_qml/tests/test_mediaplayer.py 2014-11-22 00:43:58 +0000 | |||
2014 | @@ -6,106 +6,153 @@ | |||
2015 | 6 | # by the Free Software Foundation. | 6 | # by the Free Software Foundation. |
2016 | 7 | 7 | ||
2017 | 8 | import os | 8 | import os |
2023 | 9 | import time | 9 | |
2024 | 10 | 10 | from gi.repository import Unity | |
2025 | 11 | from gi.repository import Unity, GObject | 11 | |
2026 | 12 | 12 | from testtools.matchers import Equals | |
2022 | 13 | from testtools.matchers import Equals, GreaterThan, NotEquals | ||
2027 | 14 | from testtools import skipUnless | 13 | from testtools import skipUnless |
2028 | 15 | 14 | ||
2029 | 16 | from autopilot import platform | 15 | from autopilot import platform |
2030 | 17 | from autopilot.matchers import Eventually | 16 | from autopilot.matchers import Eventually |
2031 | 18 | 17 | ||
2032 | 19 | from unity.emulators import ensure_unity_is_running | ||
2033 | 20 | |||
2034 | 21 | from unity_webapps_qml.tests import UnityWebappsTestCaseBase | 18 | from unity_webapps_qml.tests import UnityWebappsTestCaseBase |
2035 | 22 | 19 | ||
2036 | 20 | LOCAL_HTML_TEST_FILE = "{}/{}".format( | ||
2037 | 21 | os.path.dirname(os.path.realpath(__file__)), | ||
2038 | 22 | '../../html/test_webapps_mediaplayer.html') | ||
2039 | 23 | |||
2040 | 24 | INSTALLED_HTML_TEST_FILE = \ | ||
2041 | 25 | '/usr/share/unity-webapps-qml/' \ | ||
2042 | 26 | 'autopilot-tests/html/test_webapps_mediaplayer.html' | ||
2043 | 27 | |||
2044 | 23 | 28 | ||
2045 | 24 | class UnityWebappsMediaplayerTestCase(UnityWebappsTestCaseBase): | 29 | class UnityWebappsMediaplayerTestCase(UnityWebappsTestCaseBase): |
2046 | 25 | LOCAL_HTML_TEST_FILE = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), '../../html/test_webapps_mediaplayer.html') | ||
2047 | 26 | INSTALLED_HTML_TEST_FILE = '/usr/share/unity-webapps-qml/autopilot-tests/html/test_webapps_mediaplayer.html' | ||
2048 | 27 | |||
2049 | 28 | def get_html_test_file(self): | 30 | def get_html_test_file(self): |
2053 | 29 | if os.path.exists(self.LOCAL_HTML_TEST_FILE): | 31 | if os.path.exists(LOCAL_HTML_TEST_FILE): |
2054 | 30 | return os.path.abspath(self.LOCAL_HTML_TEST_FILE) | 32 | return os.path.abspath(LOCAL_HTML_TEST_FILE) |
2055 | 31 | return self.INSTALLED_HTML_TEST_FILE | 33 | return INSTALLED_HTML_TEST_FILE |
2056 | 32 | 34 | ||
2057 | 33 | def setUp(self): | 35 | def setUp(self): |
2058 | 34 | super(UnityWebappsMediaplayerTestCase, self).setUp() | 36 | super(UnityWebappsMediaplayerTestCase, self).setUp() |
2059 | 35 | # On Touch the dbus unity if does is not exposed | ||
2060 | 36 | if platform.model() == 'Desktop': | ||
2061 | 37 | ensure_unity_is_running() | ||
2062 | 38 | self.launch_with_html_filepath(self.get_html_test_file()) | 37 | self.launch_with_html_filepath(self.get_html_test_file()) |
2063 | 39 | 38 | ||
2064 | 40 | @skipUnless(platform.model() == 'Desktop', "Only runs on the Desktop") | 39 | @skipUnless(platform.model() == 'Desktop', "Only runs on the Desktop") |
2065 | 41 | def test_checkInitialSetTrack(self): | 40 | def test_checkInitialSetTrack(self): |
2067 | 42 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('status').innerHTML;"), Eventually(Equals('mediaplayer-updated'))) | 41 | self.assertThat( |
2068 | 42 | lambda: self.eval_expression_in_page_unsafe( | ||
2069 | 43 | "return document.getElementById('status').innerHTML;"), | ||
2070 | 44 | Eventually(Equals('mediaplayer-updated'))) | ||
2071 | 43 | 45 | ||
2072 | 44 | expr = """ | 46 | expr = """ |
2074 | 45 | document.addEventListener('unity-webapps-do-call-response', function(e) { | 47 | document.addEventListener( |
2075 | 48 | 'unity-webapps-do-call-response', | ||
2076 | 49 | function(e) { | ||
2077 | 46 | var response = e.detail; | 50 | var response = e.detail; |
2078 | 47 | document.getElementById('status').innerHTML = '' + e.detail; | 51 | document.getElementById('status').innerHTML = '' + e.detail; |
2079 | 48 | }); | 52 | }); |
2080 | 49 | 53 | ||
2082 | 50 | var e = new CustomEvent ("unity-webapps-do-call", {"detail": JSON.stringify({"name": 'MediaPlayer.__get', 'with_callback': true, 'args': ['track']})}); | 54 | var e = new CustomEvent ( |
2083 | 55 | "unity-webapps-do-call", | ||
2084 | 56 | {"detail": JSON.stringify( | ||
2085 | 57 | {"name": 'MediaPlayer.__get', | ||
2086 | 58 | 'with_callback': true, | ||
2087 | 59 | 'args': ['track']})}); | ||
2088 | 51 | document.dispatchEvent (e); | 60 | document.dispatchEvent (e); |
2089 | 52 | return true; | 61 | return true; |
2090 | 53 | """ | 62 | """ |
2091 | 54 | self.eval_expression_in_page_unsafe(expr) | 63 | self.eval_expression_in_page_unsafe(expr) |
2092 | 55 | 64 | ||
2094 | 56 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('status').innerHTML;"), Eventually(Equals('TXlBcnRpc3Q=;TXlUaXRsZQ==;TXlBbGJ1bQ=='))) | 65 | self.assertThat( |
2095 | 66 | lambda: self.eval_expression_in_page_unsafe( | ||
2096 | 67 | "return document.getElementById('status').innerHTML;"), | ||
2097 | 68 | Eventually(Equals('TXlBcnRpc3Q=;TXlUaXRsZQ==;TXlBbGJ1bQ=='))) | ||
2098 | 57 | 69 | ||
2099 | 58 | @skipUnless(platform.model() == 'Desktop', "Only runs on the Desktop") | 70 | @skipUnless(platform.model() == 'Desktop', "Only runs on the Desktop") |
2100 | 59 | def test_checkInitialSetCanGoNext(self): | 71 | def test_checkInitialSetCanGoNext(self): |
2102 | 60 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('status').innerHTML;"), Eventually(Equals('mediaplayer-updated'))) | 72 | self.assertThat( |
2103 | 73 | lambda: self.eval_expression_in_page_unsafe( | ||
2104 | 74 | "return document.getElementById('status').innerHTML;"), | ||
2105 | 75 | Eventually(Equals('mediaplayer-updated'))) | ||
2106 | 61 | 76 | ||
2107 | 62 | expr = """ | 77 | expr = """ |
2109 | 63 | document.addEventListener('unity-webapps-do-call-response', function(e) { | 78 | document.addEventListener( |
2110 | 79 | 'unity-webapps-do-call-response', function(e) { | ||
2111 | 64 | var response = e.detail; | 80 | var response = e.detail; |
2112 | 65 | document.getElementById('status').innerHTML = '' + e.detail; | 81 | document.getElementById('status').innerHTML = '' + e.detail; |
2113 | 66 | }); | 82 | }); |
2114 | 67 | 83 | ||
2116 | 68 | var e = new CustomEvent ("unity-webapps-do-call", {"detail": JSON.stringify({"name": 'MediaPlayer.__get', 'with_callback': true, 'args': ['can-go-next']})}); | 84 | var e = new CustomEvent ( |
2117 | 85 | "unity-webapps-do-call", | ||
2118 | 86 | {"detail": JSON.stringify( | ||
2119 | 87 | {"name": 'MediaPlayer.__get', | ||
2120 | 88 | 'with_callback': true, | ||
2121 | 89 | 'args': ['can-go-next']})}); | ||
2122 | 69 | document.dispatchEvent (e); | 90 | document.dispatchEvent (e); |
2123 | 70 | return true; | 91 | return true; |
2124 | 71 | """ | 92 | """ |
2125 | 72 | self.eval_expression_in_page_unsafe(expr) | 93 | self.eval_expression_in_page_unsafe(expr) |
2126 | 73 | 94 | ||
2128 | 74 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('status').innerHTML;"), Eventually(Equals('true'))) | 95 | self.assertThat( |
2129 | 96 | lambda: self.eval_expression_in_page_unsafe( | ||
2130 | 97 | "return document.getElementById('status').innerHTML;"), | ||
2131 | 98 | Eventually(Equals('true'))) | ||
2132 | 75 | 99 | ||
2133 | 76 | @skipUnless(platform.model() == 'Desktop', "Only runs on the Desktop") | 100 | @skipUnless(platform.model() == 'Desktop', "Only runs on the Desktop") |
2134 | 77 | def test_checkInitialSetCanGoPrevious(self): | 101 | def test_checkInitialSetCanGoPrevious(self): |
2136 | 78 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('status').innerHTML;"), Eventually(Equals('mediaplayer-updated'))) | 102 | self.assertThat( |
2137 | 103 | lambda: self.eval_expression_in_page_unsafe( | ||
2138 | 104 | "return document.getElementById('status').innerHTML;"), | ||
2139 | 105 | Eventually(Equals('mediaplayer-updated'))) | ||
2140 | 79 | 106 | ||
2141 | 80 | expr = """ | 107 | expr = """ |
2143 | 81 | document.addEventListener('unity-webapps-do-call-response', function(e) { | 108 | document.addEventListener('unity-webapps-do-call-response', |
2144 | 109 | function(e) { | ||
2145 | 82 | var response = e.detail; | 110 | var response = e.detail; |
2146 | 83 | document.getElementById('status').innerHTML = '' + e.detail; | 111 | document.getElementById('status').innerHTML = '' + e.detail; |
2147 | 84 | }); | 112 | }); |
2148 | 85 | 113 | ||
2150 | 86 | var e = new CustomEvent ("unity-webapps-do-call", {"detail": JSON.stringify({"name": 'MediaPlayer.__get', 'with_callback': true, 'args': ['can-go-previous']})}); | 114 | var e = new CustomEvent ( |
2151 | 115 | "unity-webapps-do-call", | ||
2152 | 116 | {"detail": JSON.stringify( | ||
2153 | 117 | {"name": 'MediaPlayer.__get', | ||
2154 | 118 | 'with_callback': true, | ||
2155 | 119 | 'args': ['can-go-previous']})}); | ||
2156 | 87 | document.dispatchEvent (e); | 120 | document.dispatchEvent (e); |
2157 | 88 | return true; | 121 | return true; |
2158 | 89 | """ | 122 | """ |
2159 | 90 | self.eval_expression_in_page_unsafe(expr) | 123 | self.eval_expression_in_page_unsafe(expr) |
2160 | 91 | 124 | ||
2162 | 92 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('status').innerHTML;"), Eventually(Equals('true'))) | 125 | self.assertThat( |
2163 | 126 | lambda: self.eval_expression_in_page_unsafe( | ||
2164 | 127 | "return document.getElementById('status').innerHTML;"), | ||
2165 | 128 | Eventually(Equals('true'))) | ||
2166 | 93 | 129 | ||
2167 | 94 | @skipUnless(platform.model() == 'Desktop', "Only runs on the Desktop") | 130 | @skipUnless(platform.model() == 'Desktop', "Only runs on the Desktop") |
2168 | 95 | def test_checkInitialSetCanPlay(self): | 131 | def test_checkInitialSetCanPlay(self): |
2170 | 96 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('status').innerHTML;"), Eventually(Equals('mediaplayer-updated'))) | 132 | self.assertThat( |
2171 | 133 | lambda: self.eval_expression_in_page_unsafe( | ||
2172 | 134 | "return document.getElementById('status').innerHTML;"), | ||
2173 | 135 | Eventually(Equals('mediaplayer-updated'))) | ||
2174 | 97 | 136 | ||
2175 | 98 | expr = """ | 137 | expr = """ |
2177 | 99 | document.addEventListener('unity-webapps-do-call-response', function(e) { | 138 | document.addEventListener('unity-webapps-do-call-response', |
2178 | 139 | function(e) { | ||
2179 | 100 | var response = e.detail; | 140 | var response = e.detail; |
2180 | 101 | document.getElementById('status').innerHTML = '' + e.detail; | 141 | document.getElementById('status').innerHTML = '' + e.detail; |
2181 | 102 | }); | 142 | }); |
2182 | 103 | 143 | ||
2184 | 104 | var e = new CustomEvent ("unity-webapps-do-call", {"detail": JSON.stringify({"name": 'MediaPlayer.__get', 'with_callback': true, 'args': ['can-play']})}); | 144 | var e = new CustomEvent ( |
2185 | 145 | "unity-webapps-do-call", | ||
2186 | 146 | {"detail": JSON.stringify( | ||
2187 | 147 | {"name": 'MediaPlayer.__get', | ||
2188 | 148 | 'with_callback': true, | ||
2189 | 149 | 'args': ['can-play']})}); | ||
2190 | 105 | document.dispatchEvent (e); | 150 | document.dispatchEvent (e); |
2191 | 106 | return true; | 151 | return true; |
2192 | 107 | """ | 152 | """ |
2193 | 108 | self.eval_expression_in_page_unsafe(expr) | 153 | self.eval_expression_in_page_unsafe(expr) |
2194 | 109 | 154 | ||
2197 | 110 | self.assertThat(lambda: self.eval_expression_in_page_unsafe("return document.getElementById('status').innerHTML;"), Eventually(Equals('true'))) | 155 | self.assertThat( |
2198 | 111 | 156 | lambda: self.eval_expression_in_page_unsafe( | |
2199 | 157 | "return document.getElementById('status').innerHTML;"), | ||
2200 | 158 | Eventually(Equals('true'))) | ||
2201 | 112 | 159 | ||
2202 | === modified file 'tools/qml-launcher/qml-launcher.cpp' | |||
2203 | --- tools/qml-launcher/qml-launcher.cpp 2014-07-14 19:01:17 +0000 | |||
2204 | +++ tools/qml-launcher/qml-launcher.cpp 2014-11-22 00:43:58 +0000 | |||
2205 | @@ -68,7 +68,6 @@ | |||
2206 | 68 | const QString QML_FILE_IMPORT_ARG_HEADER = "--import="; | 68 | const QString QML_FILE_IMPORT_ARG_HEADER = "--import="; |
2207 | 69 | const QString QML_APP_ID_ARG_HEADER = "--app-id="; | 69 | const QString QML_APP_ID_ARG_HEADER = "--app-id="; |
2208 | 70 | const QString QML_INSPECTOR_ARG_HEADER = "--inspector="; | 70 | const QString QML_INSPECTOR_ARG_HEADER = "--inspector="; |
2209 | 71 | const QString QML_USE_OXIDE_ARG_HEADER = "--useOxide"; | ||
2210 | 72 | const QString ARG_HEADER = "--"; | 71 | const QString ARG_HEADER = "--"; |
2211 | 73 | const QString VALUE_HEADER = "="; | 72 | const QString VALUE_HEADER = "="; |
2212 | 74 | QHash<QString, QString> properties; | 73 | QHash<QString, QString> properties; |
2213 | @@ -76,7 +75,6 @@ | |||
2214 | 76 | QString appid; | 75 | QString appid; |
2215 | 77 | QString importPath; | 76 | QString importPath; |
2216 | 78 | QString inspector; | 77 | QString inspector; |
2217 | 79 | bool useOxide = false; | ||
2218 | 80 | bool maximized = false; | 78 | bool maximized = false; |
2219 | 81 | 79 | ||
2220 | 82 | Q_FOREACH(QString argument, app.arguments()) | 80 | Q_FOREACH(QString argument, app.arguments()) |
2221 | @@ -101,11 +99,6 @@ | |||
2222 | 101 | inspector = argument.right(argument.count() - QML_INSPECTOR_ARG_HEADER.count()); | 99 | inspector = argument.right(argument.count() - QML_INSPECTOR_ARG_HEADER.count()); |
2223 | 102 | } | 100 | } |
2224 | 103 | else | 101 | else |
2225 | 104 | if (argument.contains(QML_USE_OXIDE_ARG_HEADER)) | ||
2226 | 105 | { | ||
2227 | 106 | useOxide = true; | ||
2228 | 107 | } | ||
2229 | 108 | else | ||
2230 | 109 | if (argument.contains(QML_MAXIMIZED_ARG)) | 102 | if (argument.contains(QML_MAXIMIZED_ARG)) |
2231 | 110 | { | 103 | { |
2232 | 111 | maximized = true; | 104 | maximized = true; |
2233 | @@ -199,9 +192,6 @@ | |||
2234 | 199 | object->setProperty(it.key().toStdString().c_str(), QUrl(it.value())); | 192 | object->setProperty(it.key().toStdString().c_str(), QUrl(it.value())); |
2235 | 200 | } | 193 | } |
2236 | 201 | 194 | ||
2237 | 202 | if (useOxide) { | ||
2238 | 203 | object->setProperty("useOxide", true); | ||
2239 | 204 | } | ||
2240 | 205 | component.completeCreate(); | 195 | component.completeCreate(); |
2241 | 206 | 196 | ||
2242 | 207 | if (window) | 197 | if (window) |
FAILED: Continuous integration, rev:136 jenkins. qa.ubuntu. com/job/ unity-webapps- qml-ci/ 147/ jenkins. qa.ubuntu. com/job/ unity-webapps- qml-vivid- amd64-ci/ 1/console jenkins. qa.ubuntu. com/job/ unity-webapps- qml-vivid- armhf-ci/ 1/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/ 147/rebuild
http://