build/mobile/robocop/Actions.java

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build/mobile/robocop/Actions.java	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,109 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +package org.mozilla.gecko;
     1.9 +import android.database.Cursor;
    1.10 +
    1.11 +public interface Actions {
    1.12 +
    1.13 +    /** Special keys supported by sendSpecialKey() */
    1.14 +    public enum SpecialKey {
    1.15 +        DOWN, UP, LEFT, RIGHT, ENTER, MENU, BACK
    1.16 +    }
    1.17 +
    1.18 +    public interface EventExpecter {
    1.19 +        /** Blocks until the event has been received. Subsequent calls will return immediately. */
    1.20 +        public void blockForEvent();
    1.21 +        public void blockForEvent(long millis, boolean failOnTimeout);
    1.22 +
    1.23 +        /** Blocks until the event has been received and returns data associated with the event. */
    1.24 +        public String blockForEventData();
    1.25 +
    1.26 +        /**
    1.27 +         * Blocks until the event has been received, or until the timeout has been exceeded.
    1.28 +         * Returns the data associated with the event, if applicable.
    1.29 +         */
    1.30 +        public String blockForEventDataWithTimeout(long millis);
    1.31 +
    1.32 +        /** Polls to see if the event has been received. Once this returns true, subsequent calls will also return true. */
    1.33 +        public boolean eventReceived();
    1.34 +
    1.35 +        /** Stop listening for events. */
    1.36 +        public void unregisterListener();
    1.37 +    }
    1.38 +
    1.39 +    public interface RepeatedEventExpecter extends EventExpecter {
    1.40 +        /** Blocks until at least one event has been received, and no events have been received in the last <code>millis</code> milliseconds. */
    1.41 +        public void blockUntilClear(long millis);
    1.42 +    }
    1.43 +
    1.44 +    /**
    1.45 +     * Sends an event to Gecko.
    1.46 +     * 
    1.47 +     * @param geckoEvent The geckoEvent JSONObject's type
    1.48 +     */
    1.49 +    void sendGeckoEvent(String geckoEvent, String data);
    1.50 +
    1.51 +    /**
    1.52 +     * Sends a preferences get event to Gecko.
    1.53 +     *
    1.54 +     * @param requestId The id of this request.
    1.55 +     * @param prefNames The preferences being requested.
    1.56 +     */
    1.57 +    void sendPreferencesGetEvent(int requestId, String[] prefNames);
    1.58 +
    1.59 +    /**
    1.60 +     * Sends a preferences observe event to Gecko.
    1.61 +     *
    1.62 +     * @param requestId The id of this request.
    1.63 +     * @param prefNames The preferences being requested.
    1.64 +     */
    1.65 +    void sendPreferencesObserveEvent(int requestId, String[] prefNames);
    1.66 +
    1.67 +    /**
    1.68 +     * Sends a preferences remove observers event to Gecko.
    1.69 +     *
    1.70 +     * @param requestId The id of this request.
    1.71 +     */
    1.72 +    void sendPreferencesRemoveObserversEvent(int requestid);
    1.73 +
    1.74 +    /**
    1.75 +     * Listens for a gecko event to be sent from the Gecko instance.
    1.76 +     * The returned object can be used to test if the event has been
    1.77 +     * received. Note that only one event is listened for.
    1.78 +     * 
    1.79 +     * @param geckoEvent The geckoEvent JSONObject's type
    1.80 +     */
    1.81 +    RepeatedEventExpecter expectGeckoEvent(String geckoEvent);
    1.82 +
    1.83 +    /**
    1.84 +     * Listens for a paint event. Note that calling expectPaint() will
    1.85 +     * invalidate the event expecters returned from any previous calls
    1.86 +     * to expectPaint(); calling any methods on those invalidated objects
    1.87 +     * will result in undefined behaviour.
    1.88 +     */
    1.89 +    RepeatedEventExpecter expectPaint();
    1.90 +
    1.91 +    /** 
    1.92 +     * Send a string to the application 
    1.93 +     * 
    1.94 +     * @param keysToSend The string to send
    1.95 +     */
    1.96 +    void sendKeys(String keysToSend);
    1.97 +
    1.98 +    /**
    1.99 +     * Send a special keycode to the element
   1.100 +     *
   1.101 +     * @param key The special key to send
   1.102 +     */
   1.103 +    void sendSpecialKey(SpecialKey key);
   1.104 +    void sendKeyCode(int keyCode);
   1.105 +
   1.106 +    void drag(int startingX, int endingX, int startingY, int endingY);
   1.107 +
   1.108 +    /**
   1.109 +     * Run a sql query on the specified database
   1.110 +     */
   1.111 +    public Cursor querySql(String dbPath, String sql);
   1.112 +}

mercurial