calabash-android 0.4.7.pre2 → 0.4.7.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/calabash-android/lib/TestServer.apk +0 -0
- data/lib/calabash-android/operations.rb +17 -0
- data/lib/calabash-android/version.rb +1 -1
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/NanoHTTPD.java +7 -3
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/CalabashChromeClient.java +32 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 079fd75ffa1a41cf381a4f8cd72b1cadbee2e04d
|
4
|
+
data.tar.gz: a183f3c9dc459adef3d13f067c868e2c6016dda5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f7d86ad6876dc8c317385069746046d591d55730aabe3a919ef95e1287405c2c0bf34f81b9a77e18fadc0a60bd16fc3c21486a304302a2b8c5497142a0ee5c1
|
7
|
+
data.tar.gz: f6e8a2bae10aa4af04f535d4cd7a140ca6c8f83fd55cf5dd4c6e12501f4fcfc1c454615c5c2ef5261008a410cf632519c20b4c3a77a4d3938a0362d2b5178f34
|
Binary file
|
@@ -63,6 +63,10 @@ module Operations
|
|
63
63
|
default_device.install_app(app_path)
|
64
64
|
end
|
65
65
|
|
66
|
+
def update_app(app_path)
|
67
|
+
default_device.update_app(app_path)
|
68
|
+
end
|
69
|
+
|
66
70
|
def uninstall_apps
|
67
71
|
default_device.uninstall_app(package_name(default_device.test_server_path))
|
68
72
|
default_device.uninstall_app(package_name(default_device.app_path))
|
@@ -210,6 +214,19 @@ module Operations
|
|
210
214
|
end
|
211
215
|
end
|
212
216
|
|
217
|
+
def update_app(app_path)
|
218
|
+
cmd = "#{adb_command} install -r \"#{app_path}\""
|
219
|
+
log "Updating: #{app_path}"
|
220
|
+
result = `#{cmd}`
|
221
|
+
log "result: #{result}"
|
222
|
+
succeeded = result.include?("Success")
|
223
|
+
|
224
|
+
unless succeeded
|
225
|
+
::Cucumber.wants_to_quit = true
|
226
|
+
raise "#{pn} did not get updated. Aborting!"
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
213
230
|
def uninstall_app(package_name)
|
214
231
|
log "Uninstalling: #{package_name}"
|
215
232
|
log `#{adb_command} uninstall #{package_name}`
|
data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/NanoHTTPD.java
CHANGED
@@ -360,9 +360,13 @@ public class NanoHTTPD
|
|
360
360
|
{
|
361
361
|
String contentType = "";
|
362
362
|
String contentTypeHeader = header.getProperty("content-type");
|
363
|
-
|
364
|
-
|
365
|
-
|
363
|
+
|
364
|
+
StringTokenizer st = null;
|
365
|
+
if (contentTypeHeader != null) {
|
366
|
+
st = new StringTokenizer(contentTypeHeader, ",; ");
|
367
|
+
if (st.hasMoreTokens()) {
|
368
|
+
contentType = st.nextToken();
|
369
|
+
}
|
366
370
|
}
|
367
371
|
|
368
372
|
if (contentType.equalsIgnoreCase("multipart/form-data"))
|
@@ -1,5 +1,6 @@
|
|
1
1
|
package sh.calaba.instrumentationbackend.actions.webview;
|
2
2
|
|
3
|
+
import java.lang.reflect.Field;
|
3
4
|
import java.lang.reflect.Method;
|
4
5
|
import java.util.ArrayList;
|
5
6
|
import java.util.HashMap;
|
@@ -36,6 +37,22 @@ public class CalabashChromeClient extends WebChromeClient {
|
|
36
37
|
} catch (Exception e) {
|
37
38
|
throw new RuntimeException(e);
|
38
39
|
}
|
40
|
+
} else {
|
41
|
+
try {
|
42
|
+
|
43
|
+
/*
|
44
|
+
* pick up the chromeClient from the webView
|
45
|
+
* this is required because in Jelly Bean there is no getWebChromeClient
|
46
|
+
* above sdk 16.This will help HTML5 hybrid application (Cordova) to pass the prompt messages
|
47
|
+
* to Native code. Previously the CalabashChromeClient did not populate the mWebChromeClient
|
48
|
+
* which lead to the Cordova.exec messages not forward to the Cordova ChromeClient.
|
49
|
+
*/
|
50
|
+
Field field = getChromeClientField(webView.getClass());
|
51
|
+
field.setAccessible(true);
|
52
|
+
mWebChromeClient = (WebChromeClient) field.get(webView);
|
53
|
+
} catch (Exception e) {
|
54
|
+
throw new RuntimeException(e);
|
55
|
+
}
|
39
56
|
}
|
40
57
|
|
41
58
|
if ( Looper.getMainLooper().getThread() == Thread.currentThread()) {
|
@@ -50,6 +67,21 @@ public class CalabashChromeClient extends WebChromeClient {
|
|
50
67
|
}
|
51
68
|
}
|
52
69
|
|
70
|
+
/*
|
71
|
+
* returns the chromeClient from the WebView.
|
72
|
+
* recursively moves up to its superClass to get the chromeClient
|
73
|
+
* if there is no chromeClient it returns null.
|
74
|
+
*/
|
75
|
+
private Field getChromeClientField(Class currentClass) {
|
76
|
+
if (currentClass == null)
|
77
|
+
return null;
|
78
|
+
try {
|
79
|
+
return currentClass.getDeclaredField("chromeClient");
|
80
|
+
} catch (NoSuchFieldException e) {
|
81
|
+
return getChromeClientField(currentClass.getSuperclass());
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
53
85
|
@Override
|
54
86
|
public boolean onJsPrompt(WebView view, String url, String message,
|
55
87
|
String defaultValue, JsPromptResult r) {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calabash-android
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.7.
|
4
|
+
version: 0.4.7.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Maturana Larsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|