build/mobile/robocop/Actions.java

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 package org.mozilla.gecko;
michael@0 6 import android.database.Cursor;
michael@0 7
michael@0 8 public interface Actions {
michael@0 9
michael@0 10 /** Special keys supported by sendSpecialKey() */
michael@0 11 public enum SpecialKey {
michael@0 12 DOWN, UP, LEFT, RIGHT, ENTER, MENU, BACK
michael@0 13 }
michael@0 14
michael@0 15 public interface EventExpecter {
michael@0 16 /** Blocks until the event has been received. Subsequent calls will return immediately. */
michael@0 17 public void blockForEvent();
michael@0 18 public void blockForEvent(long millis, boolean failOnTimeout);
michael@0 19
michael@0 20 /** Blocks until the event has been received and returns data associated with the event. */
michael@0 21 public String blockForEventData();
michael@0 22
michael@0 23 /**
michael@0 24 * Blocks until the event has been received, or until the timeout has been exceeded.
michael@0 25 * Returns the data associated with the event, if applicable.
michael@0 26 */
michael@0 27 public String blockForEventDataWithTimeout(long millis);
michael@0 28
michael@0 29 /** Polls to see if the event has been received. Once this returns true, subsequent calls will also return true. */
michael@0 30 public boolean eventReceived();
michael@0 31
michael@0 32 /** Stop listening for events. */
michael@0 33 public void unregisterListener();
michael@0 34 }
michael@0 35
michael@0 36 public interface RepeatedEventExpecter extends EventExpecter {
michael@0 37 /** Blocks until at least one event has been received, and no events have been received in the last <code>millis</code> milliseconds. */
michael@0 38 public void blockUntilClear(long millis);
michael@0 39 }
michael@0 40
michael@0 41 /**
michael@0 42 * Sends an event to Gecko.
michael@0 43 *
michael@0 44 * @param geckoEvent The geckoEvent JSONObject's type
michael@0 45 */
michael@0 46 void sendGeckoEvent(String geckoEvent, String data);
michael@0 47
michael@0 48 /**
michael@0 49 * Sends a preferences get event to Gecko.
michael@0 50 *
michael@0 51 * @param requestId The id of this request.
michael@0 52 * @param prefNames The preferences being requested.
michael@0 53 */
michael@0 54 void sendPreferencesGetEvent(int requestId, String[] prefNames);
michael@0 55
michael@0 56 /**
michael@0 57 * Sends a preferences observe event to Gecko.
michael@0 58 *
michael@0 59 * @param requestId The id of this request.
michael@0 60 * @param prefNames The preferences being requested.
michael@0 61 */
michael@0 62 void sendPreferencesObserveEvent(int requestId, String[] prefNames);
michael@0 63
michael@0 64 /**
michael@0 65 * Sends a preferences remove observers event to Gecko.
michael@0 66 *
michael@0 67 * @param requestId The id of this request.
michael@0 68 */
michael@0 69 void sendPreferencesRemoveObserversEvent(int requestid);
michael@0 70
michael@0 71 /**
michael@0 72 * Listens for a gecko event to be sent from the Gecko instance.
michael@0 73 * The returned object can be used to test if the event has been
michael@0 74 * received. Note that only one event is listened for.
michael@0 75 *
michael@0 76 * @param geckoEvent The geckoEvent JSONObject's type
michael@0 77 */
michael@0 78 RepeatedEventExpecter expectGeckoEvent(String geckoEvent);
michael@0 79
michael@0 80 /**
michael@0 81 * Listens for a paint event. Note that calling expectPaint() will
michael@0 82 * invalidate the event expecters returned from any previous calls
michael@0 83 * to expectPaint(); calling any methods on those invalidated objects
michael@0 84 * will result in undefined behaviour.
michael@0 85 */
michael@0 86 RepeatedEventExpecter expectPaint();
michael@0 87
michael@0 88 /**
michael@0 89 * Send a string to the application
michael@0 90 *
michael@0 91 * @param keysToSend The string to send
michael@0 92 */
michael@0 93 void sendKeys(String keysToSend);
michael@0 94
michael@0 95 /**
michael@0 96 * Send a special keycode to the element
michael@0 97 *
michael@0 98 * @param key The special key to send
michael@0 99 */
michael@0 100 void sendSpecialKey(SpecialKey key);
michael@0 101 void sendKeyCode(int keyCode);
michael@0 102
michael@0 103 void drag(int startingX, int endingX, int startingY, int endingY);
michael@0 104
michael@0 105 /**
michael@0 106 * Run a sql query on the specified database
michael@0 107 */
michael@0 108 public Cursor querySql(String dbPath, String sql);
michael@0 109 }

mercurial