build/mobile/robocop/Actions.java

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial