summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/CropFilter.java5
-rw-r--r--tests/CoreTests/android/core/ProxyTest.java93
-rw-r--r--tests/CoreTests/android/core/SSLSocketTest.java4
-rw-r--r--tests/SslLoad/Android.mk10
-rw-r--r--tests/SslLoad/AndroidManifest.xml13
-rw-r--r--tests/SslLoad/src/com/android/sslload/SslLoad.java123
6 files changed, 4 insertions, 244 deletions
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/CropFilter.java b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/CropFilter.java
index 91fe21c..6c0f353 100644
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/CropFilter.java
+++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/CropFilter.java
@@ -20,7 +20,6 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
-import android.util.FloatMath;
import androidx.media.filterfw.Filter;
import androidx.media.filterfw.FrameImage2D;
@@ -90,8 +89,8 @@ public class CropFilter extends Filter {
// Pull input frame
FrameImage2D inputImage = getConnectedInputPort("image").pullFrame().asFrameImage2D();
int[] inDims = inputImage.getDimensions();
- int[] croppedDims = { (int)FloatMath.ceil(mCropRect.xEdge().length() * inDims[0]),
- (int)FloatMath.ceil(mCropRect.yEdge().length() * inDims[1]) };
+ int[] croppedDims = { (int)Math.ceil(mCropRect.xEdge().length() * inDims[0]),
+ (int)Math.ceil(mCropRect.yEdge().length() * inDims[1]) };
int[] outDims = { getOutputWidth(croppedDims[0], croppedDims[1]),
getOutputHeight(croppedDims[0], croppedDims[1]) };
FrameImage2D outputImage = outPort.fetchAvailableFrame(outDims).asFrameImage2D();
diff --git a/tests/CoreTests/android/core/ProxyTest.java b/tests/CoreTests/android/core/ProxyTest.java
deleted file mode 100644
index 12acfe8..0000000
--- a/tests/CoreTests/android/core/ProxyTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.core;
-
-import org.apache.http.HttpHost;
-
-import android.content.Context;
-import android.net.Proxy;
-import android.test.AndroidTestCase;
-
-/**
- * Proxy tests
- */
-public class ProxyTest extends AndroidTestCase {
- private Context mContext;
- private HttpHost mHttpHost;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- mContext = getContext();
- mHttpHost = null;
- String proxyHost = Proxy.getHost(mContext);
- int proxyPort = Proxy.getPort(mContext);
- if (proxyHost != null) {
- mHttpHost = new HttpHost(proxyHost, proxyPort, "http");
- }
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- /**
- * Bad url parameter should not cause any exception.
- */
- public void testProxyGetPreferredHttpHost_UrlBad() throws Exception {
- assertEquals(mHttpHost, Proxy.getPreferredHttpHost(mContext, null));
- assertEquals(mHttpHost, Proxy.getPreferredHttpHost(mContext, ""));
- assertEquals(mHttpHost, Proxy.getPreferredHttpHost(mContext, "bad:"));
- assertEquals(mHttpHost, Proxy.getPreferredHttpHost(mContext, "bad"));
- assertEquals(mHttpHost, Proxy.getPreferredHttpHost(mContext, "bad:\\"));
- assertEquals(mHttpHost, Proxy.getPreferredHttpHost(mContext, "bad://#"));
- assertEquals(mHttpHost, Proxy.getPreferredHttpHost(mContext, "://#"));
- }
-
- /**
- * Proxy (if available) should be returned when url parameter is not localhost.
- */
- public void testProxyGetPreferredHttpHost_UrlNotlLocalhost() throws Exception {
- assertEquals(mHttpHost, Proxy.getPreferredHttpHost(mContext, "http://"));
- assertEquals(mHttpHost, Proxy.getPreferredHttpHost(mContext, "http://example.com"));
- assertEquals(mHttpHost, Proxy.getPreferredHttpHost(mContext, "http://example.com/"));
- assertEquals(mHttpHost, Proxy.getPreferredHttpHost(mContext, "http://192.168.0.1/"));
- assertEquals(mHttpHost, Proxy.getPreferredHttpHost(mContext, "file:///foo/bar"));
- assertEquals(mHttpHost, Proxy.getPreferredHttpHost(mContext, "rtsp://example.com"));
- assertEquals(mHttpHost, Proxy.getPreferredHttpHost(mContext, "rtsp://example.com/"));
- assertEquals(mHttpHost, Proxy.getPreferredHttpHost(mContext, "javascript:alert(1)"));
- }
-
- /**
- * No proxy should be returned when url parameter is localhost.
- */
- public void testProxyGetPreferredHttpHost_UrlLocalhost() throws Exception {
- assertNull(Proxy.getPreferredHttpHost(mContext, "http://localhost"));
- assertNull(Proxy.getPreferredHttpHost(mContext, "http://localhost/"));
- assertNull(Proxy.getPreferredHttpHost(mContext, "http://localhost/hej.html"));
- assertNull(Proxy.getPreferredHttpHost(mContext, "http://127.0.0.1"));
- assertNull(Proxy.getPreferredHttpHost(mContext, "http://127.0.0.1/"));
- assertNull(Proxy.getPreferredHttpHost(mContext, "http://127.0.0.1/hej.html"));
- assertNull(Proxy.getPreferredHttpHost(mContext, "http://127.0.0.1:80/"));
- assertNull(Proxy.getPreferredHttpHost(mContext, "http://127.0.0.1:8080/"));
- assertNull(Proxy.getPreferredHttpHost(mContext, "rtsp://127.0.0.1/"));
- assertNull(Proxy.getPreferredHttpHost(mContext, "rtsp://localhost/"));
- assertNull(Proxy.getPreferredHttpHost(mContext, "https://localhost/"));
- }
-}
diff --git a/tests/CoreTests/android/core/SSLSocketTest.java b/tests/CoreTests/android/core/SSLSocketTest.java
index b06790b..65062c2 100644
--- a/tests/CoreTests/android/core/SSLSocketTest.java
+++ b/tests/CoreTests/android/core/SSLSocketTest.java
@@ -907,7 +907,7 @@ public class SSLSocketTest extends TestCase {
*/
public void testClientSessionCaching() throws IOException,
KeyManagementException {
- OpenSSLContextImpl context = new OpenSSLContextImpl();
+ OpenSSLContextImpl context = OpenSSLContextImpl.getPreferred();
// Cache size = 2.
FakeClientSessionCache fakeCache = new FakeClientSessionCache();
@@ -1000,7 +1000,7 @@ public class SSLSocketTest extends TestCase {
public void testFileBasedClientSessionCache() throws IOException,
KeyManagementException {
- OpenSSLContextImpl context = new OpenSSLContextImpl();
+ OpenSSLContextImpl context = OpenSSLContextImpl.getPreferred();
String tmpDir = System.getProperty("java.io.tmpdir");
if (tmpDir == null) {
fail("Please set 'java.io.tmpdir' system property.");
diff --git a/tests/SslLoad/Android.mk b/tests/SslLoad/Android.mk
deleted file mode 100644
index f75be8d..0000000
--- a/tests/SslLoad/Android.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := SslLoad
-
-include $(BUILD_PACKAGE)
diff --git a/tests/SslLoad/AndroidManifest.xml b/tests/SslLoad/AndroidManifest.xml
deleted file mode 100644
index 497b1c7..0000000
--- a/tests/SslLoad/AndroidManifest.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.sslload">
- <uses-permission android:name="android.permission.INTERNET" />
- <application>
- <activity android:name="SslLoad" android:label="SSL Load">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
diff --git a/tests/SslLoad/src/com/android/sslload/SslLoad.java b/tests/SslLoad/src/com/android/sslload/SslLoad.java
deleted file mode 100644
index 62aa524..0000000
--- a/tests/SslLoad/src/com/android/sslload/SslLoad.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2008 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.sslload;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Calendar;
-import java.util.Map;
-
-import android.app.Activity;
-import android.content.res.Resources;
-import android.media.MediaPlayer;
-import android.os.Handler;
-import android.os.Vibrator;
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.TextView;
-import android.util.Log;
-import android.net.http.AndroidHttpClient;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.ResponseHandler;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.HttpResponse;
-
-public class SslLoad extends Activity implements OnClickListener, Runnable {
-
- private static final String TAG = SslLoad.class.getSimpleName();
-
- private Button button;
- private boolean running = false;
-
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
-
- Thread requestThread = new Thread(this);
- requestThread.setDaemon(true);
- requestThread.start();
-
- button = new Button(this);
- button.setText("GO");
- button.setOnClickListener(this);
-
- setContentView(button);
- }
-
- @Override
- protected void onStop() {
- super.onStop();
-
- synchronized (this) {
- running = false;
- }
- }
-
- public void onClick(View v) {
- synchronized (this) {
- running = !running;
- button.setText(running ? "STOP" : "GO");
- if (running) {
- this.notifyAll();
- }
- }
- }
-
- public void run() {
- boolean error = false;
- while (true) {
- synchronized (this) {
- while (!running) {
- try {
- this.wait();
- } catch (InterruptedException e) { /* ignored */ }
- }
- }
-
- AndroidHttpClient client = AndroidHttpClient.newInstance(
- "Mozilla/5.001 (windows; U; NT4.0; en-us) Gecko/25250101");
- try {
- // Cert. is for "www.google.com", not "google.com".
- String url = error ? "https://google.com/"
- : "https://www.google.com";
- client.execute(new HttpGet(url),
- new ResponseHandler<Void>() {
- public Void handleResponse(HttpResponse response) {
- /* ignore */
- return null;
- }
- });
- Log.i(TAG, "Request succeeded.");
- } catch (IOException e) {
- Log.w(TAG, "Request failed.", e);
- }
-
- client.close();
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) { /* ignored */ }
-
- error = !error;
- }
- }
-}