cukunity 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. data/.document +5 -0
  2. data/.gitmodules +0 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +15 -0
  5. data/Gemfile.lock +60 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.md +214 -0
  8. data/Rakefile +51 -0
  9. data/Unity/Assets/Demo/Art/Buttons/down.png +0 -0
  10. data/Unity/Assets/Demo/Art/Buttons/down.png.meta +28 -0
  11. data/Unity/Assets/Demo/Art/Buttons/left.png +0 -0
  12. data/Unity/Assets/Demo/Art/Buttons/left.png.meta +28 -0
  13. data/Unity/Assets/Demo/Art/Buttons/ok.png +0 -0
  14. data/Unity/Assets/Demo/Art/Buttons/ok.png.meta +28 -0
  15. data/Unity/Assets/Demo/Art/Buttons/options.png +0 -0
  16. data/Unity/Assets/Demo/Art/Buttons/options.png.meta +28 -0
  17. data/Unity/Assets/Demo/Art/Buttons/play.png +0 -0
  18. data/Unity/Assets/Demo/Art/Buttons/play.png.meta +28 -0
  19. data/Unity/Assets/Demo/Art/Buttons/quit.png +0 -0
  20. data/Unity/Assets/Demo/Art/Buttons/quit.png.meta +28 -0
  21. data/Unity/Assets/Demo/Art/Buttons/retry.png +0 -0
  22. data/Unity/Assets/Demo/Art/Buttons/retry.png.meta +28 -0
  23. data/Unity/Assets/Demo/Art/Buttons/right.png +0 -0
  24. data/Unity/Assets/Demo/Art/Buttons/right.png.meta +28 -0
  25. data/Unity/Assets/Demo/Art/Buttons/up.png +0 -0
  26. data/Unity/Assets/Demo/Art/Buttons/up.png.meta +28 -0
  27. data/Unity/Assets/Demo/Art/Buttons.meta +2 -0
  28. data/Unity/Assets/Demo/Art/clear.png +0 -0
  29. data/Unity/Assets/Demo/Art/clear.png.meta +28 -0
  30. data/Unity/Assets/Demo/Art/options.png +0 -0
  31. data/Unity/Assets/Demo/Art/options.png.meta +28 -0
  32. data/Unity/Assets/Demo/Art/sokoban.png +0 -0
  33. data/Unity/Assets/Demo/Art/sokoban.png.meta +28 -0
  34. data/Unity/Assets/Demo/Art.meta +2 -0
  35. data/Unity/Assets/Demo/Cubes/CrateCube.mat +0 -0
  36. data/Unity/Assets/Demo/Cubes/CrateCube.mat.meta +2 -0
  37. data/Unity/Assets/Demo/Cubes/CrateCube.prefab +0 -0
  38. data/Unity/Assets/Demo/Cubes/CrateCube.prefab.meta +2 -0
  39. data/Unity/Assets/Demo/Cubes/FloorCube.mat +0 -0
  40. data/Unity/Assets/Demo/Cubes/FloorCube.mat.meta +2 -0
  41. data/Unity/Assets/Demo/Cubes/FloorCube.prefab +0 -0
  42. data/Unity/Assets/Demo/Cubes/FloorCube.prefab.meta +2 -0
  43. data/Unity/Assets/Demo/Cubes/GoalCube.mat +0 -0
  44. data/Unity/Assets/Demo/Cubes/GoalCube.mat.meta +2 -0
  45. data/Unity/Assets/Demo/Cubes/GoalCube.prefab +0 -0
  46. data/Unity/Assets/Demo/Cubes/GoalCube.prefab.meta +2 -0
  47. data/Unity/Assets/Demo/Cubes/PlayerCube.mat +0 -0
  48. data/Unity/Assets/Demo/Cubes/PlayerCube.mat.meta +2 -0
  49. data/Unity/Assets/Demo/Cubes/PlayerCube.prefab +0 -0
  50. data/Unity/Assets/Demo/Cubes/PlayerCube.prefab.meta +2 -0
  51. data/Unity/Assets/Demo/Cubes/WallCube.mat +0 -0
  52. data/Unity/Assets/Demo/Cubes/WallCube.mat.meta +2 -0
  53. data/Unity/Assets/Demo/Cubes/WallCube.prefab +0 -0
  54. data/Unity/Assets/Demo/Cubes/WallCube.prefab.meta +2 -0
  55. data/Unity/Assets/Demo/Cubes.meta +2 -0
  56. data/Unity/Assets/Demo/Resources/MainMenu.prefab +0 -0
  57. data/Unity/Assets/Demo/Resources/MainMenu.prefab.meta +2 -0
  58. data/Unity/Assets/Demo/Resources/OptionsMenu.prefab +0 -0
  59. data/Unity/Assets/Demo/Resources/OptionsMenu.prefab.meta +2 -0
  60. data/Unity/Assets/Demo/Resources.meta +2 -0
  61. data/Unity/Assets/Demo/Scripts/CameraController.js +18 -0
  62. data/Unity/Assets/Demo/Scripts/CameraController.js.meta +2 -0
  63. data/Unity/Assets/Demo/Scripts/EnterPlayerName.js +21 -0
  64. data/Unity/Assets/Demo/Scripts/EnterPlayerName.js.meta +2 -0
  65. data/Unity/Assets/Demo/Scripts/GameLeftButton.js +18 -0
  66. data/Unity/Assets/Demo/Scripts/GameLeftButton.js.meta +2 -0
  67. data/Unity/Assets/Demo/Scripts/GameQuitButton.js +6 -0
  68. data/Unity/Assets/Demo/Scripts/GameQuitButton.js.meta +2 -0
  69. data/Unity/Assets/Demo/Scripts/GameRetryButton.js +7 -0
  70. data/Unity/Assets/Demo/Scripts/GameRetryButton.js.meta +2 -0
  71. data/Unity/Assets/Demo/Scripts/GameRightButton.js +18 -0
  72. data/Unity/Assets/Demo/Scripts/GameRightButton.js.meta +2 -0
  73. data/Unity/Assets/Demo/Scripts/GameUpButton.js +18 -0
  74. data/Unity/Assets/Demo/Scripts/GameUpButton.js.meta +2 -0
  75. data/Unity/Assets/Demo/Scripts/OnTouchGUIElementDown.js +34 -0
  76. data/Unity/Assets/Demo/Scripts/OnTouchGUIElementDown.js.meta +2 -0
  77. data/Unity/Assets/Demo/Scripts/PlayerData.js +3 -0
  78. data/Unity/Assets/Demo/Scripts/PlayerData.js.meta +2 -0
  79. data/Unity/Assets/Demo/Scripts/SokobanController.js +240 -0
  80. data/Unity/Assets/Demo/Scripts/SokobanController.js.meta +2 -0
  81. data/Unity/Assets/Demo/Scripts/TakeScreenShot.js +26 -0
  82. data/Unity/Assets/Demo/Scripts/TakeScreenShot.js.meta +2 -0
  83. data/Unity/Assets/Demo/Scripts/TitleOptionsButton.js +8 -0
  84. data/Unity/Assets/Demo/Scripts/TitleOptionsButton.js.meta +2 -0
  85. data/Unity/Assets/Demo/Scripts/TitleOptionsOkButton.js +8 -0
  86. data/Unity/Assets/Demo/Scripts/TitleOptionsOkButton.js.meta +2 -0
  87. data/Unity/Assets/Demo/Scripts/TitlePlayButton.js +6 -0
  88. data/Unity/Assets/Demo/Scripts/TitlePlayButton.js.meta +2 -0
  89. data/Unity/Assets/Demo/Scripts/TitleQuitButton.js +7 -0
  90. data/Unity/Assets/Demo/Scripts/TitleQuitButton.js.meta +2 -0
  91. data/Unity/Assets/Demo/Scripts/UpdateMovesLabel.js +26 -0
  92. data/Unity/Assets/Demo/Scripts/UpdateMovesLabel.js.meta +2 -0
  93. data/Unity/Assets/Demo/Scripts/UpdatePlayerName.js +14 -0
  94. data/Unity/Assets/Demo/Scripts/UpdatePlayerName.js.meta +2 -0
  95. data/Unity/Assets/Demo/Scripts.meta +2 -0
  96. data/Unity/Assets/Demo/demo_game.unity +0 -0
  97. data/Unity/Assets/Demo/demo_game.unity.meta +2 -0
  98. data/Unity/Assets/Demo/demo_title.unity +0 -0
  99. data/Unity/Assets/Demo/demo_title.unity.meta +2 -0
  100. data/Unity/Assets/Demo.meta +2 -0
  101. data/Unity/Assets/Plugins/CukunityInstance.prefab +0 -0
  102. data/Unity/Assets/Plugins/CukunityInstance.prefab.meta +2 -0
  103. data/Unity/Assets/Plugins/CukunityServer.cs +871 -0
  104. data/Unity/Assets/Plugins/CukunityServer.cs.meta +2 -0
  105. data/Unity/Assets/Plugins/JsonFx.Json.dll +0 -0
  106. data/Unity/Assets/Plugins/JsonFx.Json.dll.meta +2 -0
  107. data/Unity/Assets/Plugins/iOS/CukunityServer.mm +242 -0
  108. data/Unity/Assets/Plugins/iOS/CukunityServer.mm.meta +2 -0
  109. data/Unity/Assets/Plugins/iOS.meta +2 -0
  110. data/Unity/Assets/Plugins.meta +2 -0
  111. data/Unity/Library/AudioManager.asset +0 -0
  112. data/Unity/Library/BuildSettings.asset +0 -0
  113. data/Unity/Library/DynamicsManager.asset +0 -0
  114. data/Unity/Library/EditorBuildSettings.asset +0 -0
  115. data/Unity/Library/EditorSettings.asset +0 -0
  116. data/Unity/Library/EditorUserBuildSettings.asset +0 -0
  117. data/Unity/Library/EditorUserSettings.asset +0 -0
  118. data/Unity/Library/InputManager.asset +0 -0
  119. data/Unity/Library/InspectorExpandedItems.asset +0 -0
  120. data/Unity/Library/MonoManager.asset +0 -0
  121. data/Unity/Library/NetworkManager.asset +0 -0
  122. data/Unity/Library/ProjectSettings.asset +0 -0
  123. data/Unity/Library/QualitySettings.asset +0 -0
  124. data/Unity/Library/TagManager.asset +0 -0
  125. data/Unity/Library/TimeManager.asset +0 -0
  126. data/Unity/ProjectSettings/AudioManager.asset +0 -0
  127. data/Unity/ProjectSettings/DynamicsManager.asset +0 -0
  128. data/Unity/ProjectSettings/EditorBuildSettings.asset +0 -0
  129. data/Unity/ProjectSettings/EditorSettings.asset +0 -0
  130. data/Unity/ProjectSettings/InputManager.asset +0 -0
  131. data/Unity/ProjectSettings/NavMeshLayers.asset +0 -0
  132. data/Unity/ProjectSettings/NetworkManager.asset +0 -0
  133. data/Unity/ProjectSettings/ProjectSettings.asset +0 -0
  134. data/Unity/ProjectSettings/QualitySettings.asset +0 -0
  135. data/Unity/ProjectSettings/TagManager.asset +0 -0
  136. data/Unity/ProjectSettings/TimeManager.asset +0 -0
  137. data/VERSION +1 -0
  138. data/bin/cukunity +7 -0
  139. data/cukunity.gemspec +298 -0
  140. data/features/get_scene_command.feature +39 -0
  141. data/features/i18n/ja/sokoban_clear.feature +109 -0
  142. data/features/install.feature +23 -0
  143. data/features/keyboard_input.feature +26 -0
  144. data/features/load_level_command.feature +36 -0
  145. data/features/run.feature +33 -0
  146. data/features/select_visible.feature +29 -0
  147. data/features/support/env.rb +11 -0
  148. data/features/touch_input.feature +96 -0
  149. data/lib/cukunity/cli/argument_parser.rb +103 -0
  150. data/lib/cukunity/cli/bootstrap_command.rb +39 -0
  151. data/lib/cukunity/cli/doctor_command.rb +150 -0
  152. data/lib/cukunity/cli/features_command.rb +35 -0
  153. data/lib/cukunity/cli/main.rb +18 -0
  154. data/lib/cukunity/cli/options.rb +8 -0
  155. data/lib/cukunity/cli.rb +11 -0
  156. data/lib/cukunity/cucumber/step_definitions/get_scene_command_steps.rb +37 -0
  157. data/lib/cukunity/cucumber/step_definitions/i18n/ja/get_scene_command_steps.rb +37 -0
  158. data/lib/cukunity/cucumber/step_definitions/i18n/ja/install_steps.rb +25 -0
  159. data/lib/cukunity/cucumber/step_definitions/i18n/ja/keyboard_input_steps.rb +17 -0
  160. data/lib/cukunity/cucumber/step_definitions/i18n/ja/load_level_command_steps.rb +17 -0
  161. data/lib/cukunity/cucumber/step_definitions/i18n/ja/run_steps.rb +25 -0
  162. data/lib/cukunity/cucumber/step_definitions/i18n/ja/select_visible_steps.rb +9 -0
  163. data/lib/cukunity/cucumber/step_definitions/i18n/ja/touch_input_steps.rb +19 -0
  164. data/lib/cukunity/cucumber/step_definitions/i18n/ja.rb +9 -0
  165. data/lib/cukunity/cucumber/step_definitions/install_steps.rb +33 -0
  166. data/lib/cukunity/cucumber/step_definitions/keyboard_input_steps.rb +13 -0
  167. data/lib/cukunity/cucumber/step_definitions/load_level_command_steps.rb +17 -0
  168. data/lib/cukunity/cucumber/step_definitions/run_steps.rb +32 -0
  169. data/lib/cukunity/cucumber/step_definitions/select_visible_steps.rb +15 -0
  170. data/lib/cukunity/cucumber/step_definitions/touch_input_steps.rb +18 -0
  171. data/lib/cukunity/cucumber/support/platform_helpers.rb +105 -0
  172. data/lib/cukunity/cucumber/support/spec_helpers.rb +21 -0
  173. data/lib/cukunity/cucumber/support/transforms.rb +5 -0
  174. data/lib/cukunity/cucumber/support/unity_helpers.rb +35 -0
  175. data/lib/cukunity/cucumber.rb +28 -0
  176. data/lib/cukunity/drivers/android/app.rb +43 -0
  177. data/lib/cukunity/drivers/android/appkiller/.gitignore +9 -0
  178. data/lib/cukunity/drivers/android/appkiller/AndroidManifest.xml +17 -0
  179. data/lib/cukunity/drivers/android/appkiller/ant.properties +17 -0
  180. data/lib/cukunity/drivers/android/appkiller/build.xml +85 -0
  181. data/lib/cukunity/drivers/android/appkiller/proguard.cfg +40 -0
  182. data/lib/cukunity/drivers/android/appkiller/project.properties +11 -0
  183. data/lib/cukunity/drivers/android/appkiller/res/layout/main.xml +13 -0
  184. data/lib/cukunity/drivers/android/appkiller/res/values/strings.xml +4 -0
  185. data/lib/cukunity/drivers/android/appkiller/src/cukunity/appkiller/AppKiller.java +29 -0
  186. data/lib/cukunity/drivers/android/keyboard_input.rb +149 -0
  187. data/lib/cukunity/drivers/android/keycodes.rb +531 -0
  188. data/lib/cukunity/drivers/android/monkey_client.rb +65 -0
  189. data/lib/cukunity/drivers/android/process.rb +103 -0
  190. data/lib/cukunity/drivers/android/touch_input.rb +24 -0
  191. data/lib/cukunity/drivers/android/tunnel_client_methods.rb +22 -0
  192. data/lib/cukunity/drivers/android/unity_client.rb +27 -0
  193. data/lib/cukunity/drivers/android/utils.rb +50 -0
  194. data/lib/cukunity/drivers/android.rb +9 -0
  195. data/lib/cukunity/drivers/iOS/app.rb +32 -0
  196. data/lib/cukunity/drivers/iOS/keyboard_input.rb +104 -0
  197. data/lib/cukunity/drivers/iOS/process.rb +42 -0
  198. data/lib/cukunity/drivers/iOS/touch_input.rb +18 -0
  199. data/lib/cukunity/drivers/iOS/tunnel_client_methods.rb +27 -0
  200. data/lib/cukunity/drivers/iOS/uiautomation.rb +97 -0
  201. data/lib/cukunity/drivers/iOS/uiautomation_master.rb +152 -0
  202. data/lib/cukunity/drivers/iOS/uiautomation_slave.js +238 -0
  203. data/lib/cukunity/drivers/iOS/uiautomation_slave.rb +41 -0
  204. data/lib/cukunity/drivers/iOS/unity_client.rb +27 -0
  205. data/lib/cukunity/drivers/iOS/utils.rb +46 -0
  206. data/lib/cukunity/drivers/iOS.rb +9 -0
  207. data/lib/cukunity/exceptions.rb +24 -0
  208. data/lib/cukunity/keyboard_input_methods.rb +35 -0
  209. data/lib/cukunity/request_line_response_client_methods.rb +80 -0
  210. data/lib/cukunity/tasks/cucumber.rake +22 -0
  211. data/lib/cukunity/touch_input_methods.rb +19 -0
  212. data/lib/cukunity/unity/client_methods.rb +46 -0
  213. data/lib/cukunity/unity/command_facade.rb +67 -0
  214. data/lib/cukunity/unity/component.rb +39 -0
  215. data/lib/cukunity/unity/gameobject.rb +53 -0
  216. data/lib/cukunity/unity/hint.rb +27 -0
  217. data/lib/cukunity/unity/json_container.rb +48 -0
  218. data/lib/cukunity/unity/level.rb +6 -0
  219. data/lib/cukunity/unity/scene.rb +18 -0
  220. data/lib/cukunity/unity/screen.rb +45 -0
  221. data/lib/cukunity/unity/screen_hint_methods.rb +61 -0
  222. data/lib/cukunity/unity/text_hint_methods.rb +17 -0
  223. data/lib/cukunity/unity.rb +11 -0
  224. data/lib/cukunity/utils.rb +56 -0
  225. data/lib/cukunity.rb +19 -0
  226. metadata +411 -0
