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

Commit d96c5e0c authored by Maksymilian Osowski's avatar Maksymilian Osowski
Browse files

Added setXSSAuditorEnabled() LayoutTestController function.

Change-Id: I262e434573ee79c998f3ace5103c191fc0989bd2
parent fb5a2d73
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -106,6 +106,10 @@ public class LayoutTestController {
        MockGeolocation.getInstance().setPosition(latitude, longitude, accuracy);
    }

    public void setXSSAuditorEnabled(boolean flag) {
        mLayoutTestsExecutor.setXSSAuditorEnabled(flag);
    }

    public void waitUntilDone() {
        mLayoutTestsExecutor.waitUntilDone();
    }
+12 −0
Original line number Diff line number Diff line
@@ -508,6 +508,7 @@ public class LayoutTestsExecutor extends Activity {
    private static final int MSG_DUMP_DATABASE_CALLBACKS = 5;
    private static final int MSG_SET_GEOLOCATION_PERMISSION = 6;
    private static final int MSG_OVERRIDE_PREFERENCE = 7;
    private static final int MSG_SET_XSS_AUDITOR_ENABLED = 8;

    /** String constants for use with layoutTestController.overridePreference() */
    private final String WEBKIT_OFFLINE_WEB_APPLICATION_CACHE_ENABLED =
@@ -585,6 +586,10 @@ public class LayoutTestsExecutor extends Activity {
                    }
                    break;

                case MSG_SET_XSS_AUDITOR_ENABLED:
                    mCurrentWebView.getSettings().setXSSAuditorEnabled(msg.arg1 == 1);
                    break;

                case MSG_WAIT_UNTIL_DONE:
                    mCurrentState = CurrentState.WAITING_FOR_ASYNCHRONOUS_TEST;
                    break;
@@ -658,6 +663,13 @@ public class LayoutTestsExecutor extends Activity {
                canProvideGamma, gamma);
    }

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

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