summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/BiDiTests/Android.mk (renamed from tests/BiDiTests/AndroidPrivate.mk)0
-rw-r--r--tests/Compatibility/Android.mk31
-rw-r--r--tests/Compatibility/AndroidManifest.xml29
-rw-r--r--tests/Compatibility/src/com/android/compatibilitytest/AppCompatibility.java165
-rw-r--r--tests/Compatibility/src/com/android/compatibilitytest/AppCompatibilityRunner.java35
-rw-r--r--tests/DumpRenderTree/src/com/android/dumprendertree/CallbackProxy.java30
-rw-r--r--tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestController.java4
-rw-r--r--tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java52
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestController.java26
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java52
-rw-r--r--tests/RenderScriptTests/tests/src/com/android/rs/test/rsdebug.rs6
11 files changed, 332 insertions, 98 deletions
diff --git a/tests/BiDiTests/AndroidPrivate.mk b/tests/BiDiTests/Android.mk
index ae29fc2..ae29fc2 100644
--- a/tests/BiDiTests/AndroidPrivate.mk
+++ b/tests/BiDiTests/Android.mk
diff --git a/tests/Compatibility/Android.mk b/tests/Compatibility/Android.mk
new file mode 100644
index 0000000..5385413
--- /dev/null
+++ b/tests/Compatibility/Android.mk
@@ -0,0 +1,31 @@
+# Copyright (C) 2012 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.
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+# We only want this apk build for tests.
+LOCAL_MODULE_TAGS := tests
+
+# Include all test java files.
+LOCAL_SRC_FILES := \
+ $(call all-java-files-under, src)
+
+
+LOCAL_SDK_VERSION := 8
+LOCAL_PACKAGE_NAME := AppCompatibilityTest
+
+include $(BUILD_PACKAGE)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/Compatibility/AndroidManifest.xml b/tests/Compatibility/AndroidManifest.xml
new file mode 100644
index 0000000..103ef4c
--- /dev/null
+++ b/tests/Compatibility/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.compatibilitytest" >
+ <application >
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation
+ android:name=".AppCompatibilityRunner"
+ android:targetPackage="com.android.compatibilitytest"
+ android:label="App Compability Test Runner" />
+
+ <uses-sdk android:minSdkVersion="8"></uses-sdk>
+</manifest>
diff --git a/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibility.java b/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibility.java
new file mode 100644
index 0000000..4d60c83
--- /dev/null
+++ b/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibility.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2012 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 com.android.compatibilitytest;
+
+import android.app.ActivityManager;
+import android.app.ActivityManager.ProcessErrorStateInfo;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.test.InstrumentationTestCase;
+import android.util.Log;
+
+import junit.framework.Assert;
+
+import java.util.Collection;
+
+/**
+ * Application Compatibility Test that launches an application and detects crashes.
+ */
+public class AppCompatibility extends InstrumentationTestCase {
+
+ private static final String TAG = "AppCompability";
+ private static final String PACKAGE_TO_LAUNCH = "package_to_launch";
+ private static final String APP_LAUNCH_TIMEOUT_MSECS = "app_launch_timeout_ms";
+ private static final String WORKSPACE_LAUNCH_TIMEOUT_MSECS = "workspace_launch_timeout_ms";
+
+ private int mAppLaunchTimeout = 7000;
+ private int mWorkspaceLaunchTimeout = 2000;
+
+ private Context mContext;
+ private ActivityManager mActivityManager;
+ private PackageManager mPackageManager;
+ private AppCompatibilityRunner mRunner;
+ private Bundle mArgs;
+
+ @Override
+ public void setUp() throws Exception{
+ super.setUp();
+ mRunner = (AppCompatibilityRunner) getInstrumentation();
+ assertNotNull("Could not fetch InstrumentationTestRunner.",mRunner);
+
+ mContext = mRunner.getTargetContext();
+ Assert.assertNotNull("Could not get the Context", mContext);
+
+ mActivityManager = (ActivityManager)
+ mContext.getSystemService(Context.ACTIVITY_SERVICE);
+ Assert.assertNotNull("Could not get Activity Manager", mActivityManager);
+
+ mPackageManager = mContext.getPackageManager();
+ Assert.assertNotNull("Missing Package Manager", mPackageManager);
+
+ mArgs = mRunner.getBundle();
+
+ // Parse optional inputs.
+ String appLaunchTimeoutMsecs = mArgs.getString(APP_LAUNCH_TIMEOUT_MSECS);
+ if (appLaunchTimeoutMsecs != null) {
+ mAppLaunchTimeout = Integer.parseInt(appLaunchTimeoutMsecs);
+ }
+ String workspaceLaunchTimeoutMsecs = mArgs.getString(WORKSPACE_LAUNCH_TIMEOUT_MSECS);
+ if (workspaceLaunchTimeoutMsecs != null) {
+ mWorkspaceLaunchTimeout = Integer.parseInt(workspaceLaunchTimeoutMsecs);
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Actual test case that launches the package and throws an exception on the first error.
+ * @throws Exception
+ */
+ public void testAppStability() throws Exception {
+ String packageName = mArgs.getString(PACKAGE_TO_LAUNCH);
+ if (packageName != null) {
+ Log.d(TAG, "Launching app " + packageName);
+ Collection<ProcessErrorStateInfo> err = launchActivity(packageName);
+ // Make sure there are no errors when launching the application, otherwise raise an
+ // exception with the first error encountered.
+ assertNull(getFirstError(err), err);
+ } else {
+ Log.d(TAG, "Missing argument, use " + PACKAGE_TO_LAUNCH +
+ " to specify the package to launch");
+ }
+ }
+
+ /**
+ * Gets the first error in collection and return the long message for it.
+ * @param in {@link Collection} of {@link ProcessErrorStateInfo} to parse.
+ * @return {@link String} the long message of the error.
+ */
+ private String getFirstError(Collection<ProcessErrorStateInfo> in) {
+ if (in == null) {
+ return null;
+ }
+ ProcessErrorStateInfo err = in.iterator().next();
+ if (err != null) {
+ return err.stackTrace;
+ }
+ return null;
+ }
+
+ /**
+ * Launches and activity and queries for errors.
+ * @param packageName {@link String} the package name of the application to launch.
+ * @return {@link Collection} of {@link ProcessErrorStateInfo} detected during the app launch.
+ */
+ private Collection<ProcessErrorStateInfo> launchActivity(String packageName) {
+ Intent homeIntent = new Intent(Intent.ACTION_MAIN);
+ homeIntent.addCategory(Intent.CATEGORY_HOME);
+ homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+
+ Intent intent = mPackageManager.getLaunchIntentForPackage(packageName);
+
+ // We check for any Crash or ANR dialogs that are already up, and we ignore them. This is
+ // so that we don't report crashes that were caused by prior apps (which those particular
+ // tests should have caught and reported already). Otherwise, test failures would cascade
+ // from the initial broken app to many/all of the tests following that app's launch.
+ final Collection<ProcessErrorStateInfo> preErr = mActivityManager.getProcessesInErrorState();
+
+ // Launch Activity
+ mContext.startActivity(intent);
+
+ try {
+ Thread.sleep(mAppLaunchTimeout);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ // Send the "home" intent and wait 2 seconds for us to get there
+ mContext.startActivity(homeIntent);
+ try {
+ Thread.sleep(mWorkspaceLaunchTimeout);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ // See if there are any errors. We wait until down here to give ANRs as much time as
+ // possible to occur.
+ final Collection<ProcessErrorStateInfo> postErr =
+ mActivityManager.getProcessesInErrorState();
+ // Take the difference between the error processes we see now, and the ones that were
+ // present when we started
+ if (preErr != null && postErr != null) {
+ postErr.removeAll(preErr);
+ }
+ return postErr;
+ }
+}
diff --git a/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibilityRunner.java b/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibilityRunner.java
new file mode 100644
index 0000000..258937f
--- /dev/null
+++ b/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibilityRunner.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2012, 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 com.android.compatibilitytest;
+
+import android.os.Bundle;
+import android.test.InstrumentationTestRunner;
+
+public class AppCompatibilityRunner extends InstrumentationTestRunner {
+
+ private Bundle mArgs;
+
+ @Override
+ public void onCreate(Bundle args) {
+ super.onCreate(args);
+ mArgs = args;
+ }
+
+ public Bundle getBundle() {
+ return mArgs;
+ }
+}
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/CallbackProxy.java b/tests/DumpRenderTree/src/com/android/dumprendertree/CallbackProxy.java
index d74f5f7..9d621d6 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/CallbackProxy.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/CallbackProxy.java
@@ -19,7 +19,6 @@ package com.android.dumprendertree;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
-import android.webkit.MockGeolocation;
import android.webkit.WebStorage;
import java.util.HashMap;
@@ -48,7 +47,6 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon
private static final int EVENT_CLEAR_TOUCH_POINTS = 17;
private static final int EVENT_CANCEL_TOUCH_POINT = 18;
private static final int EVENT_SET_TOUCH_MODIFIER = 19;
-
private static final int LAYOUT_CLEAR_LIST = 20;
private static final int LAYOUT_DISPLAY = 21;
private static final int LAYOUT_DUMP_TEXT = 22;
@@ -72,10 +70,9 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon
private static final int LAYOUT_WAIT_UNTIL_DONE = 40;
private static final int LAYOUT_DUMP_DATABASE_CALLBACKS = 41;
private static final int LAYOUT_SET_CAN_OPEN_WINDOWS = 42;
- private static final int SET_GEOLOCATION_PERMISSION = 43;
- private static final int OVERRIDE_PREFERENCE = 44;
- private static final int LAYOUT_DUMP_CHILD_FRAMES_TEXT = 45;
- private static final int SET_XSS_AUDITOR_ENABLED = 46;
+ private static final int OVERRIDE_PREFERENCE = 43;
+ private static final int LAYOUT_DUMP_CHILD_FRAMES_TEXT = 44;
+ private static final int SET_XSS_AUDITOR_ENABLED = 45;
CallbackProxy(EventSender eventSender,
LayoutTestController layoutTestController) {
@@ -269,11 +266,6 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon
mLayoutTestController.setCanOpenWindows();
break;
- case SET_GEOLOCATION_PERMISSION:
- mLayoutTestController.setGeolocationPermission(
- msg.arg1 == 1 ? true : false);
- break;
-
case OVERRIDE_PREFERENCE:
String key = msg.getData().getString("key");
boolean value = msg.getData().getBoolean("value");
@@ -497,17 +489,23 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon
public void setMockGeolocationPosition(double latitude,
double longitude,
double accuracy) {
- MockGeolocation.getInstance().setPosition(latitude,
- longitude,
- accuracy);
+ // Configuration is in WebKit, so stay on WebCore thread, but go via the TestShellActivity
+ // as we need access to the Webview.
+ mLayoutTestController.setMockGeolocationPosition(latitude,
+ longitude,
+ accuracy);
}
public void setMockGeolocationError(int code, String message) {
- MockGeolocation.getInstance().setError(code, message);
+ // Configuration is in WebKit, so stay on WebCore thread, but go via the TestShellActivity
+ // as we need access to the Webview.
+ mLayoutTestController.setMockGeolocationError(code, message);
}
public void setGeolocationPermission(boolean allow) {
- obtainMessage(SET_GEOLOCATION_PERMISSION, allow ? 1 : 0, 0).sendToTarget();
+ // Configuration is in WebKit, so stay on WebCore thread, but go via the TestShellActivity
+ // as we need access to the Webview.
+ mLayoutTestController.setGeolocationPermission(allow);
}
public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha,
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestController.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestController.java
index 9be2f1c..c936a6c 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestController.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestController.java
@@ -72,6 +72,10 @@ public interface LayoutTestController {
// For XSSAuditor tests
public void setXSSAuditorEnabled(boolean flag);
+ // For Geolocation tests
+ public void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
+ public void setMockGeolocationError(int code, String message);
+
// For DeviceOrientation tests
public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha,
boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma);
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java
index bbfbfc4..2b58f14 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java
@@ -539,24 +539,22 @@ public class TestShellActivity extends Activity implements LayoutTestController
mCanOpenWindows = true;
}
- /**
- * Sets the Geolocation permission state to be used for all future requests.
- */
+ @Override
+ public void setMockGeolocationPosition(double latitude, double longitude, double accuracy) {
+ WebViewClassic.fromWebView(mWebView).setMockGeolocationPosition(latitude,
+ longitude,
+ accuracy);
+ }
+
+ @Override
+ public void setMockGeolocationError(int code, String message) {
+ WebViewClassic.fromWebView(mWebView).setMockGeolocationError(code, message);
+ }
+
@Override
public void setGeolocationPermission(boolean allow) {
- mIsGeolocationPermissionSet = true;
- mGeolocationPermission = allow;
-
- if (mPendingGeolocationPermissionCallbacks != null) {
- Iterator iter = mPendingGeolocationPermissionCallbacks.keySet().iterator();
- while (iter.hasNext()) {
- GeolocationPermissions.Callback callback =
- (GeolocationPermissions.Callback) iter.next();
- String origin = (String) mPendingGeolocationPermissionCallbacks.get(callback);
- callback.invoke(origin, mGeolocationPermission, false);
- }
- mPendingGeolocationPermissionCallbacks = null;
- }
+ Log.v(LOGTAG, "setGeolocationPermission() allow=" + allow);
+ WebViewClassic.fromWebView(mWebView).setMockGeolocationPermission(allow);
}
@Override
@@ -749,22 +747,11 @@ public class TestShellActivity extends Activity implements LayoutTestController
callback.updateQuota(currentQuota + 1024 * 1024 * 5);
}
- /**
- * Instructs the client to show a prompt to ask the user to set the
- * Geolocation permission state for the specified origin.
- */
@Override
public void onGeolocationPermissionsShowPrompt(String origin,
GeolocationPermissions.Callback callback) {
- if (mIsGeolocationPermissionSet) {
- callback.invoke(origin, mGeolocationPermission, false);
- return;
- }
- if (mPendingGeolocationPermissionCallbacks == null) {
- mPendingGeolocationPermissionCallbacks =
- new HashMap<GeolocationPermissions.Callback, String>();
- }
- mPendingGeolocationPermissionCallbacks.put(callback, origin);
+ throw new RuntimeException(
+ "The WebCore mock used by DRT should bypass the usual permissions flow.");
}
@Override
@@ -849,9 +836,8 @@ public class TestShellActivity extends Activity implements LayoutTestController
mPageFinished = false;
mDumpWebKitData = false;
setDefaultWebSettings(mWebView);
- mIsGeolocationPermissionSet = false;
- mPendingGeolocationPermissionCallbacks = null;
CookieManager.getInstance().removeAllCookie();
+ mWebViewClassic.setUseMockGeolocation();
}
private boolean canMoveToNextTest() {
@@ -958,8 +944,4 @@ public class TestShellActivity extends Activity implements LayoutTestController
static final int DRAW_RUNS = 5;
static final String DRAW_TIME_LOG = Environment.getExternalStorageDirectory() +
"/android/page_draw_time.txt";
-
- private boolean mIsGeolocationPermissionSet;
- private boolean mGeolocationPermission;
- private Map mPendingGeolocationPermissionCallbacks;
}
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestController.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestController.java
index d0c59d3..bb3bf62 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestController.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestController.java
@@ -80,6 +80,21 @@ public class LayoutTestController {
quota);
}
+ public void setMockGeolocationPosition(double latitude,
+ double longitude,
+ double accuracy) {
+ Log.i(LOG_TAG, "setMockGeolocationPosition(): " + "latitude=" + latitude +
+ " longitude=" + longitude + " accuracy=" + accuracy);
+ mLayoutTestsExecutor.setMockGeolocationPosition(latitude,
+ longitude,
+ accuracy);
+ }
+
+ public void setMockGeolocationError(int code, String message) {
+ Log.i(LOG_TAG, "setMockGeolocationError(): " + "code=" + code + " message=" + message);
+ mLayoutTestsExecutor.setMockGeolocationError(code, message);
+ }
+
public void setGeolocationPermission(boolean allow) {
mLayoutTestsExecutor.setGeolocationPermission(allow);
}
@@ -95,17 +110,6 @@ public class LayoutTestController {
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 setXSSAuditorEnabled(boolean flag) {
mLayoutTestsExecutor.setXSSAuditorEnabled(flag);
}
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java
index f958ade..b2fbfd5 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java
@@ -109,9 +109,6 @@ public class LayoutTestsExecutor extends Activity {
private LayoutTestController mLayoutTestController = new LayoutTestController(this);
private boolean mCanOpenWindows;
private boolean mDumpDatabaseCallbacks;
- private boolean mIsGeolocationPermissionSet;
- private boolean mGeolocationPermission;
- private Map<GeolocationPermissions.Callback, String> mPendingGeolocationPermissionCallbacks;
private EventSender mEventSender = new EventSender();
@@ -255,15 +252,8 @@ public class LayoutTestsExecutor extends Activity {
@Override
public void onGeolocationPermissionsShowPrompt(String origin,
GeolocationPermissions.Callback callback) {
- if (mIsGeolocationPermissionSet) {
- callback.invoke(origin, mGeolocationPermission, false);
- return;
- }
- if (mPendingGeolocationPermissionCallbacks == null) {
- mPendingGeolocationPermissionCallbacks =
- new HashMap<GeolocationPermissions.Callback, String>();
- }
- mPendingGeolocationPermissionCallbacks.put(callback, origin);
+ throw new RuntimeException(
+ "The WebCore mock used by DRT should bypass the usual permissions flow.");
}
};
@@ -394,6 +384,7 @@ public class LayoutTestsExecutor extends Activity {
webViewSettings.setPageCacheCapacity(0);
// This is asynchronous, but it gets processed by WebCore before it starts loading pages.
+ WebViewClassic.fromWebView(mCurrentWebView).setUseMockGeolocation();
WebViewClassic.fromWebView(mCurrentWebView).setUseMockDeviceOrientation();
// Must do this after setting the AppCache path.
@@ -573,9 +564,8 @@ public class LayoutTestsExecutor extends Activity {
private static final int MSG_DUMP_CHILD_FRAMES_AS_TEXT = 3;
private static final int MSG_SET_CAN_OPEN_WINDOWS = 4;
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;
+ private static final int MSG_OVERRIDE_PREFERENCE = 6;
+ private static final int MSG_SET_XSS_AUDITOR_ENABLED = 7;
/** String constants for use with layoutTestController.overridePreference() */
private final String WEBKIT_OFFLINE_WEB_APPLICATION_CACHE_ENABLED =
@@ -644,22 +634,6 @@ public class LayoutTestsExecutor extends Activity {
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_SET_XSS_AUDITOR_ENABLED:
WebViewClassic.fromWebView(mCurrentWebView).getSettings().
setXSSAuditorEnabled(msg.arg1 == 1);
@@ -679,8 +653,6 @@ public class LayoutTestsExecutor extends Activity {
private void resetLayoutTestController() {
mCanOpenWindows = false;
mDumpDatabaseCallbacks = false;
- mIsGeolocationPermissionSet = false;
- mPendingGeolocationPermissionCallbacks = null;
}
public void dumpAsText(boolean enablePixelTest) {
@@ -721,12 +693,20 @@ public class LayoutTestsExecutor extends Activity {
mLayoutTestControllerHandler.sendEmptyMessage(MSG_SET_CAN_OPEN_WINDOWS);
}
+ public void setMockGeolocationPosition(double latitude, double longitude, double accuracy) {
+ WebViewClassic.fromWebView(mCurrentWebView).setMockGeolocationPosition(latitude,
+ longitude,
+ accuracy);
+ }
+
+ public void setMockGeolocationError(int code, String message) {
+ WebViewClassic.fromWebView(mCurrentWebView).setMockGeolocationError(code, message);
+ }
+
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();
+ WebViewClassic.fromWebView(mCurrentWebView).setMockGeolocationPermission(allow);
}
public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha,
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/rsdebug.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/rsdebug.rs
index f7942a5..68ac168 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/rsdebug.rs
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/rsdebug.rs
@@ -2,6 +2,9 @@
// Testing primitive types
float floatTest = 1.99f;
+float2 float2Test = {2.99f, 12.99f};
+float3 float3Test = {3.99f, 13.99f, 23.99f};
+float4 float4Test = {4.99f, 14.99f, 24.99f, 34.99f};
double doubleTest = 2.05;
char charTest = -8;
short shortTest = -16;
@@ -23,6 +26,9 @@ static bool basic_test(uint32_t index) {
// For this reason, none of the outputs are actually checked.
rsDebug("floatTest", floatTest);
+ rsDebug("float2Test", float2Test);
+ rsDebug("float3Test", float3Test);
+ rsDebug("float4Test", float4Test);
rsDebug("doubleTest", doubleTest);
rsDebug("charTest", charTest);
rsDebug("shortTest", shortTest);