Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a0db6f5 authored by Steve Block's avatar Steve Block Committed by Android (Google) Code Review
Browse files

Merge "Sort LayoutTestController methods alphabetically"

parents 05f5a78d 5de8b998
Loading
Loading
Loading
Loading
+29 −29
Original line number Diff line number Diff line
@@ -35,12 +35,9 @@ public class LayoutTestController {
        mLayoutTestsExecutor = layoutTestsExecutor;
    }

    public void waitUntilDone() {
        mLayoutTestsExecutor.waitUntilDone();
    }

    public void notifyDone() {
        mLayoutTestsExecutor.notifyDone();
    public void clearAllDatabases() {
        Log.i(LOG_TAG, "clearAllDatabases() called");
        WebStorage.getInstance().deleteAllData();
    }

    public void dumpAsText() {
@@ -55,17 +52,20 @@ public class LayoutTestController {
        mLayoutTestsExecutor.dumpChildFramesAsText();
    }

    public void clearAllDatabases() {
        Log.i(LOG_TAG, "clearAllDatabases() called");
        WebStorage.getInstance().deleteAllData();
    public void dumpDatabaseCallbacks() {
        mLayoutTestsExecutor.dumpDatabaseCallbacks();
    }

    public void setCanOpenWindows() {
        mLayoutTestsExecutor.setCanOpenWindows();
    public void notifyDone() {
        mLayoutTestsExecutor.notifyDone();
    }

    public void dumpDatabaseCallbacks() {
        mLayoutTestsExecutor.dumpDatabaseCallbacks();
    public void overridePreference(String key, boolean value) {
        mLayoutTestsExecutor.overridePreference(key, value);
    }

    public void setCanOpenWindows() {
        mLayoutTestsExecutor.setCanOpenWindows();
    }

    public void setDatabaseQuota(long quota) {
@@ -79,21 +79,6 @@ public class LayoutTestController {
        mLayoutTestsExecutor.setGeolocationPermission(allow);
    }

    public void overridePreference(String key, boolean value) {
        mLayoutTestsExecutor.overridePreference(key, value);
    }

    public void setMockGeolocationPosition(double latitude, double longitude, double accuracy) {
        Log.i(LOG_TAG, "setMockGeolocationPosition(): " + "latitude=" + latitude +
                " longitude=" + longitude + " accuracy=" + accuracy);
        MockGeolocation.getInstance().setPosition(latitude, longitude, accuracy);
    }

    public void setMockGeolocationError(int code, String message) {
        Log.i(LOG_TAG, "setMockGeolocationError(): " + "code=" + code + " message=" + message);
        MockGeolocation.getInstance().setError(code, message);
    }

    public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha,
            boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma) {
        // Configuration is in WebKit, so stay on WebCore thread, but go via LayoutTestsExecutor
@@ -104,4 +89,19 @@ public class LayoutTestController {
        mLayoutTestsExecutor.setMockDeviceOrientation(
                canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
    }

    public void setMockGeolocationError(int code, String message) {
        Log.i(LOG_TAG, "setMockGeolocationError(): " + "code=" + code + " message=" + message);
        MockGeolocation.getInstance().setError(code, message);
    }

    public void setMockGeolocationPosition(double latitude, double longitude, double accuracy) {
        Log.i(LOG_TAG, "setMockGeolocationPosition(): " + "latitude=" + latitude +
                " longitude=" + longitude + " accuracy=" + accuracy);
        MockGeolocation.getInstance().setPosition(latitude, longitude, accuracy);
    }

    public void waitUntilDone() {
        mLayoutTestsExecutor.waitUntilDone();
    }
}
+48 −50
Original line number Diff line number Diff line
@@ -519,24 +519,12 @@ public class LayoutTestsExecutor extends Activity {
            assert mCurrentState.isRunningState() : "mCurrentState = " + mCurrentState.name();

            switch (msg.what) {
                case MSG_WAIT_UNTIL_DONE:
                    mCurrentState = CurrentState.WAITING_FOR_ASYNCHRONOUS_TEST;
                    break;

                case MSG_NOTIFY_DONE:
                    if (mCurrentState == CurrentState.WAITING_FOR_ASYNCHRONOUS_TEST) {
                        onTestFinished();
                    }
                    break;

                case MSG_DUMP_AS_TEXT:
                    if (mCurrentResult == null) {
                        mCurrentResult = new TextResult(mCurrentTestRelativePath);
                    }

                    assert mCurrentResult instanceof TextResult
                            : "mCurrentResult instanceof" + mCurrentResult.getClass().getName();

                    break;

                case MSG_DUMP_CHILD_FRAMES_AS_TEXT:
@@ -551,27 +539,13 @@ public class LayoutTestsExecutor extends Activity {
                    ((TextResult)mCurrentResult).setDumpChildFramesAsText(true);
                    break;

                case MSG_SET_CAN_OPEN_WINDOWS:
                    mCanOpenWindows = true;
                    break;

                case MSG_DUMP_DATABASE_CALLBACKS:
                    mDumpDatabaseCallbacks = true;
                    break;

                case MSG_SET_GEOLOCATION_PERMISSION:
                    mIsGeolocationPermissionSet = true;
                    mGeolocationPermission = msg.arg1 == 1;

                    if (mPendingGeolocationPermissionCallbacks != null) {
                        Iterator<GeolocationPermissions.Callback> iter =
                                mPendingGeolocationPermissionCallbacks.keySet().iterator();
                        while (iter.hasNext()) {
                            GeolocationPermissions.Callback callback = iter.next();
                            String origin = mPendingGeolocationPermissionCallbacks.get(callback);
                            callback.invoke(origin, mGeolocationPermission, false);
                        }
                        mPendingGeolocationPermissionCallbacks = null;
                case MSG_NOTIFY_DONE:
                    if (mCurrentState == CurrentState.WAITING_FOR_ASYNCHRONOUS_TEST) {
                        onTestFinished();
                    }
                    break;

@@ -591,6 +565,30 @@ public class LayoutTestsExecutor extends Activity {
                    }
                    break;

                case MSG_SET_CAN_OPEN_WINDOWS:
                    mCanOpenWindows = true;
                    break;

                case MSG_SET_GEOLOCATION_PERMISSION:
                    mIsGeolocationPermissionSet = true;
                    mGeolocationPermission = msg.arg1 == 1;

                    if (mPendingGeolocationPermissionCallbacks != null) {
                        Iterator<GeolocationPermissions.Callback> iter =
                                mPendingGeolocationPermissionCallbacks.keySet().iterator();
                        while (iter.hasNext()) {
                            GeolocationPermissions.Callback callback = iter.next();
                            String origin = mPendingGeolocationPermissionCallbacks.get(callback);
                            callback.invoke(origin, mGeolocationPermission, false);
                        }
                        mPendingGeolocationPermissionCallbacks = null;
                    }
                    break;

                case MSG_WAIT_UNTIL_DONE:
                    mCurrentState = CurrentState.WAITING_FOR_ASYNCHRONOUS_TEST;
                    break;

                default:
                    assert false : "msg.what=" + msg.what;
                    break;
@@ -605,16 +603,6 @@ public class LayoutTestsExecutor extends Activity {
        mPendingGeolocationPermissionCallbacks = null;
    }

    public void waitUntilDone() {
        Log.i(LOG_TAG, mCurrentTestRelativePath + ": waitUntilDone() called");
        mLayoutTestControllerHandler.sendEmptyMessage(MSG_WAIT_UNTIL_DONE);
    }

    public void notifyDone() {
        Log.i(LOG_TAG, mCurrentTestRelativePath + ": notifyDone() called");
        mLayoutTestControllerHandler.sendEmptyMessage(MSG_NOTIFY_DONE);
    }

    public void dumpAsText(boolean enablePixelTest) {
        Log.i(LOG_TAG, mCurrentTestRelativePath + ": dumpAsText(" + enablePixelTest + ") called");
        /** TODO: Implement */
@@ -629,22 +617,14 @@ public class LayoutTestsExecutor extends Activity {
        mLayoutTestControllerHandler.sendEmptyMessage(MSG_DUMP_CHILD_FRAMES_AS_TEXT);
    }

    public void setCanOpenWindows() {
        Log.i(LOG_TAG, mCurrentTestRelativePath + ": setCanOpenWindows() called");
        mLayoutTestControllerHandler.sendEmptyMessage(MSG_SET_CAN_OPEN_WINDOWS);
    }

    public void dumpDatabaseCallbacks() {
        Log.i(LOG_TAG, mCurrentTestRelativePath + ": dumpDatabaseCallbacks() called");
        mLayoutTestControllerHandler.sendEmptyMessage(MSG_DUMP_DATABASE_CALLBACKS);
    }

    public void setGeolocationPermission(boolean allow) {
        Log.i(LOG_TAG, mCurrentTestRelativePath + ": setGeolocationPermission(" + allow +
                ") called");
        Message msg = mLayoutTestControllerHandler.obtainMessage(MSG_SET_GEOLOCATION_PERMISSION);
        msg.arg1 = allow ? 1 : 0;
        msg.sendToTarget();
    public void notifyDone() {
        Log.i(LOG_TAG, mCurrentTestRelativePath + ": notifyDone() called");
        mLayoutTestControllerHandler.sendEmptyMessage(MSG_NOTIFY_DONE);
    }

    public void overridePreference(String key, boolean value) {
@@ -656,6 +636,19 @@ public class LayoutTestsExecutor extends Activity {
        msg.sendToTarget();
    }

    public void setCanOpenWindows() {
        Log.i(LOG_TAG, mCurrentTestRelativePath + ": setCanOpenWindows() called");
        mLayoutTestControllerHandler.sendEmptyMessage(MSG_SET_CAN_OPEN_WINDOWS);
    }

    public void setGeolocationPermission(boolean allow) {
        Log.i(LOG_TAG, mCurrentTestRelativePath + ": setGeolocationPermission(" + allow +
                ") called");
        Message msg = mLayoutTestControllerHandler.obtainMessage(MSG_SET_GEOLOCATION_PERMISSION);
        msg.arg1 = allow ? 1 : 0;
        msg.sendToTarget();
    }

    public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha,
            boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma) {
        Log.i(LOG_TAG, mCurrentTestRelativePath + ": setMockDeviceOrientation(" + canProvideAlpha +
@@ -664,4 +657,9 @@ public class LayoutTestsExecutor extends Activity {
        mCurrentWebView.setMockDeviceOrientation(canProvideAlpha, alpha, canProvideBeta, beta,
                canProvideGamma, gamma);
    }

    public void waitUntilDone() {
        Log.i(LOG_TAG, mCurrentTestRelativePath + ": waitUntilDone() called");
        mLayoutTestControllerHandler.sendEmptyMessage(MSG_WAIT_UNTIL_DONE);
    }
}