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

Commit 6db53149 authored by Maksymilian Osowski's avatar Maksymilian Osowski Committed by Android (Google) Code Review
Browse files

Merge "Tweaked the logging + some minor style fixes."

parents 9d660cb5 2e5982a5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -63,7 +63,8 @@ public class AdditionalTextOutput {
                port = url.getPort();
            }
        } catch (MalformedURLException e) {
            Log.e(LOG_TAG + "::appendDatabaseCallback", e.getMessage());
            Log.e(LOG_TAG, "urlString=" + urlString + " databaseIdentifier=" + databaseIdentifier,
                    e);
        }

        output.append("UI DELEGATE DATABASE CALLBACK: ");
+3 −2
Original line number Diff line number Diff line
@@ -124,9 +124,10 @@ public class FileFilter {
                }
            }
        } catch (FileNotFoundException e) {
            Log.w(LOG_TAG + "::reloadConfiguration", "File not found: " + txt_exp.getPath());
            Log.w(LOG_TAG, "mRootDirPath=" + mRootDirPath + ": File not found: " +
                    txt_exp.getPath(), e);
        } catch (IOException e) {
            Log.e(LOG_TAG + "::reloadConfiguration", "IOException: " + e.getMessage());
            Log.e(LOG_TAG, "mRootDirPath=" + mRootDirPath, e);
        }
    }

