calabash-android 0.4.0.pre1 → 0.4.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. data/bin/calabash-android-build.rb +6 -0
  2. data/bin/calabash-android-setup.rb +2 -3
  3. data/lib/calabash-android/canned_steps.md +1 -1
  4. data/lib/calabash-android/helpers.rb +35 -2
  5. data/lib/calabash-android/lib/TestServer.apk +0 -0
  6. data/lib/calabash-android/operations.rb +13 -6
  7. data/lib/calabash-android/version.rb +1 -1
  8. data/test-server/instrumentation-backend/.classpath +2 -1
  9. data/test-server/instrumentation-backend/antlr.sh +2 -0
  10. data/test-server/instrumentation-backend/antlr/UIQuery.g +70 -0
  11. data/test-server/instrumentation-backend/antlr/UIQuery.tokens +12 -0
  12. data/test-server/instrumentation-backend/build-libs/antlr-3.4-complete.jar +0 -0
  13. data/test-server/instrumentation-backend/build-libs/junit.jar +0 -0
  14. data/test-server/instrumentation-backend/build.xml +56 -0
  15. data/test-server/instrumentation-backend/src/org/antlr/runtime/ANTLRFileStream.java +78 -0
  16. data/test-server/instrumentation-backend/src/org/antlr/runtime/ANTLRInputStream.java +70 -0
  17. data/test-server/instrumentation-backend/src/org/antlr/runtime/ANTLRReaderStream.java +95 -0
  18. data/test-server/instrumentation-backend/src/org/antlr/runtime/ANTLRStringStream.java +230 -0
  19. data/test-server/instrumentation-backend/src/org/antlr/runtime/BaseRecognizer.java +894 -0
  20. data/test-server/instrumentation-backend/src/org/antlr/runtime/BitSet.java +325 -0
  21. data/test-server/instrumentation-backend/src/org/antlr/runtime/BufferedTokenStream.java +272 -0
  22. data/test-server/instrumentation-backend/src/org/antlr/runtime/CharStream.java +57 -0
  23. data/test-server/instrumentation-backend/src/org/antlr/runtime/CharStreamState.java +45 -0
  24. data/test-server/instrumentation-backend/src/org/antlr/runtime/ClassicToken.java +141 -0
  25. data/test-server/instrumentation-backend/src/org/antlr/runtime/CommonToken.java +191 -0
  26. data/test-server/instrumentation-backend/src/org/antlr/runtime/CommonTokenStream.java +153 -0
  27. data/test-server/instrumentation-backend/src/org/antlr/runtime/DFA.java +250 -0
  28. data/test-server/instrumentation-backend/src/org/antlr/runtime/EarlyExitException.java +41 -0
  29. data/test-server/instrumentation-backend/src/org/antlr/runtime/FailedPredicateException.java +54 -0
  30. data/test-server/instrumentation-backend/src/org/antlr/runtime/IntStream.java +122 -0
  31. data/test-server/instrumentation-backend/src/org/antlr/runtime/LegacyCommonTokenStream.java +394 -0
  32. data/test-server/instrumentation-backend/src/org/antlr/runtime/Lexer.java +340 -0
  33. data/test-server/instrumentation-backend/src/org/antlr/runtime/MismatchedNotSetException.java +41 -0
  34. data/test-server/instrumentation-backend/src/org/antlr/runtime/MismatchedRangeException.java +45 -0
  35. data/test-server/instrumentation-backend/src/org/antlr/runtime/MismatchedSetException.java +44 -0
  36. data/test-server/instrumentation-backend/src/org/antlr/runtime/MismatchedTokenException.java +45 -0
  37. data/test-server/instrumentation-backend/src/org/antlr/runtime/MismatchedTreeNodeException.java +49 -0
  38. data/test-server/instrumentation-backend/src/org/antlr/runtime/MissingTokenException.java +56 -0
  39. data/test-server/instrumentation-backend/src/org/antlr/runtime/NoViableAltException.java +57 -0
  40. data/test-server/instrumentation-backend/src/org/antlr/runtime/Parser.java +98 -0
  41. data/test-server/instrumentation-backend/src/org/antlr/runtime/ParserRuleReturnScope.java +52 -0
  42. data/test-server/instrumentation-backend/src/org/antlr/runtime/RecognitionException.java +180 -0
  43. data/test-server/instrumentation-backend/src/org/antlr/runtime/RecognizerSharedState.java +144 -0
  44. data/test-server/instrumentation-backend/src/org/antlr/runtime/RuleReturnScope.java +42 -0
  45. data/test-server/instrumentation-backend/src/org/antlr/runtime/SerializedGrammar.java +204 -0
  46. data/test-server/instrumentation-backend/src/org/antlr/runtime/Token.java +92 -0
  47. data/test-server/instrumentation-backend/src/org/antlr/runtime/TokenRewriteStream.java +569 -0
  48. data/test-server/instrumentation-backend/src/org/antlr/runtime/TokenSource.java +54 -0
  49. data/test-server/instrumentation-backend/src/org/antlr/runtime/TokenStream.java +75 -0
  50. data/test-server/instrumentation-backend/src/org/antlr/runtime/UnbufferedTokenStream.java +82 -0
  51. data/test-server/instrumentation-backend/src/org/antlr/runtime/UnwantedTokenException.java +53 -0
  52. data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/BlankDebugEventListener.java +77 -0
  53. data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugEventHub.java +292 -0
  54. data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugEventListener.java +323 -0
  55. data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugEventRepeater.java +88 -0
  56. data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugEventSocketProxy.java +358 -0
  57. data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugParser.java +101 -0
  58. data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugTokenStream.java +156 -0
  59. data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugTreeAdaptor.java +250 -0
  60. data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugTreeNodeStream.java +155 -0
  61. data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugTreeParser.java +112 -0
  62. data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/ParseTreeBuilder.java +109 -0
  63. data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/Profiler.java +772 -0
  64. data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/RemoteDebugEventSocketListener.java +541 -0
  65. data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/TraceDebugEventListener.java +108 -0
  66. data/test-server/instrumentation-backend/src/org/antlr/runtime/debug/Tracer.java +69 -0
  67. data/test-server/instrumentation-backend/src/org/antlr/runtime/misc/DoubleKeyMap.java +62 -0
  68. data/test-server/instrumentation-backend/src/org/antlr/runtime/misc/FastQueue.java +100 -0
  69. data/test-server/instrumentation-backend/src/org/antlr/runtime/misc/IntArray.java +87 -0
  70. data/test-server/instrumentation-backend/src/org/antlr/runtime/misc/LookaheadStream.java +161 -0
  71. data/test-server/instrumentation-backend/src/org/antlr/runtime/misc/Stats.java +189 -0
  72. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/BaseTree.java +349 -0
  73. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/BaseTreeAdaptor.java +279 -0
  74. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/BufferedTreeNodeStream.java +489 -0
  75. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/CommonErrorNode.java +108 -0
  76. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/CommonTree.java +185 -0
  77. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/CommonTreeAdaptor.java +168 -0
  78. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/CommonTreeNodeStream.java +171 -0
  79. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/ParseTree.java +119 -0
  80. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteCardinalityException.java +47 -0
  81. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteEarlyExitException.java +39 -0
  82. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteEmptyStreamException.java +35 -0
  83. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteRuleElementStream.java +210 -0
  84. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteRuleNodeStream.java +70 -0
  85. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteRuleSubtreeStream.java +86 -0
  86. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteRuleTokenStream.java +76 -0
  87. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/Tree.java +127 -0
  88. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeAdaptor.java +263 -0
  89. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeFilter.java +135 -0
  90. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeIterator.java +132 -0
  91. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeNodeStream.java +106 -0
  92. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeParser.java +169 -0
  93. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreePatternLexer.java +135 -0
  94. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreePatternParser.java +154 -0
  95. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeRewriter.java +124 -0
  96. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeRuleReturnScope.java +41 -0
  97. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeVisitor.java +69 -0
  98. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeVisitorAction.java +47 -0
  99. data/test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeWizard.java +531 -0
  100. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearAppData.java +22 -7
  101. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/InstrumentationBackend.java +4 -4
  102. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/Result.java +0 -1
  103. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/HttpServer.java +161 -129
  104. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/activity/SetActivityOrientation.java +5 -7
  105. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/GetViewProperty.java +1 -7
  106. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/Query.java +70 -61
  107. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/UIQuery.tokens +12 -0
  108. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ViewMapper.java +63 -0
  109. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/antlr/UIQuery.tokens +10 -0
  110. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/antlr/UIQueryLexer.java +945 -0
  111. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/antlr/UIQueryParser.java +463 -0
  112. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/InvalidUIQueryException.java +10 -0
  113. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryAST.java +8 -0
  114. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryASTClassName.java +115 -0
  115. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryASTWith.java +157 -0
  116. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryDirection.java +5 -0
  117. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryEvaluator.java +205 -0
  118. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryUtils.java +135 -0
  119. data/test-server/instrumentation-backend/tests/sh/calaba/instrumentationbackend/query/tests/UIQueryTest.java +134 -0
  120. metadata +106 -3
  121. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/activity/SetOrientation.java +0 -39