@@ -0,0 +1,531 @@
1
+ module Cukunity
2
+ module Android
3
+ module KeyboardInput
4
+ module KeyCodes
5
+ # Key code constant: Unknown key code.
6
+ KEYCODE_UNKNOWN = 0
7
+ # Key code constant: Soft Left key.
8
+ # Usually situated below the display on phones and used as a multi-function
9
+ # feature key for selecting a software defined function shown on the bottom left
10
+ # of the display.
11
+ KEYCODE_SOFT_LEFT = 1
12
+ # Key code constant: Soft Right key.
13
+ # Usually situated below the display on phones and used as a multi-function
14
+ # feature key for selecting a software defined function shown on the bottom right
15
+ # of the display.
16
+ KEYCODE_SOFT_RIGHT = 2
17
+ # Key code constant: Home key.
18
+ # This key is handled by the framework and is never delivered to applications.
19
+ KEYCODE_HOME = 3
20
+ # Key code constant: Back key.
21
+ KEYCODE_BACK = 4
22
+ # Key code constant: Call key.
23
+ KEYCODE_CALL = 5
24
+ # Key code constant: End Call key.
25
+ KEYCODE_ENDCALL = 6
26
+ # Key code constant: '0' key.
27
+ KEYCODE_0 = 7
28
+ # Key code constant: '1' key.
29
+ KEYCODE_1 = 8
30
+ # Key code constant: '2' key.
31
+ KEYCODE_2 = 9
32
+ # Key code constant: '3' key.
33
+ KEYCODE_3 = 10
34
+ # Key code constant: '4' key.
35
+ KEYCODE_4 = 11
36
+ # Key code constant: '5' key.
37
+ KEYCODE_5 = 12
38
+ # Key code constant: '6' key.
39
+ KEYCODE_6 = 13
40
+ # Key code constant: '7' key.
41
+ KEYCODE_7 = 14
42
+ # Key code constant: '8' key.
43
+ KEYCODE_8 = 15
44
+ # Key code constant: '9' key.
45
+ KEYCODE_9 = 16
46
+ # Key code constant: '*' key.
47
+ KEYCODE_STAR = 17
48
+ # Key code constant: '#' key.
49
+ KEYCODE_POUND = 18
50
+ # Key code constant: Directional Pad Up key.
51
+ # May also be synthesized from trackball motions.
52
+ KEYCODE_DPAD_UP = 19
53
+ # Key code constant: Directional Pad Down key.
54
+ # May also be synthesized from trackball motions.
55
+ KEYCODE_DPAD_DOWN = 20
56
+ # Key code constant: Directional Pad Left key.
57
+ # May also be synthesized from trackball motions.
58
+ KEYCODE_DPAD_LEFT = 21
59
+ # Key code constant: Directional Pad Right key.
60
+ # May also be synthesized from trackball motions.
61
+ KEYCODE_DPAD_RIGHT = 22
62
+ # Key code constant: Directional Pad Center key.
63
+ # May also be synthesized from trackball motions.
64
+ KEYCODE_DPAD_CENTER = 23
65
+ # Key code constant: Volume Up key.
66
+ # Adjusts the speaker volume up.
67
+ KEYCODE_VOLUME_UP = 24
68
+ # Key code constant: Volume Down key.
69
+ # Adjusts the speaker volume down.
70
+ KEYCODE_VOLUME_DOWN = 25
71
+ # Key code constant: Power key.
72
+ KEYCODE_POWER = 26
73
+ # Key code constant: Camera key.
74
+ # Used to launch a camera application or take pictures.
75
+ KEYCODE_CAMERA = 27
76
+ # Key code constant: Clear key.
77
+ KEYCODE_CLEAR = 28
78
+ # Key code constant: 'A' key.
79
+ KEYCODE_A = 29
80
+ # Key code constant: 'B' key.
81
+ KEYCODE_B = 30
82
+ # Key code constant: 'C' key.
83
+ KEYCODE_C = 31
84
+ # Key code constant: 'D' key.
85
+ KEYCODE_D = 32
86
+ # Key code constant: 'E' key.
87
+ KEYCODE_E = 33
88
+ # Key code constant: 'F' key.
89
+ KEYCODE_F = 34
90
+ # Key code constant: 'G' key.
91
+ KEYCODE_G = 35
92
+ # Key code constant: 'H' key.
93
+ KEYCODE_H = 36
94
+ # Key code constant: 'I' key.
95
+ KEYCODE_I = 37
96
+ # Key code constant: 'J' key.
97
+ KEYCODE_J = 38
98
+ # Key code constant: 'K' key.
99
+ KEYCODE_K = 39
100
+ # Key code constant: 'L' key.
101
+ KEYCODE_L = 40
102
+ # Key code constant: 'M' key.
103
+ KEYCODE_M = 41
104
+ # Key code constant: 'N' key.
105
+ KEYCODE_N = 42
106
+ # Key code constant: 'O' key.
107
+ KEYCODE_O = 43
108
+ # Key code constant: 'P' key.
109
+ KEYCODE_P = 44
110
+ # Key code constant: 'Q' key.
111
+ KEYCODE_Q = 45
112
+ # Key code constant: 'R' key.
113
+ KEYCODE_R = 46
114
+ # Key code constant: 'S' key.
115
+ KEYCODE_S = 47
116
+ # Key code constant: 'T' key.
117
+ KEYCODE_T = 48
118
+ # Key code constant: 'U' key.
119
+ KEYCODE_U = 49
120
+ # Key code constant: 'V' key.
121
+ KEYCODE_V = 50
122
+ # Key code constant: 'W' key.
123
+ KEYCODE_W = 51
124
+ # Key code constant: 'X' key.
125
+ KEYCODE_X = 52
126
+ # Key code constant: 'Y' key.
127
+ KEYCODE_Y = 53
128
+ # Key code constant: 'Z' key.
129
+ KEYCODE_Z = 54
130
+ # Key code constant: ',' key.
131
+ KEYCODE_COMMA = 55
132
+ # Key code constant: '.' key.
133
+ KEYCODE_PERIOD = 56
134
+ # Key code constant: Left Alt modifier key.
135
+ KEYCODE_ALT_LEFT = 57
136
+ # Key code constant: Right Alt modifier key.
137
+ KEYCODE_ALT_RIGHT = 58
138
+ # Key code constant: Left Shift modifier key.
139
+ KEYCODE_SHIFT_LEFT = 59
140
+ # Key code constant: Right Shift modifier key.
141
+ KEYCODE_SHIFT_RIGHT = 60
142
+ # Key code constant: Tab key.
143
+ KEYCODE_TAB = 61
144
+ # Key code constant: Space key.
145
+ KEYCODE_SPACE = 62
146
+ # Key code constant: Symbol modifier key.
147
+ # Used to enter alternate symbols.
148
+ KEYCODE_SYM = 63
149
+ # Key code constant: Explorer special function key.
150
+ # Used to launch a browser application.
151
+ KEYCODE_EXPLORER = 64
152
+ # Key code constant: Envelope special function key.
153
+ # Used to launch a mail application.
154
+ KEYCODE_ENVELOPE = 65
155
+ # Key code constant: Enter key.
156
+ KEYCODE_ENTER = 66
157
+ # Key code constant: Backspace key.
158
+ # Deletes characters before the insertion point, unlike {@link #KEYCODE_FORWARD_DEL}.
159
+ KEYCODE_DEL = 67
160
+ # Key code constant: '`' (backtick) key.
161
+ KEYCODE_GRAVE = 68
162
+ # Key code constant: '-'.
163
+ KEYCODE_MINUS = 69
164
+ # Key code constant: '=' key.
165
+ KEYCODE_EQUALS = 70
166
+ # Key code constant: '[' key.
167
+ KEYCODE_LEFT_BRACKET = 71
168
+ # Key code constant: ']' key.
169
+ KEYCODE_RIGHT_BRACKET = 72
170
+ # Key code constant: '\' key.
171
+ KEYCODE_BACKSLASH = 73
172
+ # Key code constant: '' key.
173
+ KEYCODE_SEMICOLON = 74
174
+ # Key code constant: ''' (apostrophe) key.
175
+ KEYCODE_APOSTROPHE = 75
176
+ # Key code constant: '/' key.
177
+ KEYCODE_SLASH = 76
178
+ # Key code constant: '@' key.
179
+ KEYCODE_AT = 77
180
+ # Key code constant: Number modifier key.
181
+ # Used to enter numeric symbols.
182
+ # This key is not Num Lock it is more like {@link #KEYCODE_ALT_LEFT} and is
183
+ # interpreted as an ALT key by {@link android.text.method.MetaKeyKeyListener}.
184
+ KEYCODE_NUM = 78
185
+ # Key code constant: Headset Hook key.
186
+ # Used to hang up calls and stop media.
187
+ KEYCODE_HEADSETHOOK = 79
188
+ # Key code constant: Camera Focus key.
189
+ # Used to focus the camera.
190
+ KEYCODE_FOCUS = 80 # *Camera* focus
191
+ # Key code constant: '+' key.
192
+ KEYCODE_PLUS = 81
193
+ # Key code constant: Menu key.
194
+ KEYCODE_MENU = 82
195
+ # Key code constant: Notification key.
196
+ KEYCODE_NOTIFICATION = 83
197
+ # Key code constant: Search key.
198
+ KEYCODE_SEARCH = 84
199
+ # Key code constant: Play/Pause media key.
200
+ KEYCODE_MEDIA_PLAY_PAUSE= 85
201
+ # Key code constant: Stop media key.
202
+ KEYCODE_MEDIA_STOP = 86
203
+ # Key code constant: Play Next media key.
204
+ KEYCODE_MEDIA_NEXT = 87
205
+ # Key code constant: Play Previous media key.
206
+ KEYCODE_MEDIA_PREVIOUS = 88
207
+ # Key code constant: Rewind media key.
208
+ KEYCODE_MEDIA_REWIND = 89
209
+ # Key code constant: Fast Forward media key.
210
+ KEYCODE_MEDIA_FAST_FORWARD = 90
211
+ # Key code constant: Mute key.
212
+ # Mutes the microphone, unlike {@link #KEYCODE_VOLUME_MUTE}.
213
+ KEYCODE_MUTE = 91
214
+ # Key code constant: Page Up key.
215
+ KEYCODE_PAGE_UP = 92
216
+ # Key code constant: Page Down key.
217
+ KEYCODE_PAGE_DOWN = 93
218
+ # Key code constant: Picture Symbols modifier key.
219
+ # Used to switch symbol sets (Emoji, Kao-moji).
220
+ KEYCODE_PICTSYMBOLS = 94 # switch symbol-sets (Emoji,Kao-moji)
221
+ # Key code constant: Switch Charset modifier key.
222
+ # Used to switch character sets (Kanji, Katakana).
223
+ KEYCODE_SWITCH_CHARSET = 95 # switch char-sets (Kanji,Katakana)
224
+ # Key code constant: A Button key.
225
+ # On a game controller, the A button should be either the button labeled A
226
+ # or the first button on the upper row of controller buttons.
227
+ KEYCODE_BUTTON_A = 96
228
+ # Key code constant: B Button key.
229
+ # On a game controller, the B button should be either the button labeled B
230
+ # or the second button on the upper row of controller buttons.
231
+ KEYCODE_BUTTON_B = 97
232
+ # Key code constant: C Button key.
233
+ # On a game controller, the C button should be either the button labeled C
234
+ # or the third button on the upper row of controller buttons.
235
+ KEYCODE_BUTTON_C = 98
236
+ # Key code constant: X Button key.
237
+ # On a game controller, the X button should be either the button labeled X
238
+ # or the first button on the lower row of controller buttons.
239
+ KEYCODE_BUTTON_X = 99
240
+ # Key code constant: Y Button key.
241
+ # On a game controller, the Y button should be either the button labeled Y
242
+ # or the second button on the lower row of controller buttons.
243
+ KEYCODE_BUTTON_Y = 100
244
+ # Key code constant: Z Button key.
245
+ # On a game controller, the Z button should be either the button labeled Z
246
+ # or the third button on the lower row of controller buttons.
247
+ KEYCODE_BUTTON_Z = 101
248
+ # Key code constant: L1 Button key.
249
+ # On a game controller, the L1 button should be either the button labeled L1 (or L)
250
+ # or the top left trigger button.
251
+ KEYCODE_BUTTON_L1 = 102
252
+ # Key code constant: R1 Button key.
253
+ # On a game controller, the R1 button should be either the button labeled R1 (or R)
254
+ # or the top right trigger button.
255
+ KEYCODE_BUTTON_R1 = 103
256
+ # Key code constant: L2 Button key.
257
+ # On a game controller, the L2 button should be either the button labeled L2
258
+ # or the bottom left trigger button.
259
+ KEYCODE_BUTTON_L2 = 104
260
+ # Key code constant: R2 Button key.
261
+ # On a game controller, the R2 button should be either the button labeled R2
262
+ # or the bottom right trigger button.
263
+ KEYCODE_BUTTON_R2 = 105
264
+ # Key code constant: Left Thumb Button key.
265
+ # On a game controller, the left thumb button indicates that the left (or only)
266
+ # joystick is pressed.
267
+ KEYCODE_BUTTON_THUMBL = 106
268
+ # Key code constant: Right Thumb Button key.
269
+ # On a game controller, the right thumb button indicates that the right
270
+ # joystick is pressed.
271
+ KEYCODE_BUTTON_THUMBR = 107
272
+ # Key code constant: Start Button key.
273
+ # On a game controller, the button labeled Start.
274
+ KEYCODE_BUTTON_START = 108
275
+ # Key code constant: Select Button key.
276
+ # On a game controller, the button labeled Select.
277
+ KEYCODE_BUTTON_SELECT = 109
278
+ # Key code constant: Mode Button key.
279
+ # On a game controller, the button labeled Mode.
280
+ KEYCODE_BUTTON_MODE = 110
281
+ # Key code constant: Escape key.
282
+ KEYCODE_ESCAPE = 111
283
+ # Key code constant: Forward Delete key.
284
+ # Deletes characters ahead of the insertion point, unlike {@link #KEYCODE_DEL}.
285
+ KEYCODE_FORWARD_DEL = 112
286
+ # Key code constant: Left Control modifier key.
287
+ KEYCODE_CTRL_LEFT = 113
288
+ # Key code constant: Right Control modifier key.
289
+ KEYCODE_CTRL_RIGHT = 114
290
+ # Key code constant: Caps Lock key.
291
+ KEYCODE_CAPS_LOCK = 115
292
+ # Key code constant: Scroll Lock key.
293
+ KEYCODE_SCROLL_LOCK = 116
294
+ # Key code constant: Left Meta modifier key.
295
+ KEYCODE_META_LEFT = 117
296
+ # Key code constant: Right Meta modifier key.
297
+ KEYCODE_META_RIGHT = 118
298
+ # Key code constant: Function modifier key.
299
+ KEYCODE_FUNCTION = 119
300
+ # Key code constant: System Request / Print Screen key.
301
+ KEYCODE_SYSRQ = 120
302
+ # Key code constant: Break / Pause key.
303
+ KEYCODE_BREAK = 121
304
+ # Key code constant: Home Movement key.
305
+ # Used for scrolling or moving the cursor around to the start of a line
306
+ # or to the top of a list.
307
+ KEYCODE_MOVE_HOME = 122
308
+ # Key code constant: End Movement key.
309
+ # Used for scrolling or moving the cursor around to the end of a line
310
+ # or to the bottom of a list.
311
+ KEYCODE_MOVE_END = 123
312
+ # Key code constant: Insert key.
313
+ # Toggles insert / overwrite edit mode.
314
+ KEYCODE_INSERT = 124
315
+ # Key code constant: Forward key.
316
+ # Navigates forward in the history stack. Complement of {@link #KEYCODE_BACK}.
317
+ KEYCODE_FORWARD = 125
318
+ # Key code constant: Play media key.
319
+ KEYCODE_MEDIA_PLAY = 126
320
+ # Key code constant: Pause media key.
321
+ KEYCODE_MEDIA_PAUSE = 127
322
+ # Key code constant: Close media key.
323
+ # May be used to close a CD tray, for example.
324
+ KEYCODE_MEDIA_CLOSE = 128
325
+ # Key code constant: Eject media key.
326
+ # May be used to eject a CD tray, for example.
327
+ KEYCODE_MEDIA_EJECT = 129
328
+ # Key code constant: Record media key.
329
+ KEYCODE_MEDIA_RECORD = 130
330
+ # Key code constant: F1 key.
331
+ KEYCODE_F1 = 131
332
+ # Key code constant: F2 key.
333
+ KEYCODE_F2 = 132
334
+ # Key code constant: F3 key.
335
+ KEYCODE_F3 = 133
336
+ # Key code constant: F4 key.
337
+ KEYCODE_F4 = 134
338
+ # Key code constant: F5 key.
339
+ KEYCODE_F5 = 135
340
+ # Key code constant: F6 key.
341
+ KEYCODE_F6 = 136
342
+ # Key code constant: F7 key.
343
+ KEYCODE_F7 = 137
344
+ # Key code constant: F8 key.
345
+ KEYCODE_F8 = 138
346
+ # Key code constant: F9 key.
347
+ KEYCODE_F9 = 139
348
+ # Key code constant: F10 key.
349
+ KEYCODE_F10 = 140
350
+ # Key code constant: F11 key.
351
+ KEYCODE_F11 = 141
352
+ # Key code constant: F12 key.
353
+ KEYCODE_F12 = 142
354
+ # Key code constant: Num Lock key.
355
+ # This is the Num Lock key it is different from {@link #KEYCODE_NUM}.
356
+ # This key alters the behavior of other keys on the numeric keypad.
357
+ KEYCODE_NUM_LOCK = 143
358
+ # Key code constant: Numeric keypad '0' key.
359
+ KEYCODE_NUMPAD_0 = 144
360
+ # Key code constant: Numeric keypad '1' key.
361
+ KEYCODE_NUMPAD_1 = 145
362
+ # Key code constant: Numeric keypad '2' key.
363
+ KEYCODE_NUMPAD_2 = 146
364
+ # Key code constant: Numeric keypad '3' key.
365
+ KEYCODE_NUMPAD_3 = 147
366
+ # Key code constant: Numeric keypad '4' key.
367
+ KEYCODE_NUMPAD_4 = 148
368
+ # Key code constant: Numeric keypad '5' key.
369
+ KEYCODE_NUMPAD_5 = 149
370
+ # Key code constant: Numeric keypad '6' key.
371
+ KEYCODE_NUMPAD_6 = 150
372
+ # Key code constant: Numeric keypad '7' key.
373
+ KEYCODE_NUMPAD_7 = 151
374
+ # Key code constant: Numeric keypad '8' key.
375
+ KEYCODE_NUMPAD_8 = 152
376
+ # Key code constant: Numeric keypad '9' key.
377
+ KEYCODE_NUMPAD_9 = 153
378
+ # Key code constant: Numeric keypad '/' key (for division).
379
+ KEYCODE_NUMPAD_DIVIDE = 154
380
+ # Key code constant: Numeric keypad '*' key (for multiplication).
381
+ KEYCODE_NUMPAD_MULTIPLY = 155
382
+ # Key code constant: Numeric keypad '-' key (for subtraction).
383
+ KEYCODE_NUMPAD_SUBTRACT = 156
384
+ # Key code constant: Numeric keypad '+' key (for addition).
385
+ KEYCODE_NUMPAD_ADD = 157
386
+ # Key code constant: Numeric keypad '.' key (for decimals or digit grouping).
387
+ KEYCODE_NUMPAD_DOT = 158
388
+ # Key code constant: Numeric keypad ',' key (for decimals or digit grouping).
389
+ KEYCODE_NUMPAD_COMMA = 159
390
+ # Key code constant: Numeric keypad Enter key.
391
+ KEYCODE_NUMPAD_ENTER = 160
392
+ # Key code constant: Numeric keypad '=' key.
393
+ KEYCODE_NUMPAD_EQUALS = 161
394
+ # Key code constant: Numeric keypad '(' key.
395
+ KEYCODE_NUMPAD_LEFT_PAREN = 162
396
+ # Key code constant: Numeric keypad ')' key.
397
+ KEYCODE_NUMPAD_RIGHT_PAREN = 163
398
+ # Key code constant: Volume Mute key.
399
+ # Mutes the speaker, unlike {@link #KEYCODE_MUTE}.
400
+ # This key should normally be implemented as a toggle such that the first press
401
+ # mutes the speaker and the second press restores the original volume.
402
+ KEYCODE_VOLUME_MUTE = 164
403
+ # Key code constant: Info key.
404
+ # Common on TV remotes to show additional information related to what is
405
+ # currently being viewed.
406
+ KEYCODE_INFO = 165
407
+ # Key code constant: Channel up key.
408
+ # On TV remotes, increments the television channel.
409
+ KEYCODE_CHANNEL_UP = 166
410
+ # Key code constant: Channel down key.
411
+ # On TV remotes, decrements the television channel.
412
+ KEYCODE_CHANNEL_DOWN = 167
413
+ # Key code constant: Zoom in key.
414
+ KEYCODE_ZOOM_IN = 168
415
+ # Key code constant: Zoom out key.
416
+ KEYCODE_ZOOM_OUT = 169
417
+ # Key code constant: TV key.
418
+ # On TV remotes, switches to viewing live TV.
419
+ KEYCODE_TV = 170
420
+ # Key code constant: Window key.
421
+ # On TV remotes, toggles picture-in-picture mode or other windowing functions.
422
+ KEYCODE_WINDOW = 171
423
+ # Key code constant: Guide key.
424
+ # On TV remotes, shows a programming guide.
425
+ KEYCODE_GUIDE = 172
426
+ # Key code constant: DVR key.
427
+ # On some TV remotes, switches to a DVR mode for recorded shows.
428
+ KEYCODE_DVR = 173
429
+ # Key code constant: Bookmark key.
430
+ # On some TV remotes, bookmarks content or web pages.
431
+ KEYCODE_BOOKMARK = 174
432
+ # Key code constant: Toggle captions key.
433
+ # Switches the mode for closed-captioning text, for example during television shows.
434
+ KEYCODE_CAPTIONS = 175
435
+ # Key code constant: Settings key.
436
+ # Starts the system settings activity.
437
+ KEYCODE_SETTINGS = 176
438
+ # Key code constant: TV power key.
439
+ # On TV remotes, toggles the power on a television screen.
440
+ KEYCODE_TV_POWER = 177
441
+ # Key code constant: TV input key.
442
+ # On TV remotes, switches the input on a television screen.
443
+ KEYCODE_TV_INPUT = 178
444
+ # Key code constant: Set-top-box power key.
445
+ # On TV remotes, toggles the power on an external Set-top-box.
446
+ KEYCODE_STB_POWER = 179
447
+ # Key code constant: Set-top-box input key.
448
+ # On TV remotes, switches the input mode on an external Set-top-box.
449
+ KEYCODE_STB_INPUT = 180
450
+ # Key code constant: A/V Receiver power key.
451
+ # On TV remotes, toggles the power on an external A/V Receiver.
452
+ KEYCODE_AVR_POWER = 181
453
+ # Key code constant: A/V Receiver input key.
454
+ # On TV remotes, switches the input mode on an external A/V Receiver.
455
+ KEYCODE_AVR_INPUT = 182
456
+ # Key code constant: Red "programmable" key.
457
+ # On TV remotes, acts as a contextual/programmable key.
458
+ KEYCODE_PROG_RED = 183
459
+ # Key code constant: Green "programmable" key.
460
+ # On TV remotes, actsas a contextual/programmable key.
461
+ KEYCODE_PROG_GREEN = 184
462
+ # Key code constant: Yellow "programmable" key.
463
+ # On TV remotes, acts as a contextual/programmable key.
464
+ KEYCODE_PROG_YELLOW = 185
465
+ # Key code constant: Blue "programmable" key.
466
+ # On TV remotes, acts as a contextual/programmable key.
467
+ KEYCODE_PROG_BLUE = 186
468
+ # Key code constant: App switch key.
469
+ # Should bring up the application switcher dialog.
470
+ KEYCODE_APP_SWITCH = 187
471
+ # Key code constant: Generic Game Pad Button #1.
472
+ KEYCODE_BUTTON_1 = 188
473
+ # Key code constant: Generic Game Pad Button #2.
474
+ KEYCODE_BUTTON_2 = 189
475
+ # Key code constant: Generic Game Pad Button #3.
476
+ KEYCODE_BUTTON_3 = 190
477
+ # Key code constant: Generic Game Pad Button #4.
478
+ KEYCODE_BUTTON_4 = 191
479
+ # Key code constant: Generic Game Pad Button #5.
480
+ KEYCODE_BUTTON_5 = 192
481
+ # Key code constant: Generic Game Pad Button #6.
482
+ KEYCODE_BUTTON_6 = 193
483
+ # Key code constant: Generic Game Pad Button #7.
484
+ KEYCODE_BUTTON_7 = 194
485
+ # Key code constant: Generic Game Pad Button #8.
486
+ KEYCODE_BUTTON_8 = 195
487
+ # Key code constant: Generic Game Pad Button #9.
488
+ KEYCODE_BUTTON_9 = 196
489
+ # Key code constant: Generic Game Pad Button #10.
490
+ KEYCODE_BUTTON_10 = 197
491
+ # Key code constant: Generic Game Pad Button #11.
492
+ KEYCODE_BUTTON_11 = 198
493
+ # Key code constant: Generic Game Pad Button #12.
494
+ KEYCODE_BUTTON_12 = 199
495
+ # Key code constant: Generic Game Pad Button #13.
496
+ KEYCODE_BUTTON_13 = 200
497
+ # Key code constant: Generic Game Pad Button #14.
498
+ KEYCODE_BUTTON_14 = 201
499
+ # Key code constant: Generic Game Pad Button #15.
500
+ KEYCODE_BUTTON_15 = 202
501
+ # Key code constant: Generic Game Pad Button #16.
502
+ KEYCODE_BUTTON_16 = 203
503
+ # Key code constant: Language Switch key.
504
+ # Toggles the current input language such as switching between English and Japanese on
505
+ # a QWERTY keyboard. On some devices, the same function may be performed by
506
+ # pressing Shift+Spacebar.
507
+ KEYCODE_LANGUAGE_SWITCH = 204
508
+ # Key code constant: Manner Mode key.
509
+ # Toggles silent or vibrate mode on and off to make the device behave more politely
510
+ # in certain settings such as on a crowded train. On some devices, the key may only
511
+ # operate when long-pressed.
512
+ KEYCODE_MANNER_MODE = 205
513
+ # Key code constant: 3D Mode key.
514
+ # Toggles the display between 2D and 3D mode.
515
+ KEYCODE_3D_MODE = 206
516
+ # Key code constant: Contacts special function key.
517
+ # Used to launch an address book application.
518
+ KEYCODE_CONTACTS = 207
519
+ # Key code constant: Calendar special function key.
520
+ # Used to launch a calendar application.
521
+ KEYCODE_CALENDAR = 208
522
+ # Key code constant: Music special function key.
523
+ # Used to launch a music player application.
524
+ KEYCODE_MUSIC = 209
525
+ # Key code constant: Calculator special function key.
526
+ # Used to launch a calculator application.
527
+ KEYCODE_CALCULATOR = 210
528
+ end
529
+ end
530
+ end
531
+ end
@@ -0,0 +1,65 @@
1
+ require 'singleton'
2
+
3
+ module Cukunity
4
+ module Android
5
+ class MonkeyClient
6
+ include Singleton
7
+ include Cukunity::Android::TunnelClientMethods
8
+ include Cukunity::RequestLineResponseClientMethods
9
+ alias_method :request_connect, :connect
10
+ alias_method :request_close, :close
11
+
12
+ DEFAULT_HOSTNAME = '127.0.0.1'
13
+ DEFAULT_PORT = 9923
14
+
15
+ def command(req)
16
+ res = request(req.chomp) do |line|
17
+ m = line.chomp.match(/^([^:]+)(:(.*))?$/)
18
+ { :status => m[1], :output => m[2] || '' }
19
+ end
20
+ raise Exception::MonkeyCommandError.new(res[:output]) if res.nil? or res[:status] != 'OK'
21
+ res[:output]
22
+ end
23
+
24
+ def close
25
+ if connected?
26
+ request 'quit', :quit => true, :retry => false rescue ::Exception
27
+ request_close
28
+ end
29
+ close_tunnel
30
+ unless @monkey_pipe.nil?
31
+ ::Process.kill('KILL', @monkey_pipe.pid) rescue ::Exception
32
+ @monkey_pipe.close rescue ::Exception
33
+ @monkey_pipe = nil
34
+ end
35
+ end
36
+
37
+ private
38
+ def kick_monkey(host, port)
39
+ if @monkey_pipe.nil?
40
+ open_tunnel(port + 1, port)
41
+ @monkey_pipe = adb ['shell', 'monkey', '--port', port.to_s], :wait => false
42
+ # FIXME: investigate why this sleep is "necessary"
43
+ sleep 1
44
+ raise Exception::MonkeyCommandError.new unless wait_connectivity(host, port + 1, 30)
45
+ end
46
+ end
47
+
48
+ def connect(host = DEFAULT_HOSTNAME, port = DEFAULT_PORT)
49
+ unless @connecting
50
+ @connecting = true
51
+ kick_monkey(host, port)
52
+ begin
53
+ request_connect(host, port + 1) do |socket|
54
+ kick_monkey(host, port)
55
+ command('wake')
56
+ true
57
+ end
58
+ ensure
59
+ @connecting = false
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end