Loading core/java/android/webkit/DeviceOrientationManager.java 0 → 100644 +55 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.webkit; import android.util.Log; /** * This class is simply a container for the methods used to configure WebKit's * mock DeviceOrientationClient for use in LayoutTests. * * This could be part of WebViewCore, but have moved it to its own class to * avoid bloat there. * @hide */ public final class DeviceOrientationManager { /** * Sets whether the Page for the specified WebViewCore should use a mock DeviceOrientation * client. */ public static void useMock(WebViewCore webViewCore) { assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName()); nativeUseMock(webViewCore); } /** * Set the position for the mock DeviceOrientation service for the supplied WebViewCore. */ public static void setMockOrientation(WebViewCore webViewCore, boolean canProvideAlpha, double alpha, boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma) { assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName()); nativeSetMockOrientation(webViewCore, canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); } // Native functions private static native void nativeUseMock(WebViewCore webViewCore); private static native void nativeSetMockOrientation(WebViewCore webViewCore, boolean canProvideAlpha, double alpha, boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma); } core/java/android/webkit/WebView.java +21 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ import android.view.accessibility.AccessibilityManager; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; import android.webkit.DeviceOrientationManager; import android.webkit.WebTextView.AutoCompleteAdapter; import android.webkit.WebViewCore.EventHub; import android.webkit.WebViewCore.TouchEventData; Loading Loading @@ -3746,6 +3747,26 @@ public class WebView extends AbsoluteLayout mWebViewCore.sendMessage(EventHub.DUMP_RENDERTREE, toFile ? 1 : 0, 0); } /** * Called by DRT on UI thread, need to proxy to WebCore thread. * * @hide debug only */ public void useMockDeviceOrientation() { mWebViewCore.sendMessage(EventHub.USE_MOCK_DEVICE_ORIENTATION); } /** * Called by DRT on WebCore thread. * * @hide debug only */ public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha, boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma) { DeviceOrientationManager.setMockOrientation(mWebViewCore, canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); } /** * Dump the V8 counters to standard output. * Note that you need a build with V8 and WEBCORE_INSTRUMENTATION set to Loading core/java/android/webkit/WebViewCore.java +11 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.util.SparseBooleanArray; import android.view.KeyEvent; import android.view.SurfaceView; import android.view.View; import android.webkit.DeviceOrientationManager; import java.util.ArrayList; import java.util.Collection; Loading Loading @@ -878,6 +879,8 @@ final class WebViewCore { // accessibility support static final int MODIFY_SELECTION = 190; static final int USE_MOCK_DEVICE_ORIENTATION = 191; // private message ids private static final int DESTROY = 200; Loading Loading @@ -1409,6 +1412,10 @@ final class WebViewCore { WebView.SET_TOUCH_HIGHLIGHT_RECTS, null) .sendToTarget(); break; case USE_MOCK_DEVICE_ORIENTATION: useMockDeviceOrientation(); break; } } }; Loading Loading @@ -2481,6 +2488,10 @@ final class WebViewCore { hMode, vMode).sendToTarget(); } private void useMockDeviceOrientation() { DeviceOrientationManager.useMock(this); } private native void nativePause(); private native void nativeResume(); private native void nativeFreeMemory(); Loading tests/DumpRenderTree/src/com/android/dumprendertree/CallbackProxy.java +8 −0 Original line number Diff line number Diff line Loading @@ -510,6 +510,14 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon obtainMessage(SET_GEOLOCATION_PERMISSION, allow ? 1 : 0, 0).sendToTarget(); } 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 the TestShellActivity // as we need access to the Webview. mLayoutTestController.setMockDeviceOrientation(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); } public void overridePreference(String key, boolean value) { Message message = obtainMessage(OVERRIDE_PREFERENCE); message.getData().putString("key", key); Loading tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java +0 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,6 @@ public class FileFilter { static final String[] ignoreTestList = { "editing/selection/move-left-right.html", // Causes DumpRenderTree to hang "fast/dom/DeviceOrientation/basic-operation.html", // Will cause crash until mock DeviceOrientationClient is hooked up. "fast/js/excessive-comma-usage.html", // Tests huge initializer list, causes OOM. "fast/js/regexp-charclass-crash.html", // RegExp is too large, causing OOM "fast/regex/test1.html", // Causes DumpRenderTree to hang with V8 Loading Loading
core/java/android/webkit/DeviceOrientationManager.java 0 → 100644 +55 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.webkit; import android.util.Log; /** * This class is simply a container for the methods used to configure WebKit's * mock DeviceOrientationClient for use in LayoutTests. * * This could be part of WebViewCore, but have moved it to its own class to * avoid bloat there. * @hide */ public final class DeviceOrientationManager { /** * Sets whether the Page for the specified WebViewCore should use a mock DeviceOrientation * client. */ public static void useMock(WebViewCore webViewCore) { assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName()); nativeUseMock(webViewCore); } /** * Set the position for the mock DeviceOrientation service for the supplied WebViewCore. */ public static void setMockOrientation(WebViewCore webViewCore, boolean canProvideAlpha, double alpha, boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma) { assert WebViewCore.THREAD_NAME.equals(Thread.currentThread().getName()); nativeSetMockOrientation(webViewCore, canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); } // Native functions private static native void nativeUseMock(WebViewCore webViewCore); private static native void nativeSetMockOrientation(WebViewCore webViewCore, boolean canProvideAlpha, double alpha, boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma); }
core/java/android/webkit/WebView.java +21 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ import android.view.accessibility.AccessibilityManager; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; import android.webkit.DeviceOrientationManager; import android.webkit.WebTextView.AutoCompleteAdapter; import android.webkit.WebViewCore.EventHub; import android.webkit.WebViewCore.TouchEventData; Loading Loading @@ -3746,6 +3747,26 @@ public class WebView extends AbsoluteLayout mWebViewCore.sendMessage(EventHub.DUMP_RENDERTREE, toFile ? 1 : 0, 0); } /** * Called by DRT on UI thread, need to proxy to WebCore thread. * * @hide debug only */ public void useMockDeviceOrientation() { mWebViewCore.sendMessage(EventHub.USE_MOCK_DEVICE_ORIENTATION); } /** * Called by DRT on WebCore thread. * * @hide debug only */ public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha, boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma) { DeviceOrientationManager.setMockOrientation(mWebViewCore, canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); } /** * Dump the V8 counters to standard output. * Note that you need a build with V8 and WEBCORE_INSTRUMENTATION set to Loading
core/java/android/webkit/WebViewCore.java +11 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.util.SparseBooleanArray; import android.view.KeyEvent; import android.view.SurfaceView; import android.view.View; import android.webkit.DeviceOrientationManager; import java.util.ArrayList; import java.util.Collection; Loading Loading @@ -878,6 +879,8 @@ final class WebViewCore { // accessibility support static final int MODIFY_SELECTION = 190; static final int USE_MOCK_DEVICE_ORIENTATION = 191; // private message ids private static final int DESTROY = 200; Loading Loading @@ -1409,6 +1412,10 @@ final class WebViewCore { WebView.SET_TOUCH_HIGHLIGHT_RECTS, null) .sendToTarget(); break; case USE_MOCK_DEVICE_ORIENTATION: useMockDeviceOrientation(); break; } } }; Loading Loading @@ -2481,6 +2488,10 @@ final class WebViewCore { hMode, vMode).sendToTarget(); } private void useMockDeviceOrientation() { DeviceOrientationManager.useMock(this); } private native void nativePause(); private native void nativeResume(); private native void nativeFreeMemory(); Loading
tests/DumpRenderTree/src/com/android/dumprendertree/CallbackProxy.java +8 −0 Original line number Diff line number Diff line Loading @@ -510,6 +510,14 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon obtainMessage(SET_GEOLOCATION_PERMISSION, allow ? 1 : 0, 0).sendToTarget(); } 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 the TestShellActivity // as we need access to the Webview. mLayoutTestController.setMockDeviceOrientation(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); } public void overridePreference(String key, boolean value) { Message message = obtainMessage(OVERRIDE_PREFERENCE); message.getData().putString("key", key); Loading
tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java +0 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,6 @@ public class FileFilter { static final String[] ignoreTestList = { "editing/selection/move-left-right.html", // Causes DumpRenderTree to hang "fast/dom/DeviceOrientation/basic-operation.html", // Will cause crash until mock DeviceOrientationClient is hooked up. "fast/js/excessive-comma-usage.html", // Tests huge initializer list, causes OOM. "fast/js/regexp-charclass-crash.html", // RegExp is too large, causing OOM "fast/regex/test1.html", // Causes DumpRenderTree to hang with V8 Loading