+5 −5
Original line number Diff line number Diff line
@@ -31,13 +31,13 @@ public class FsUtils {
    public static final String LOG_TAG = "FsUtils";

    public static void writeDataToStorage(File file, byte[] bytes, boolean append) {
        Log.d(LOG_TAG + "::writeDataToStorage", file.getAbsolutePath());
        Log.d(LOG_TAG, "writeDataToStorage(): " + file.getAbsolutePath());
        try {
            OutputStream outputStream = null;
            try {
                file.getParentFile().mkdirs();
                file.createNewFile();
                Log.d(LOG_TAG + "::writeDataToStorage", "File created.");
                Log.d(LOG_TAG, "writeDataToStorage(): File created.");
                outputStream = new FileOutputStream(file, append);
                outputStream.write(bytes);
            } finally {
@@ -46,13 +46,13 @@ public class FsUtils {
                }
            }
        } catch (IOException e) {
            Log.e(LOG_TAG + "::writeDataToStorage", e.getMessage());
            Log.e(LOG_TAG, "file.getAbsolutePath=" + file.getAbsolutePath(), e);
        }
    }

    public static byte[] readDataFromStorage(File file) {
        if (!file.exists()) {
            Log.d(LOG_TAG + "::readDataFromStorage", "File does not exist: "
            Log.d(LOG_TAG, "readDataFromStorage(): File does not exist: "
                    + file.getAbsolutePath());
            return null;
        }
@@ -70,7 +70,7 @@ public class FsUtils {
                }
            }
        } catch (IOException e) {
            Log.e(LOG_TAG + "::readDataFromStorage", e.getMessage());
            Log.e(LOG_TAG, "file.getAbsolutePath=" + file.getAbsolutePath(), e);
        }

        return bytes;
+9 −6
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ public class LayoutTestController {
    }

    public void clearAllDatabases() {
        Log.w(LOG_TAG + "::clearAllDatabases", "called");
        Log.i(LOG_TAG, "clearAllDatabases() called");
        WebStorage.getInstance().deleteAllData();
    }

@@ -70,7 +70,7 @@ public class LayoutTestController {

    public void setDatabaseQuota(long quota) {
        /** TODO: Reset this before every test! */
        Log.w(LOG_TAG + "::setDatabaseQuota", "called with: " + quota);
        Log.i(LOG_TAG, "setDatabaseQuota() called with: " + quota);
        WebStorage.getInstance().setQuotaForOrigin(Uri.fromFile(new File("")).toString(),
                quota);
    }
@@ -80,13 +80,13 @@ public class LayoutTestController {
    }

    public void setMockGeolocationPosition(double latitude, double longitude, double accuracy) {
        Log.w(LOG_TAG + "::setMockGeolocationPosition", "latitude: " + latitude +
                " longitude: " + longitude + " accuracy: " + 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.w(LOG_TAG + "::setMockGeolocationError", "code: " + code + " message: " + message);
        Log.i(LOG_TAG, "setMockGeolocationError(): " + "code=" + code + " message=" + message);
        MockGeolocation.getInstance().setError(code, message);
    }

@@ -94,6 +94,9 @@ public class LayoutTestController {
            boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma) {
        // Configuration is in WebKit, so stay on WebCore thread, but go via LayoutTestsExecutor
        // as we need access to the Webview.
        Log.i(LOG_TAG, "setMockDeviceOrientation(" + canProvideAlpha +
                ", " + alpha + ", " + canProvideBeta + ", " + beta + ", " + canProvideGamma +
                ", " + gamma + ")");
        mLayoutTestsExecutor.setMockDeviceOrientation(
                canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
    }
+25 −18
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ public class LayoutTestsExecutor extends Activity {
    private boolean mDumpDatabaseCallbacks;
    private boolean mIsGeolocationPermissionSet;
    private boolean mGeolocationPermission;
    private Map mPendingGeolocationPermissionCallbacks;
    private Map<GeolocationPermissions.Callback, String> mPendingGeolocationPermissionCallbacks;

    private EventSender mEventSender = new EventSender();

@@ -338,7 +338,7 @@ public class LayoutTestsExecutor extends Activity {
            serviceMsg.setData(bundle);
            mManagerServiceMessenger.send(serviceMsg);
        } catch (RemoteException e) {
            Log.e(LOG_TAG + "::startTests", e.getMessage());
            Log.e(LOG_TAG, "mCurrentTestRelativePath=" + mCurrentTestRelativePath, e);
        }

        runNextTest();
@@ -369,6 +369,7 @@ public class LayoutTestsExecutor extends Activity {
    private void onTestTimedOut() {
        assert mCurrentState.isRunningState() : "mCurrentState = " + mCurrentState.name();

        Log.w(LOG_TAG, "onTestTimedOut(): " + mCurrentTestRelativePath);
        mCurrentTestTimedOut = true;

        /**
@@ -383,6 +384,7 @@ public class LayoutTestsExecutor extends Activity {
    private void onTestFinished() {
        assert mCurrentState.isRunningState() : "mCurrentState = " + mCurrentState.name();

        Log.i(LOG_TAG, "onTestFinished(): " + mCurrentTestRelativePath);
        obtainActualResultsFromWebView();
    }

@@ -406,6 +408,7 @@ public class LayoutTestsExecutor extends Activity {
        assert mCurrentState == CurrentState.OBTAINING_RESULT
                : "mCurrentState = " + mCurrentState.name();

        Log.i(LOG_TAG, "onActualResultsObtained(): " + mCurrentTestRelativePath);
        mCurrentState = CurrentState.IDLE;

        mResultHandler.removeMessages(MSG_TEST_TIMED_OUT);
@@ -436,7 +439,7 @@ public class LayoutTestsExecutor extends Activity {
            serviceMsg.setData(bundle);
            mManagerServiceMessenger.send(serviceMsg);
        } catch (RemoteException e) {
            Log.e(LOG_TAG + "::reportResultToService", e.getMessage());
            Log.e(LOG_TAG, "mCurrentTestRelativePath=" + mCurrentTestRelativePath, e);
        }
    }

@@ -455,7 +458,7 @@ public class LayoutTestsExecutor extends Activity {
                    Message.obtain(null, ManagerService.MSG_ALL_TESTS_FINISHED);
            mManagerServiceMessenger.send(serviceMsg);
        } catch (RemoteException e) {
            Log.e(LOG_TAG + "::onAllTestsFinished", e.getMessage());
            Log.e(LOG_TAG, "mCurrentTestRelativePath=" + mCurrentTestRelativePath, e);
        }

        unbindService(mServiceConnection);
@@ -529,11 +532,11 @@ public class LayoutTestsExecutor extends Activity {
                    mGeolocationPermission = msg.arg1 == 1;

                    if (mPendingGeolocationPermissionCallbacks != null) {
                        Iterator iter = mPendingGeolocationPermissionCallbacks.keySet().iterator();
                        Iterator<GeolocationPermissions.Callback> iter =
                                mPendingGeolocationPermissionCallbacks.keySet().iterator();
                        while (iter.hasNext()) {
                            GeolocationPermissions.Callback callback =
                                    (GeolocationPermissions.Callback) iter.next();
                            String origin = (String) mPendingGeolocationPermissionCallbacks.get(callback);
                            GeolocationPermissions.Callback callback = iter.next();
                            String origin = mPendingGeolocationPermissionCallbacks.get(callback);
                            callback.invoke(origin, mGeolocationPermission, false);
                        }
                        mPendingGeolocationPermissionCallbacks = null;
@@ -541,7 +544,7 @@ public class LayoutTestsExecutor extends Activity {
                    break;

                default:
                    Log.w(LOG_TAG + "::handleMessage", "Message code does not exist: " + msg.what);
                    assert false : "msg.what=" + msg.what;
                    break;
            }
        }
@@ -555,41 +558,42 @@ public class LayoutTestsExecutor extends Activity {
    }

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

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

    public void dumpAsText(boolean enablePixelTest) {
        Log.w(LOG_TAG + "::dumpAsText(" + enablePixelTest + ")", "called");
        Log.i(LOG_TAG, mCurrentTestRelativePath + ": dumpAsText(" + enablePixelTest + ") called");
        /** TODO: Implement */
        if (enablePixelTest) {
            Log.w(LOG_TAG + "::dumpAsText", "enablePixelTest not implemented, switching to false");
            Log.w(LOG_TAG, "enablePixelTest not implemented, switching to false");
        }
        mLayoutTestControllerHandler.sendEmptyMessage(MSG_DUMP_AS_TEXT);
    }

    public void dumpChildFramesAsText() {
        Log.w(LOG_TAG + "::dumpChildFramesAsText", "called");
        Log.i(LOG_TAG, mCurrentTestRelativePath + ": dumpChildFramesAsText() called");
        mLayoutTestControllerHandler.sendEmptyMessage(MSG_DUMP_CHILD_FRAMES_AS_TEXT);
    }

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

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

    public void setGeolocationPermission(boolean allow) {
        Log.w(LOG_TAG + "::setGeolocationPermission", "called");
        Log.i(LOG_TAG, mCurrentTestRelativePath + ": setGeolocationPermission(" + allow +
                ") called");
        Message msg = mLayoutTestControllerHandler.obtainMessage(MSG_SET_GEOLOCATION_PERMISSION);
        msg.arg1 = allow ? 1 : 0;
        msg.sendToTarget();
@@ -597,6 +601,9 @@ public class LayoutTestsExecutor extends Activity {

    public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha,
            boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma) {
        Log.i(LOG_TAG, mCurrentTestRelativePath + ": setMockDeviceOrientation(" + canProvideAlpha +
                ", " + alpha + ", " + canProvideBeta + ", " + beta + ", " + canProvideGamma +
                ", " + gamma + ")");
        mCurrentWebView.setMockDeviceOrientation(canProvideAlpha, alpha, canProvideBeta, beta,
                canProvideGamma, gamma);
    }
Loading