@@ -0,0 +1,135 @@
1
+ package sh.calaba.instrumentationbackend.query.ast;
2
+
3
+ import java.lang.reflect.InvocationTargetException;
4
+ import java.lang.reflect.Method;
5
+ import java.util.ArrayList;
6
+ import java.util.Collections;
7
+ import java.util.List;
8
+
9
+ import android.view.View;
10
+
11
+ public class UIQueryUtils {
12
+ @SuppressWarnings({ "unchecked", "rawtypes" })
13
+ public static List subviews(Object o)
14
+ {
15
+ try {
16
+ Method getChild = o.getClass().getMethod("getChildAt", int.class);
17
+ getChild.setAccessible(true);
18
+ Method getChildCount = o.getClass().getMethod("getChildCount");
19
+ getChildCount.setAccessible(true);
20
+ List result = new ArrayList(8);
21
+ int childCount = (Integer) getChildCount.invoke(o);
22
+ for (int i=0;i<childCount;i++)
23
+ {
24
+ result.add(getChild.invoke(o, i));
25
+ }
26
+ return result;
27
+
28
+ } catch (NoSuchMethodException e) {
29
+ return Collections.EMPTY_LIST;
30
+ } catch (IllegalArgumentException e) {
31
+ return Collections.EMPTY_LIST;
32
+ } catch (IllegalAccessException e) {
33
+ return Collections.EMPTY_LIST;
34
+ } catch (InvocationTargetException e) {
35
+ return Collections.EMPTY_LIST;
36
+ }
37
+
38
+ }
39
+
40
+ @SuppressWarnings({ "unchecked", "rawtypes" })
41
+ public static List parents(Object o)
42
+ {
43
+ try {
44
+
45
+ Method getParent = o.getClass().getMethod("getParent");
46
+ getParent.setAccessible(true);
47
+
48
+ List result = new ArrayList(8);
49
+ try {
50
+ while (true)
51
+ {
52
+ Object parent = getParent.invoke(o);
53
+ if (parent == null)
54
+ {
55
+ return result;
56
+ }
57
+ else
58
+ {
59
+ result.add(parent);
60
+ }
61
+ o = parent;
62
+ }
63
+ } catch (IllegalArgumentException e) {
64
+ return result;
65
+ } catch (IllegalAccessException e) {
66
+ return result;
67
+ } catch (InvocationTargetException e) {
68
+ return result;
69
+ }
70
+
71
+
72
+ } catch (NoSuchMethodException e) {
73
+ return Collections.EMPTY_LIST;
74
+ }
75
+
76
+ }
77
+
78
+ @SuppressWarnings({ "rawtypes" })
79
+ public static Method hasProperty(Object o, String propertyName) {
80
+
81
+ Class c = o.getClass();
82
+ Method method = methodOrNull(c,propertyName);
83
+ if (method != null) { return method;}
84
+ method = methodOrNull(c,"get"+captitalize(propertyName));
85
+ if (method != null) { return method;}
86
+ method = methodOrNull(c,"is"+captitalize(propertyName));
87
+ return method;
88
+
89
+ /*
90
+ for (Method m : methods)
91
+ {
92
+ String methodName = m.getName();
93
+ if (methodName.equals(propertyName) ||
94
+ methodName.equals("is"+captitalize(propertyName)) ||
95
+ methodName.equals("get"+captitalize(propertyName)))
96
+ {
97
+ return m;
98
+ }
99
+ }
100
+ */
101
+
102
+
103
+ }
104
+
105
+ @SuppressWarnings({ "unchecked", "rawtypes" })
106
+ private static Method methodOrNull(Class c, String methodName) {
107
+ try {
108
+ return c.getMethod(methodName);
109
+ } catch (NoSuchMethodException e) {
110
+ return null;
111
+ }
112
+ }
113
+
114
+ private static String captitalize(String propertyName) {
115
+ return propertyName.substring(0,1).toUpperCase() + propertyName.substring(1);
116
+ }
117
+
118
+ public static Object getProperty(Object receiver, Method m) {
119
+ try {
120
+ return m.invoke(receiver);
121
+ } catch (IllegalArgumentException e) {
122
+ throw new RuntimeException(e);
123
+ } catch (IllegalAccessException e) {
124
+ throw new RuntimeException(e);
125
+ } catch (InvocationTargetException e) {
126
+ throw new RuntimeException(e);
127
+ }
128
+ }
129
+
130
+ public static boolean isVisible(Object v) {
131
+ if (!(v instanceof View)) { return true; }
132
+ return ((View) v).isShown();
133
+ }
134
+
135
+ }
@@ -0,0 +1,134 @@
1
+ package sh.calaba.instrumentationbackend.query.tests;
2
+
3
+ import java.util.Arrays;
4
+ import java.util.Collections;
5
+ import java.util.List;
6
+
7
+ import junit.framework.TestCase;
8
+ import sh.calaba.instrumentationbackend.query.ast.UIQueryAST;
9
+ import sh.calaba.instrumentationbackend.query.ast.UIQueryASTClassName;
10
+ import sh.calaba.instrumentationbackend.query.ast.UIQueryEvaluator;
11
+
12
+ public class UIQueryTest extends TestCase {
13
+
14
+ @SuppressWarnings("rawtypes")
15
+ public void testEvaluateQueryOnEmpty() {
16
+ String query = "button";
17
+ List res = UIQueryEvaluator.evaluateQuery(query, Collections.EMPTY_LIST);
18
+ assertEquals(0, res.size());
19
+ }
20
+
21
+ public void testConvertSimpleQueryToUIQueryAst() throws Exception {
22
+ List<UIQueryAST> parsedQuery = UIQueryEvaluator.parseQuery("button");
23
+ assertEquals(1, parsedQuery.size());
24
+
25
+ UIQueryAST uiQueryAST = parsedQuery.get(0);
26
+
27
+ assertTrue(uiQueryAST instanceof UIQueryASTClassName);
28
+ assertEquals("button", ((UIQueryASTClassName)uiQueryAST).simpleClassName);
29
+
30
+ }
31
+
32
+ public void testConvertQualifiedQueryToUIQueryAst() throws Exception {
33
+ List<UIQueryAST> parsedQuery = UIQueryEvaluator.parseQuery("junit.framework.TestCase");
34
+ assertEquals(1, parsedQuery.size());
35
+
36
+ UIQueryAST uiQueryAST = parsedQuery.get(0);
37
+
38
+ assertTrue(uiQueryAST instanceof UIQueryASTClassName);
39
+ assertEquals(junit.framework.TestCase.class, ((UIQueryASTClassName)uiQueryAST).qualifiedClassName);
40
+ }
41
+
42
+ public void testConvertComposedQueryToUIQueryAst() throws Exception {
43
+ List<UIQueryAST> parsedQuery = UIQueryEvaluator.parseQuery("view button");
44
+ assertEquals(2, parsedQuery.size());
45
+
46
+ UIQueryAST uiQueryASTFirst = parsedQuery.get(0);
47
+ UIQueryAST uiQueryASTSecond = parsedQuery.get(1);
48
+
49
+ assertTrue(uiQueryASTFirst instanceof UIQueryASTClassName);
50
+ assertTrue(uiQueryASTSecond instanceof UIQueryASTClassName);
51
+
52
+ assertEquals("view", ((UIQueryASTClassName)uiQueryASTFirst).simpleClassName);
53
+ assertEquals("button", ((UIQueryASTClassName)uiQueryASTSecond).simpleClassName);
54
+
55
+ }
56
+
57
+
58
+ private static class View {
59
+ @SuppressWarnings("rawtypes")
60
+ List views;
61
+
62
+ @SuppressWarnings("rawtypes")
63
+ public View(List views) {
64
+ super();
65
+ this.views = views;
66
+ }
67
+ public Object getChildAt(int idx)
68
+ {
69
+ return this.views.get(idx);
70
+ }
71
+ @SuppressWarnings("unused")
72
+ public Object getChildCount() {return this.views.size();}
73
+
74
+ }
75
+ private static class SubView extends View {
76
+
77
+ @SuppressWarnings("rawtypes")
78
+ public SubView(List views) {
79
+ super(views);
80
+ }
81
+
82
+ }
83
+ private static class Button extends View {
84
+
85
+ @SuppressWarnings("rawtypes")
86
+ public Button(List views) {
87
+ super(views);
88
+ // TODO Auto-generated constructor stub
89
+ }
90
+
91
+ }
92
+
93
+ @SuppressWarnings("rawtypes")
94
+ public void testEvaluateSimpleQuery() throws Exception {
95
+ List<View> views = setupViews();
96
+
97
+ List evaluateQuery = UIQueryEvaluator.evaluateQuery("subview", views);
98
+ assertEquals(1, evaluateQuery.size());
99
+ assertTrue(evaluateQuery.get(0) instanceof SubView);
100
+
101
+ List evaluateQueryButtons = UIQueryEvaluator.evaluateQuery("button", views);
102
+ assertEquals(3, evaluateQueryButtons.size());
103
+ assertTrue(evaluateQueryButtons.get(0) instanceof Button);
104
+ assertTrue(evaluateQueryButtons.get(1) instanceof Button);
105
+ assertTrue(evaluateQueryButtons.get(2) instanceof Button);
106
+
107
+ }
108
+
109
+
110
+ @SuppressWarnings("rawtypes")
111
+ public void testEvaluateComposedQuery() throws Exception {
112
+ List<View> views = setupViews();
113
+ SubView vv = (SubView) views.get(1);
114
+ Button b = (Button) vv.getChildAt(0);
115
+
116
+ List evaluateQuery = UIQueryEvaluator.evaluateQuery("subview button", views);
117
+ assertEquals(1, evaluateQuery.size());
118
+ assertTrue(evaluateQuery.get(0) instanceof Button);
119
+ assertEquals(evaluateQuery.get(0), b);
120
+
121
+
122
+ }
123
+
124
+ private List<View> setupViews() {
125
+ return Arrays.asList(new View[]{
126
+ new Button(Collections.EMPTY_LIST),
127
+ new SubView(Arrays.asList(new View[]{
128
+ new Button(Collections.EMPTY_LIST)
129
+ })),
130
+ new Button(Collections.EMPTY_LIST)
131
+ });
132
+ }
133
+
134
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.pre1
4
+ version: 0.4.0.pre2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-10 00:00:00.000000000 Z
12
+ date: 2012-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber
@@ -160,7 +160,13 @@ files:
160
160
  - test-server/instrumentation-backend/.project
161
161
  - test-server/instrumentation-backend/.settings/org.eclipse.jdt.core.prefs
162
162
  - test-server/instrumentation-backend/AndroidManifest.xml
163
+ - test-server/instrumentation-backend/antlr.sh
164
+ - test-server/instrumentation-backend/antlr/UIQuery.g
165
+ - test-server/instrumentation-backend/antlr/UIQuery.tokens
163
166
  - test-server/instrumentation-backend/assets/foo.bar
167
+ - test-server/instrumentation-backend/build-libs/antlr-3.4-complete.jar
168
+ - test-server/instrumentation-backend/build-libs/junit.jar
169
+ - test-server/instrumentation-backend/build.xml
164
170
  - test-server/instrumentation-backend/libs/robotium-solo-3.6.jar
165
171
  - test-server/instrumentation-backend/project.properties
166
172
  - test-server/instrumentation-backend/res/drawable-hdpi/ic_launcher.png
@@ -171,6 +177,91 @@ files:
171
177
  - test-server/instrumentation-backend/src/com/jayway/android/robotium/solo/MapViewUtils.java
172
178
  - test-server/instrumentation-backend/src/com/jayway/android/robotium/solo/PublicViewFetcher.java
173
179
  - test-server/instrumentation-backend/src/com/jayway/android/robotium/solo/SoloEnhanced.java
180
+ - test-server/instrumentation-backend/src/org/antlr/runtime/ANTLRFileStream.java
181
+ - test-server/instrumentation-backend/src/org/antlr/runtime/ANTLRInputStream.java
182
+ - test-server/instrumentation-backend/src/org/antlr/runtime/ANTLRReaderStream.java
183
+ - test-server/instrumentation-backend/src/org/antlr/runtime/ANTLRStringStream.java
184
+ - test-server/instrumentation-backend/src/org/antlr/runtime/BaseRecognizer.java
185
+ - test-server/instrumentation-backend/src/org/antlr/runtime/BitSet.java
186
+ - test-server/instrumentation-backend/src/org/antlr/runtime/BufferedTokenStream.java
187
+ - test-server/instrumentation-backend/src/org/antlr/runtime/CharStream.java
188
+ - test-server/instrumentation-backend/src/org/antlr/runtime/CharStreamState.java
189
+ - test-server/instrumentation-backend/src/org/antlr/runtime/ClassicToken.java
190
+ - test-server/instrumentation-backend/src/org/antlr/runtime/CommonToken.java
191
+ - test-server/instrumentation-backend/src/org/antlr/runtime/CommonTokenStream.java
192
+ - test-server/instrumentation-backend/src/org/antlr/runtime/DFA.java
193
+ - test-server/instrumentation-backend/src/org/antlr/runtime/EarlyExitException.java
194
+ - test-server/instrumentation-backend/src/org/antlr/runtime/FailedPredicateException.java
195
+ - test-server/instrumentation-backend/src/org/antlr/runtime/IntStream.java
196
+ - test-server/instrumentation-backend/src/org/antlr/runtime/LegacyCommonTokenStream.java
197
+ - test-server/instrumentation-backend/src/org/antlr/runtime/Lexer.java
198
+ - test-server/instrumentation-backend/src/org/antlr/runtime/MismatchedNotSetException.java
199
+ - test-server/instrumentation-backend/src/org/antlr/runtime/MismatchedRangeException.java
200
+ - test-server/instrumentation-backend/src/org/antlr/runtime/MismatchedSetException.java
201
+ - test-server/instrumentation-backend/src/org/antlr/runtime/MismatchedTokenException.java
202
+ - test-server/instrumentation-backend/src/org/antlr/runtime/MismatchedTreeNodeException.java
203
+ - test-server/instrumentation-backend/src/org/antlr/runtime/MissingTokenException.java
204
+ - test-server/instrumentation-backend/src/org/antlr/runtime/NoViableAltException.java
205
+ - test-server/instrumentation-backend/src/org/antlr/runtime/Parser.java
206
+ - test-server/instrumentation-backend/src/org/antlr/runtime/ParserRuleReturnScope.java
207
+ - test-server/instrumentation-backend/src/org/antlr/runtime/RecognitionException.java
208
+ - test-server/instrumentation-backend/src/org/antlr/runtime/RecognizerSharedState.java
209
+ - test-server/instrumentation-backend/src/org/antlr/runtime/RuleReturnScope.java
210
+ - test-server/instrumentation-backend/src/org/antlr/runtime/SerializedGrammar.java
211
+ - test-server/instrumentation-backend/src/org/antlr/runtime/Token.java
212
+ - test-server/instrumentation-backend/src/org/antlr/runtime/TokenRewriteStream.java
213
+ - test-server/instrumentation-backend/src/org/antlr/runtime/TokenSource.java
214
+ - test-server/instrumentation-backend/src/org/antlr/runtime/TokenStream.java
215
+ - test-server/instrumentation-backend/src/org/antlr/runtime/UnbufferedTokenStream.java
216
+ - test-server/instrumentation-backend/src/org/antlr/runtime/UnwantedTokenException.java
217
+ - test-server/instrumentation-backend/src/org/antlr/runtime/debug/BlankDebugEventListener.java
218
+ - test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugEventHub.java
219
+ - test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugEventListener.java
220
+ - test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugEventRepeater.java
221
+ - test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugEventSocketProxy.java
222
+ - test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugParser.java
223
+ - test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugTokenStream.java
224
+ - test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugTreeAdaptor.java
225
+ - test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugTreeNodeStream.java
226
+ - test-server/instrumentation-backend/src/org/antlr/runtime/debug/DebugTreeParser.java
227
+ - test-server/instrumentation-backend/src/org/antlr/runtime/debug/ParseTreeBuilder.java
228
+ - test-server/instrumentation-backend/src/org/antlr/runtime/debug/Profiler.java
229
+ - test-server/instrumentation-backend/src/org/antlr/runtime/debug/RemoteDebugEventSocketListener.java
230
+ - test-server/instrumentation-backend/src/org/antlr/runtime/debug/TraceDebugEventListener.java
231
+ - test-server/instrumentation-backend/src/org/antlr/runtime/debug/Tracer.java
232
+ - test-server/instrumentation-backend/src/org/antlr/runtime/misc/DoubleKeyMap.java
233
+ - test-server/instrumentation-backend/src/org/antlr/runtime/misc/FastQueue.java
234
+ - test-server/instrumentation-backend/src/org/antlr/runtime/misc/IntArray.java
235
+ - test-server/instrumentation-backend/src/org/antlr/runtime/misc/LookaheadStream.java
236
+ - test-server/instrumentation-backend/src/org/antlr/runtime/misc/Stats.java
237
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/BaseTree.java
238
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/BaseTreeAdaptor.java
239
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/BufferedTreeNodeStream.java
240
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/CommonErrorNode.java
241
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/CommonTree.java
242
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/CommonTreeAdaptor.java
243
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/CommonTreeNodeStream.java
244
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/ParseTree.java
245
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteCardinalityException.java
246
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteEarlyExitException.java
247
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteEmptyStreamException.java
248
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteRuleElementStream.java
249
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteRuleNodeStream.java
250
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteRuleSubtreeStream.java
251
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/RewriteRuleTokenStream.java
252
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/Tree.java
253
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeAdaptor.java
254
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeFilter.java
255
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeIterator.java
256
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeNodeStream.java
257
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeParser.java
258
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreePatternLexer.java
259
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreePatternParser.java
260
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeRewriter.java
261
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeRuleReturnScope.java
262
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeVisitor.java
263
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeVisitorAction.java
264
+ - test-server/instrumentation-backend/src/org/antlr/runtime/tree/TreeWizard.java
174
265
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/CalabashInstrumentationTestRunner.java
175
266
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearAppData.java
176
267
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/Command.java
@@ -184,7 +275,6 @@ files:
184
275
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/NanoHTTPD.java
185
276
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/NullAction.java
186
277
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/activity/SetActivityOrientation.java
187
- - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/activity/SetOrientation.java
188
278
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressButtonNumber.java
189
279
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressButtonText.java
190
280
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonDescription.java
@@ -281,6 +371,18 @@ files:
281
371
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/Touch.java
282
372
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/Query.java
283
373
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/QueryResult.java
374
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/UIQuery.tokens
375
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ViewMapper.java
376
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/antlr/UIQuery.tokens
377
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/antlr/UIQueryLexer.java
378
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/antlr/UIQueryParser.java
379
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/InvalidUIQueryException.java
380
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryAST.java
381
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryASTClassName.java
382
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryASTWith.java
383
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryDirection.java
384
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryEvaluator.java
385
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryUtils.java
284
386
  - test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/Base64Variant.java
285
387
  - test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/Base64Variants.java
286
388
  - test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/FormatSchema.java
@@ -687,6 +789,7 @@ files:
687
789
  - test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/TokenBuffer.java
688
790
  - test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/VersionUtil.java
689
791
  - test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/package-info.java
792
+ - test-server/instrumentation-backend/tests/sh/calaba/instrumentationbackend/query/tests/UIQueryTest.java
690
793
  - test-server/calabash-js/src/calabash.js
691
794
  - test-server/calabash-js/src/set_text.js
692
795
  - lib/calabash-android/lib/TestServer.apk
@@ -1,39 +0,0 @@
1
- package sh.calaba.instrumentationbackend.actions.map;
2
-
3
- import sh.calaba.instrumentationbackend.InstrumentationBackend;
4
- import sh.calaba.instrumentationbackend.Result;
5
- import sh.calaba.instrumentationbackend.actions.Action;
6
-
7
- public class SetOrientation implements Action {
8
-
9
- @Override
10
- public Result execute(String... args) {
11
- String orientation = "";
12
- if (args != null && args.length >= 1) {
13
- orientation = args[0].toLowerCase();
14
- }
15
-
16
- int changed = -1;
17
-
18
- if( "landscape".contentEquals(orientation) ) {
19
- changed = 0;
20
- } else if( "portrait".contentEquals(orientation) ) {
21
- changed = 1;
22
- }
23
-
24
- if (changed != -1) {
25
- InstrumentationBackend.solo.setActivityOrientation(changed);
26
- // Wait 100ms for orientation to happen.
27
- try { Thread.sleep(100); } catch (Exception e) {}
28
- // setActivityOrientation returns void so assume success.
29
- return Result.successResult();
30
- }
31
-
32
- return new Result(false, "Requested invalid orientation: '" + orientation + "' Expected 'landscape' or 'portrait'.");
33
- }
34
-
35
- @Override
36
- public String key() {
37
- return "set_orientation";
38
- }
39
- }