Merge "Deleting native opengl tests as these are covered by DEQP."
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index b5a76a4..72034a4 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -166,7 +166,6 @@
CtsLocation2TestCases \
CtsMediaStressTestCases \
CtsMidiTestCases \
- CtsNativeOpenGLTestCases \
CtsNdefTestCases \
CtsNetTestCases \
CtsNetTestCasesLegacyApi22 \
diff --git a/tests/tests/nativeopengl/Android.mk b/tests/tests/nativeopengl/Android.mk
deleted file mode 100644
index d2192ad..0000000
--- a/tests/tests/nativeopengl/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright 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)
-
-LOCAL_PACKAGE_NAME := CtsNativeOpenGLTestCases
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Include both the 32 and 64 bit versions
-LOCAL_MULTILIB := both
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner ctswrappedgtest
-
-LOCAL_JNI_SHARED_LIBRARIES := libnativeopengltests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_GTEST_PACKAGE)
-
-# Include the associated library's makefile.
-include $(LOCAL_PATH)/libnativeopengltests/Android.mk
diff --git a/tests/tests/nativeopengl/AndroidManifest.xml b/tests/tests/nativeopengl/AndroidManifest.xml
deleted file mode 100644
index 72d87ac..0000000
--- a/tests/tests/nativeopengl/AndroidManifest.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * Copyright 2013 Google Inc.
- *
- * 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.opengl.cts">
-
- <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
-
- <application>
- <uses-library android:name="android.test.runner" />
- <activity android:name="com.android.opengl.cts.GLTestActivity"/>
- </application>
-
- <!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="GLTestInstrumentation"
- android:targetPackage="com.android.opengl.cts"
- android:label="Native OpenGL tests">
- </instrumentation>
-</manifest>
diff --git a/tests/tests/nativeopengl/CtsNativeOpenGLTestCases_list.txt b/tests/tests/nativeopengl/CtsNativeOpenGLTestCases_list.txt
deleted file mode 100644
index 8daf3b2..0000000
--- a/tests/tests/nativeopengl/CtsNativeOpenGLTestCases_list.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-EGLCleanupTest.
- TestCorrect
-EGLCreateContextTest.
- BadAttributeFails
-GLTest.
- ClearColorTest
diff --git a/tests/tests/nativeopengl/libnativeopengltests/Android.mk b/tests/tests/nativeopengl/libnativeopengltests/Android.mk
deleted file mode 100644
index 9338d8b..0000000
--- a/tests/tests/nativeopengl/libnativeopengltests/Android.mk
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright 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.
-
-#
-# This is the shared library included by the JNI test app.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libnativeopengltests
-
-# Don't include this package in any configuration by default.
-LOCAL_MODULE_TAGS := optional
-
-my_src_dir := ../standalone/jni
-
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/$(my_src_dir) \
- external/gtest/include
-
-# The sources are in ../standalone/jni/
-LOCAL_SRC_FILES := $(addprefix $(my_src_dir)/, \
- register.cpp \
- GLTestHelper.cpp \
- tests/GLTest_test.cpp \
- tests/EGLCleanup_test.cpp \
- tests/EGLCreateContext_test.cpp \
- )
-
-LOCAL_CXX_STL := libc++
-LOCAL_SHARED_LIBRARIES := libEGL \
- libGLESv2 \
- libandroid \
- liblog \
-
-LOCAL_STATIC_LIBRARIES := libgtest
-
-my_src_dir :=
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/nativeopengl/src/com/android/opengl/cts/GLTestActivity.java b/tests/tests/nativeopengl/src/com/android/opengl/cts/GLTestActivity.java
deleted file mode 100644
index 1633a93..0000000
--- a/tests/tests/nativeopengl/src/com/android/opengl/cts/GLTestActivity.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 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.opengl.cts;
-
-import android.app.Activity;
-import android.app.Instrumentation;
-import android.content.Intent;
-import android.os.Bundle;
-import android.test.wrappedgtest.WrappedGTestActivity;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.Surface;
-
-public class GLTestActivity extends WrappedGTestActivity {
-
- private SurfaceView mSurfaceView;
- private SurfaceHolder.Callback mHolderCallback = new SurfaceHolder.Callback() {
-
- @Override
- public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
- setSurface(holder.getSurface());
- }
-
- @Override
- public void surfaceCreated(SurfaceHolder holder) {
- setSurface(holder.getSurface());
- }
-
- @Override
- public void surfaceDestroyed(SurfaceHolder holder) {
- }
- };
-
- public void onCreate(Bundle data) {
- super.onCreate(data);
- mSurfaceView = new SurfaceView(this);
- mSurfaceView.getHolder().addCallback(mHolderCallback);
- setContentView(mSurfaceView);
- System.loadLibrary("nativeopengltests");
- }
-
- private static native void setSurface(Surface surface);
-}
diff --git a/tests/tests/nativeopengl/src/com/android/opengl/cts/GLTestInstrumentation.java b/tests/tests/nativeopengl/src/com/android/opengl/cts/GLTestInstrumentation.java
deleted file mode 100644
index 913f0eb..0000000
--- a/tests/tests/nativeopengl/src/com/android/opengl/cts/GLTestInstrumentation.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 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.opengl.cts;
-
-import android.test.wrappedgtest.WrappedGTestInstrumentation;
-
-/**
- * adb shell am instrument -w com.android.opengl.cts/.GLTestInstrumentation
- */
-public class GLTestInstrumentation extends WrappedGTestInstrumentation {
- public GLTestInstrumentation() {
- mActivityClass = GLTestActivity.class;
- }
-}
diff --git a/tests/tests/nativeopengl/standalone/.gitignore b/tests/tests/nativeopengl/standalone/.gitignore
deleted file mode 100644
index 1d1cdd2..0000000
--- a/tests/tests/nativeopengl/standalone/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-bin/
-build.xml
-gen/
-libs/
-local.properties
-obj/
-proguard-project.txt
-project.properties
diff --git a/tests/tests/nativeopengl/standalone/AndroidManifest.xml b/tests/tests/nativeopengl/standalone/AndroidManifest.xml
deleted file mode 100644
index 9092f69..0000000
--- a/tests/tests/nativeopengl/standalone/AndroidManifest.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
- * Copyright 2013 Google Inc.
- *
- * 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.gltest"
- android:versionCode="1"
- android:versionName="1.0"
- android:debuggable="true" >
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="15" />
-
- <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
-
- <application android:label="NativeGLTest">
- <activity android:name=".GLTestActivity">
- <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/tests/nativeopengl/standalone/jni/Android.mk b/tests/tests/nativeopengl/standalone/jni/Android.mk
deleted file mode 100644
index 53d9bbf..0000000
--- a/tests/tests/nativeopengl/standalone/jni/Android.mk
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright 2013 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.
-#
-
-MY_LOCAL_PATH := $(call my-dir)
-MY_GTEST_PATH := $(MY_LOCAL_PATH)/../../../../../../external/gtest
-
-# gtest
-
-LOCAL_PATH := $(MY_GTEST_PATH)
-
-include $(CLEAR_VARS)
-
-LOCAL_CPP_EXTENSION := .cc
-LOCAL_MODULE := libgtest
-LOCAL_C_INCLUDES := $(MY_GTEST_PATH)/include
-LOCAL_SRC_FILES := src/gtest-all.cc
-
-include $(BUILD_STATIC_LIBRARY)
-
-# nativetests
-
-LOCAL_PATH := $(MY_LOCAL_PATH)
-
-include $(CLEAR_VARS)
-
-LIB_PATH := $(LOCAL_PATH)/../libs/$(TARGET_ARCH_ABI)/
-LOCAL_C_INCLUDES := $(MY_GTEST_PATH)/include
-LOCAL_LDLIBS := -L$(LIB_PATH) -landroid -lEGL -lGLESv2 -llog
-LOCAL_STATIC_LIBRARIES := libgtest
-LOCAL_MODULE := nativeopengltests
-LOCAL_SRC_FILES := GLTestHelper.cpp \
- register.cpp \
- tests/GLTest_test.cpp \
- tests/EGLCleanup_test.cpp \
- tests/EGLCreateContext_test.cpp
-
-LOCAL_SHARED_LIBRARIES := libgtest
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/nativeopengl/standalone/jni/Application.mk b/tests/tests/nativeopengl/standalone/jni/Application.mk
deleted file mode 100644
index 76d05a7..0000000
--- a/tests/tests/nativeopengl/standalone/jni/Application.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2013 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.
-#
-
-APP_STL := stlport_shared
diff --git a/tests/tests/nativeopengl/standalone/jni/GLTestHelper.cpp b/tests/tests/nativeopengl/standalone/jni/GLTestHelper.cpp
deleted file mode 100644
index d1f29d5..0000000
--- a/tests/tests/nativeopengl/standalone/jni/GLTestHelper.cpp
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * Copyright 2013 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.
- */
-
-#define LOG_TAG "GLTest"
-#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
-
-#include <android/log.h>
-#include <android/native_window.h>
-#include <GLTestHelper.h>
-
-// this listener is used to forward the subset of
-// gtest output needed to generate CTS results
-class CTSGTestListener : public EmptyTestEventListener {
-public:
- CTSGTestListener(JNIEnv *env, jobject activity)
- : mActivity(activity), mEnv(env) {
-
- jclass clazz = env->FindClass(
- "android/test/wrappedgtest/WrappedGTestActivity");
- mSendStatusID = env->GetMethodID(clazz, "sendStatus",
- "(Ljava/lang/String;)V");
- mMessageBuffer = new char[2048];
- }
-
- ~CTSGTestListener() {
- delete[] mMessageBuffer;
- }
-
-private:
- jobject mActivity;
- JNIEnv * mEnv;
- jmethodID mSendStatusID;
- char * mMessageBuffer;
-
- virtual void OnTestIterationStart(const UnitTest& unit_test,
- int iteration) {
- snprintf(mMessageBuffer, sizeof(char) * 2048,
- "[==========] Running %i tests from %i test cases.",
- unit_test.test_to_run_count(),
- unit_test.test_case_to_run_count());
-
- mEnv->CallVoidMethod(mActivity, mSendStatusID,
- mEnv->NewStringUTF(mMessageBuffer));
- }
-
- virtual void OnTestStart(const TestInfo& test_info) {
- snprintf(mMessageBuffer, sizeof(char) * 2048, "[ RUN ] %s.%s",
- test_info.test_case_name(), test_info.name());
-
- mEnv->CallVoidMethod(mActivity, mSendStatusID,
- mEnv->NewStringUTF(mMessageBuffer));
- }
-
- virtual void OnTestPartResult(const TestPartResult& result) {
- if (result.type() == TestPartResult::kSuccess) {
- return;
- }
-
- snprintf(mMessageBuffer, sizeof(char) * 2048, "%s:%i: Failure\n%s",
- result.file_name(), result.line_number(), result.message());
-
- mEnv->CallVoidMethod(mActivity, mSendStatusID,
- mEnv->NewStringUTF(mMessageBuffer));
- }
-
- virtual void OnTestEnd(const TestInfo& test_info) {
- const char * result = test_info.result()->Passed() ?
- "[ OK ] " : "[ FAILED ] ";
-
- snprintf(mMessageBuffer, sizeof(char) * 2048, "%s%s.%s (%lli ms)",
- result, test_info.test_case_name(), test_info.name(),
- test_info.result()->elapsed_time());
-
- mEnv->CallVoidMethod(mActivity, mSendStatusID,
- mEnv->NewStringUTF(mMessageBuffer));
- }
-
- virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration) {
- snprintf(mMessageBuffer, sizeof(char) * 2048,
- "[==========] %i tests from %i test cases ran. (%lli ms total)",
- unit_test.test_to_run_count(),
- unit_test.test_case_to_run_count(), unit_test.elapsed_time());
-
- mEnv->CallVoidMethod(mActivity, mSendStatusID,
- mEnv->NewStringUTF(mMessageBuffer));
- }
-};
-
-// this listener is similar to the default gtest listener
-// but it outputs the results to the log instead of stdout
-class LogGTestListener : public EmptyTestEventListener {
-
-private:
- virtual void OnTestIterationStart(const UnitTest& unit_test,
- int iteration) {
- LOGI("[==========] Running %i tests from %i test cases.\n",
- unit_test.test_to_run_count(),
- unit_test.test_case_to_run_count());
- }
-
- virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) {
- LOGI("[==========] Global test environment set-up.\n");
- }
-
- virtual void OnTestCaseStart(const TestCase& test_case) {
- LOGI("[----------] %i tests from %s\n",
- test_case.test_to_run_count(),
- test_case.name());
-
- }
-
- virtual void OnTestStart(const TestInfo& test_info) {
- LOGI("[ RUN ] %s.%s\n", test_info.test_case_name(),
- test_info.name());
-
- }
-
- virtual void OnTestPartResult(const TestPartResult& result) {
- if (result.type() == TestPartResult::kSuccess) {
- return;
- }
-
- LOGI("%s:%i: Failure\n%s\n", result.file_name(), result.line_number(),
- result.message());
- }
-
- virtual void OnTestEnd(const TestInfo& test_info) {
- const char * result = test_info.result()->Passed() ?
- "[ OK ] " : "[ FAILED ] ";
-
- LOGI("%s%s.%s (%lli ms)\n", result, test_info.test_case_name(),
- test_info.name(), test_info.result()->elapsed_time());
- }
-
-
- virtual void OnTestCaseEnd(const TestCase& test_case) {
- LOGI("[----------] %i tests from %s (%lli ms total)\n",
- test_case.test_to_run_count(), test_case.name(),
- test_case.elapsed_time());
-
- }
-
- virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) {
- LOGI("[==========] Global test environment tear-down.\n");
- }
-
- void PrintFailedTests(const UnitTest& unit_test) {
- const int failed_test_count = unit_test.failed_test_count();
- if (failed_test_count == 0) {
- return;
- }
-
- for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
- const TestCase& test_case = *unit_test.GetTestCase(i);
-
- if (!test_case.should_run() || test_case.failed_test_count() == 0) {
- continue;
- }
-
- for (int j = 0; j < test_case.total_test_count(); ++j) {
- const TestInfo& test_info = *test_case.GetTestInfo(j);
- if (!test_info.should_run() || test_info.result()->Passed()) {
- continue;
- }
- LOGI("[ FAILED ] %s.%s\n", test_case.name(),
- test_info.name());
- }
- }
- }
- virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration) {
- LOGI("[==========] %i tests from %i test cases ran. (%lli ms total)\n",
- unit_test.test_to_run_count(),
- unit_test.test_case_to_run_count(), unit_test.elapsed_time());
-
- LOGI("[ PASSED ] %i tests\n", unit_test.successful_test_count());
-
- if(unit_test.Passed()) {
- return;
- }
-
- LOGI("[ FAILED ] %i tests, listed below:\n",
- unit_test.failed_test_count());
-
- PrintFailedTests(unit_test);
-
- LOGI("\n%2d FAILED TESTS\n", unit_test.failed_test_count());
- }
-};
-
-ANativeWindow* GLTestHelper::mWindow;
-
-ANativeWindow* GLTestHelper::getWindow() {
- return mWindow;
-}
-
-void GLTestHelper::setWindow(JNIEnv *env, jobject obj, jobject surface) {
- mWindow = ANativeWindow_fromSurface(env, surface);
-}
-
-int GLTestHelper::runGTests(TestEventListener * listener, char * filter) {
-
- if (filter) {
- ::testing::GTEST_FLAG(filter) = filter;
- }
-
- int argc = 0;
- InitGoogleTest(&argc, (char**)NULL);
-
- TestEventListeners& listeners = UnitTest::GetInstance()->listeners();
- delete listeners.Release(listeners.default_result_printer());
-
- listeners.Append(listener);
- int result = RUN_ALL_TESTS();
- return result;
-}
-
-int GLTestHelper::runTests(JNIEnv *env, jobject obj, jstring filter) {
- LogGTestListener * listener = new LogGTestListener();
-
- char * filter_cstr = NULL;
-
- // set filter if there is one
- if (filter) {
- filter_cstr = new char[512];
- const char * ptr = env->GetStringUTFChars(filter, NULL);
- snprintf(filter_cstr, sizeof(char) * 512, "%s", ptr);
- env->ReleaseStringUTFChars(filter, ptr);
- }
-
- int result = runGTests(listener, filter_cstr);
-
- if (filter_cstr) {
- delete[] filter_cstr;
- }
-
- delete listener;
- return result;
-}
-
-int GLTestHelper::runTestsCTS(JNIEnv *env, jobject obj, jobject activity) {
- CTSGTestListener * listener = new CTSGTestListener(env, activity);
- int result = runGTests(listener, NULL);
- delete listener;
- return result;
-}
-
-int GLTestHelper::registerNative(JNIEnv * env) {
-
- jclass clazz = env->FindClass("com/android/opengl/cts/GLTestActivity");
-
- jthrowable exception = env->ExceptionOccurred();
- // CTS class not found, assume stand-alone application
- if (exception) {
- env->ExceptionClear();
-
- if (!env->IsInstanceOf(env->ExceptionOccurred(),
- env->FindClass("java/lang/NoClassDefFoundError"))) {
- env->Throw(exception);
- }
-
- //
- JNINativeMethod standaloneMethods[] = {
- // name, signature, function
- { "setSurface", "(Landroid/view/Surface;)V", (void*)(GLTestHelper::setWindow) },
- { "runTests", "(Ljava/lang/String;)V", (void*)(GLTestHelper::runTests) },
- };
-
- return env->RegisterNatives(
- env->FindClass("com/android/gltest/GLTestActivity"),
- standaloneMethods,
- sizeof(standaloneMethods) / sizeof(JNINativeMethod));
- }
-
- // GLTestActivity methods
- JNINativeMethod glTestActMethods[] = {
- // name, signature, function
- { "setSurface", "(Landroid/view/Surface;)V", (void*)(GLTestHelper::setWindow) },
- };
-
- int result = env->RegisterNatives(clazz, glTestActMethods,
- sizeof(glTestActMethods) / sizeof(JNINativeMethod));
-
- if (result) {
- return result;
- }
-
- // WrappedGTestActivity methods
- JNINativeMethod wrappedGTestActMethods[] = {
- // name, signature, function
- { "runTests", "(Landroid/test/wrappedgtest/WrappedGTestActivity;)I",
- (void*)(GLTestHelper::runTestsCTS) },
- };
-
- return env->RegisterNatives(
- env->FindClass("android/test/wrappedgtest/WrappedGTestActivity"),
- wrappedGTestActMethods,
- sizeof(wrappedGTestActMethods) / sizeof(JNINativeMethod));
-}
diff --git a/tests/tests/nativeopengl/standalone/jni/GLTestHelper.h b/tests/tests/nativeopengl/standalone/jni/GLTestHelper.h
deleted file mode 100644
index d09d2f1..0000000
--- a/tests/tests/nativeopengl/standalone/jni/GLTestHelper.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2013 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.
- */
-
-#ifndef ANDROID_GL_TEST_HELPER_H
-#define ANDROID_GL_TEST_HELPER_H
-
-#include <android/native_window_jni.h>
-#include <gtest/gtest.h>
-
-using namespace testing;
-
-class GLTestHelper
-{
-private:
- static ANativeWindow* mWindow;
- static int runGTests(TestEventListener* listener, char * filter);
- static int runTests(JNIEnv* env, jobject obj, jstring filter);
- static int runTestsCTS(JNIEnv* env, jobject obj, jobject activity);
-public:
- static ANativeWindow* getWindow();
- static void setWindow(JNIEnv* env, jobject obj, jobject surface);
- static int registerNative(JNIEnv* env);
-};
-
-
-
-#endif // ANDROID_GL_TEST_HELPER_H
diff --git a/tests/tests/nativeopengl/standalone/jni/register.cpp b/tests/tests/nativeopengl/standalone/jni/register.cpp
deleted file mode 100644
index 8dd14ed..0000000
--- a/tests/tests/nativeopengl/standalone/jni/register.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2013 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.
- */
-
-#include <jni.h>
-#include <GLTestHelper.h>
-
-/*
- * This function is called automatically by the system when this
- * library is loaded. We use it to register all our native functions,
- * which is the recommended practice for Android.
- */
-jint JNI_OnLoad(JavaVM *vm, void *reserved) {
- JNIEnv *env = NULL;
-
- if (vm->GetEnv((void **) &env, JNI_VERSION_1_4) != JNI_OK) {
- return JNI_ERR;
- }
-
- if (GLTestHelper::registerNative(env)) {
- return JNI_ERR;
- }
-
- return JNI_VERSION_1_4;
-}
diff --git a/tests/tests/nativeopengl/standalone/jni/tests/EGLCleanup_test.cpp b/tests/tests/nativeopengl/standalone/jni/tests/EGLCleanup_test.cpp
deleted file mode 100644
index db39798..0000000
--- a/tests/tests/nativeopengl/standalone/jni/tests/EGLCleanup_test.cpp
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * Copyright 2013 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.
- */
-
-#define LOG_TAG "EGLCleanup"
-#include <android/log.h>
-#include <jni.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include <gtest/gtest.h>
-
-#include <GLTestHelper.h>
-
-#include <pthread.h>
-
-#define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
-#define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
-#define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)
-#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
-
-namespace android {
-
-/**
- * Tests EGL cleanup edge cases.
- */
-class EGLCleanupTest : public ::testing::Test {
-protected:
- EGLCleanupTest() {}
-
- virtual void SetUp() {
- // Termination of a terminated display is defined to be a no-op.
- // Android uses a refcounted implementation, so terminate it a few
- // times to make sure it's really dead. Without this, we might not
- // get all the way into the driver eglTerminate implementation
- // when we call eglTerminate.
- EGLDisplay disp = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- if (disp != EGL_NO_DISPLAY) {
- ALOGD("speculative terminate");
- eglTerminate(disp);
- eglTerminate(disp);
- eglTerminate(disp);
- }
- }
- virtual void TearDown() {}
-};
-
-/**
- * Perform an operation and then start a new thread.
- *
- * The trick here is that some code may be helpfully releasing storage in
- * pthread_key destructors. Those run after the thread returns out of the
- * initial function, but before the thread fully exits. We want them to
- * run concurrently with the next thread's initialization so we can confirm
- * that the specified behavior of eglTerminate vs. eglInitialize holds.
- */
-class ChainedThread {
-public:
- enum TestType {
- TEST_CORRECT,
- TEST_NO_RELEASE_CURRENT
- };
-
- ChainedThread(TestType testType) : mEglDisplay(EGL_NO_DISPLAY),
- mEglSurface(EGL_NO_SURFACE), mEglContext(EGL_NO_CONTEXT),
- mTestType(testType), mIteration(0), mResult(true) {
- pthread_mutex_init(&mLock, NULL);
- pthread_cond_init(&mCond, NULL);
- }
- ~ChainedThread() {
- // could get fancy and clean up the mutex
- }
-
- /* start here */
- bool start() {
- lock();
- bool result = startThread_l();
- unlock();
- return result;
- }
-
- /* waits until test is done; when finished, call getResult() */
- bool waitForEnd() {
- lock();
- int err = pthread_cond_wait(&mCond, &mLock);
- if (err != 0) {
- ALOGW("pthread_cond_wait failed: %d", err);
- }
- unlock();
- return err == 0;
- }
-
- /* returns the result; true means success */
- bool getResult() {
- return mResult;
- }
-
-private:
- enum { MAX_ITERATIONS = 1000 };
-
- EGLDisplay mEglDisplay;
- EGLSurface mEglSurface;
- EGLContext mEglContext;
-
- TestType mTestType;
- int mIteration;
- bool mResult;
- pthread_mutex_t mLock;
- pthread_cond_t mCond;
-
- // Assertions set a flag in Java and return from the current method (which
- // must be declared to return void). They do not throw a C++ exception.
- //
- // Because we're running in a separate thread, which is not attached to
- // the VM, the assert macros don't help us much. We could attach to the
- // VM (by linking to libdvm.so and calling a global function), but the
- // assertions won't cause the test to stop, which makes them less valuable.
- //
- // So instead we just return a boolean out of functions that can fail.
-
- /* call this to start the test */
- bool startThread_l() {
- pthread_attr_t attr;
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-
- pthread_t newThread;
- int err = pthread_create(&newThread, &attr, ChainedThread::func,
- (void*) this);
- return (err == 0);
- }
-
- /* thread entry point */
- static void* func(void* arg) {
- ChainedThread* obj = static_cast<ChainedThread*>(arg);
- obj->doWork();
- return NULL;
- }
-
- bool lock() {
- int err = pthread_mutex_lock(&mLock);
- if (err != 0) {
- ALOGW("pthread_mutex_lock failed: %d", err);
- }
- return err == 0;
- }
-
- bool unlock() {
- int err = pthread_mutex_unlock(&mLock);
- if (err != 0) {
- ALOGW("pthread_mutex_unlock failed: %d", err);
- }
- return err == 0;
- }
-
- /* main worker */
- void doWork() {
- lock();
-
- if ((mIteration % 25) == 0) {
- ALOGD("iteration %d\n", mIteration);
- }
-
- mIteration++;
- bool result = runTest_l();
- if (!result) {
- ALOGW("failed at iteration %d, stopping test", mIteration);
- mResult = false;
- mIteration = MAX_ITERATIONS;
- }
-
- if (mIteration < MAX_ITERATIONS) {
- // still going, try to start the next one
- if (!startThread_l()) {
- ALOGW("Unable to start thread at iter=%d", mIteration);
- mResult = false;
- mIteration = MAX_ITERATIONS;
- }
- }
-
- if (mIteration >= MAX_ITERATIONS) {
- ALOGD("Test ending, signaling main thread");
- pthread_cond_signal(&mCond);
- }
-
- unlock();
- }
-
- /* setup, use, release EGL */
- bool runTest_l() {
- if (!eglSetup()) {
- return false;
- }
- if (!eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
- mEglContext))
- {
- ALOGW("eglMakeCurrent failed: 0x%x", eglGetError());
- return false;
- }
- if (!eglRelease_l()) {
- return false;
- }
-
- return true;
- }
-
- /*
- * Sets up EGL. Creates a 1280x720 pbuffer, which is large enough to
- * cause a rapid and highly visible memory leak if we fail to discard it.
- */
- bool eglSetup() {
- static const EGLint kConfigAttribs[] = {
- EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_NONE
- };
- static const EGLint kContextAttribs[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE
- };
- static const EGLint kPbufferAttribs[] = {
- EGL_WIDTH, 1280,
- EGL_HEIGHT, 720,
- EGL_NONE
- };
-
- //usleep(25000);
-
- mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- if (mEglDisplay == EGL_NO_DISPLAY) {
- ALOGW("eglGetDisplay failed: 0x%x", eglGetError());
- return false;
- }
-
- EGLint majorVersion, minorVersion;
- if (!eglInitialize(mEglDisplay, &majorVersion, &minorVersion)) {
- ALOGW("eglInitialize failed: 0x%x", eglGetError());
- return false;
- }
-
- EGLConfig eglConfig;
- EGLint numConfigs = 0;
- if (!eglChooseConfig(mEglDisplay, kConfigAttribs, &eglConfig,
- 1, &numConfigs)) {
- ALOGW("eglChooseConfig failed: 0x%x", eglGetError());
- return false;
- }
-
- mEglSurface = eglCreatePbufferSurface(mEglDisplay, eglConfig,
- kPbufferAttribs);
- if (mEglSurface == EGL_NO_SURFACE) {
- ALOGW("eglCreatePbufferSurface failed: 0x%x", eglGetError());
- return false;
- }
-
- mEglContext = eglCreateContext(mEglDisplay, eglConfig, EGL_NO_CONTEXT,
- kContextAttribs);
- if (mEglContext == EGL_NO_CONTEXT) {
- ALOGW("eglCreateContext failed: 0x%x", eglGetError());
- return false;
- }
-
- return true;
- }
-
- /*
- * Releases EGL. How we do that depends on the type of test we're
- * running.
- */
- bool eglRelease_l() {
- if (mEglDisplay == EGL_NO_DISPLAY) {
- ALOGW("No display to release");
- return false;
- }
-
- switch (mTestType) {
- case TEST_CORRECT:
- eglTerminate(mEglDisplay);
- eglReleaseThread();
- break;
- case TEST_NO_RELEASE_CURRENT:
- eglDestroyContext(mEglDisplay, mEglContext);
- eglDestroySurface(mEglDisplay, mEglSurface);
- eglTerminate(mEglDisplay);
- break;
- default:
- ALOGE("Unknown test type %d", mTestType);
- break;
- }
-
- int err = eglGetError();
- if (err != EGL_SUCCESS) {
- ALOGW("eglRelease failed: 0x%x", err);
- return false;
- }
- return true;
- }
-};
-
-
-/* do things correctly */
-TEST_F(EGLCleanupTest, TestCorrect) {
- ALOGI("Starting TEST_CORRECT");
- ChainedThread cht(ChainedThread::TEST_CORRECT);
-
- // start initial thread
- ASSERT_TRUE(cht.start());
-
- // wait for the end
- cht.waitForEnd();
- bool result = cht.getResult();
- ASSERT_TRUE(result);
-}
-
-/* try it without un-currenting the surfaces and context
-TEST _F(EGLCleanupTest, TestNoReleaseCurrent) {
- ALOGI("Starting TEST_NO_RELEASE_CURRENT");
- ChainedThread cht(ChainedThread::TEST_NO_RELEASE_CURRENT);
-
- // start initial thread
- ASSERT_TRUE(cht.start());
-
- // wait for the end
- cht.waitForEnd();
- bool result = cht.getResult();
- ASSERT_TRUE(result);
-}
-*/
-
-} // namespace android
diff --git a/tests/tests/nativeopengl/standalone/jni/tests/EGLCreateContext_test.cpp b/tests/tests/nativeopengl/standalone/jni/tests/EGLCreateContext_test.cpp
deleted file mode 100644
index b7e5f7c..0000000
--- a/tests/tests/nativeopengl/standalone/jni/tests/EGLCreateContext_test.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright 2013 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.
- */
-
-#include <android/native_window.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <GLES2/gl2.h>
-
-#include <gtest/gtest.h>
-
-#include <android/log.h>
-
-#include "GLTestHelper.h"
-
-#define LOG_TAG "EGLCreateContext_test"
-#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
-
-namespace android {
-
-static int getGlVersion() {
- const char* s = (const char*)glGetString(GL_VERSION);
- if (!s)
- return 0;
- int major, minor;
- if (sscanf(s, "OpenGL ES %d.%d", &major, &minor) != 2)
- return 0;
- return major;
-}
-
-class EGLCreateContextTest : public ::testing::Test {
-
-protected:
-
- EGLCreateContextTest()
- : mEglDisplay(EGL_NO_DISPLAY),
- mEglConfig(0),
- mEglWindowSurface(EGL_NO_SURFACE),
- mEglContext(EGL_NO_CONTEXT)
- {}
-
- virtual void SetUp() {
- // static const EGLint SURFACE_ATTRIBS[] = {
- // EGL_NONE
- // };
-
- mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay);
-
- EGLint major, minor;
- ASSERT_TRUE(eglInitialize(mEglDisplay, &major, &minor));
-
- EGLint numConfigs = 0;
- ASSERT_TRUE(eglChooseConfig(mEglDisplay, getConfigAttribs(),
- &mEglConfig, 1, &numConfigs));
- ASSERT_GE(1, numConfigs);
- ASSERT_NE((EGLConfig)0, mEglConfig);
-
- mEglWindowSurface = eglCreateWindowSurface(mEglDisplay, mEglConfig,
- GLTestHelper::getWindow(), getWindowSurfaceAttribs());
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_SURFACE, mEglWindowSurface);
- }
-
- virtual void TearDown() {
- if (mEglContext != EGL_NO_CONTEXT) {
- eglDestroyContext(mEglDisplay, mEglContext);
- }
- if (mEglWindowSurface != EGL_NO_SURFACE) {
- eglDestroySurface(mEglDisplay, mEglWindowSurface);
- }
- if (mEglDisplay != EGL_NO_DISPLAY) {
- eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
- EGL_NO_CONTEXT);
- eglTerminate(mEglDisplay);
- }
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- }
-
- virtual const EGLint* getConfigAttribs() {
- static const EGLint ATTRIBS[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
- EGL_NONE
- };
- return ATTRIBS;
- }
-
- virtual const EGLint* getWindowSurfaceAttribs() {
- return NULL;
- }
-
- EGLDisplay mEglDisplay;
- EGLConfig mEglConfig;
- EGLSurface mEglWindowSurface;
- EGLContext mEglContext;
-};
-
-TEST_F(EGLCreateContextTest, BadAttributeFails) {
- // First check that we can successfully create a context
- EGLint attribs[5] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE, EGL_NONE, EGL_NONE,
- };
- mEglContext = eglCreateContext(mEglDisplay, mEglConfig, EGL_NO_CONTEXT,
- attribs);
- ASSERT_NE(mEglContext, EGL_NO_CONTEXT);
- ASSERT_EQ(eglGetError(), EGL_SUCCESS);
- ASSERT_EQ(EGL_TRUE, eglDestroyContext(mEglDisplay, mEglContext));
- mEglContext = EGL_NO_CONTEXT;
-
- // Now add an invalid attribute and make sure eglCreateContext fails
- attribs[2] = EGL_BAD_ATTRIBUTE; // error code, not a valid attribute
- mEglContext = eglCreateContext(mEglDisplay, mEglConfig, EGL_NO_CONTEXT,
- attribs);
- ASSERT_EQ(mEglContext, EGL_NO_CONTEXT);
- ASSERT_EQ(eglGetError(), EGL_BAD_ATTRIBUTE);
-}
-
-} // namespace android
diff --git a/tests/tests/nativeopengl/standalone/jni/tests/GLTest_test.cpp b/tests/tests/nativeopengl/standalone/jni/tests/GLTest_test.cpp
deleted file mode 100644
index 5df090d..0000000
--- a/tests/tests/nativeopengl/standalone/jni/tests/GLTest_test.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright 2013 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.
- */
-
-
-#include <android/native_window.h>
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include <gtest/gtest.h>
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include <GLTestHelper.h>
-
-
-namespace android {
-
-class GLTest : public ::testing::Test {
-
-protected:
-
- GLTest():
- mEglDisplay(EGL_NO_DISPLAY),
- mEglSurface(EGL_NO_SURFACE),
- mEglContext(EGL_NO_CONTEXT) {
- }
-
-
- virtual void SetUp() {
- mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay);
-
- EGLint majorVersion;
- EGLint minorVersion;
- EXPECT_TRUE(eglInitialize(mEglDisplay, &majorVersion, &minorVersion));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- EGLint numConfigs = 0;
- EXPECT_TRUE(eglChooseConfig(mEglDisplay, getConfigAttribs(), &mGlConfig,
- 1, &numConfigs));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- char* displaySecsEnv = getenv("GLTEST_DISPLAY_SECS");
- if (displaySecsEnv != NULL) {
- mDisplaySecs = atoi(displaySecsEnv);
- if (mDisplaySecs < 0) {
- mDisplaySecs = 0;
- }
- } else {
- mDisplaySecs = 0;
- }
-
- if (mDisplaySecs > 0) {
- mEglSurface = eglCreateWindowSurface(mEglDisplay, mGlConfig,
- GLTestHelper::getWindow(), NULL);
- } else {
- EGLint pbufferAttribs[] = {
- EGL_WIDTH, getSurfaceWidth(),
- EGL_HEIGHT, getSurfaceHeight(),
- EGL_NONE };
-
- mEglSurface = eglCreatePbufferSurface(mEglDisplay, mGlConfig,
- pbufferAttribs);
- }
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_SURFACE, mEglSurface);
-
- mEglContext = eglCreateContext(mEglDisplay, mGlConfig, EGL_NO_CONTEXT,
- getContextAttribs());
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- ASSERT_NE(EGL_NO_CONTEXT, mEglContext);
-
- EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
- mEglContext));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- EGLint w, h;
- EXPECT_TRUE(eglQuerySurface(mEglDisplay, mEglSurface, EGL_WIDTH, &w));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- EXPECT_TRUE(eglQuerySurface(mEglDisplay, mEglSurface, EGL_HEIGHT, &h));
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
-
- glViewport(0, 0, w, h);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- }
-
- virtual void TearDown() {
- // Display the result
- if (mDisplaySecs > 0 && mEglSurface != EGL_NO_SURFACE) {
- eglSwapBuffers(mEglDisplay, mEglSurface);
- sleep(mDisplaySecs);
- }
-
- if (mEglContext != EGL_NO_CONTEXT) {
- eglDestroyContext(mEglDisplay, mEglContext);
- }
- if (mEglSurface != EGL_NO_SURFACE) {
- eglDestroySurface(mEglDisplay, mEglSurface);
- }
- if (mEglDisplay != EGL_NO_DISPLAY) {
- eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
- EGL_NO_CONTEXT);
- eglTerminate(mEglDisplay);
- }
- ASSERT_EQ(EGL_SUCCESS, eglGetError());
- }
-
- virtual EGLint const* getConfigAttribs() {
- static EGLint sDefaultConfigAttribs[] = {
- EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
- EGL_RED_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 8,
- EGL_DEPTH_SIZE, 16,
- EGL_STENCIL_SIZE, 8,
- EGL_NONE };
-
- return sDefaultConfigAttribs;
- }
-
- virtual EGLint const* getContextAttribs() {
- static EGLint sDefaultContextAttribs[] = {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_NONE };
-
- return sDefaultContextAttribs;
- }
-
- virtual EGLint getSurfaceWidth() {
- return 512;
- }
-
- virtual EGLint getSurfaceHeight() {
- return 512;
- }
-
- bool checkPixel(GLubyte * actual, GLubyte * expected, int tolerance) {
- for (int i = 0; i < 4; i++) {
- if (abs(actual[i] - expected[i]) > tolerance) {
- return false;
- }
- }
- return true;
- }
-
- ::testing::AssertionResult AssertPixel(const char* a_expr,
- const char* e_expr, const char* t_expr, GLubyte * actual,
- GLubyte * expected, int tolerance) {
-
- if (checkPixel(actual, expected, tolerance)) {
- return ::testing::AssertionSuccess();
- }
-
- return ::testing::AssertionFailure()
- << "Pixel comparison failed with tolerance " << tolerance << "\n"
- << "Actual: r=" << (int)actual[0] << " g=" << (int)actual[1]
- << " b=" << (int)actual[2] << " a=" << (int)actual[3] << "\n"
- << "Expected: r=" << (int)expected[0] << " g=" << (int)expected[1]
- << " b=" << (int)expected[2] << " a=" << (int)expected[3] << "\n";
- }
-
- int mDisplaySecs;
-
- EGLDisplay mEglDisplay;
- EGLSurface mEglSurface;
- EGLContext mEglContext;
- EGLConfig mGlConfig;
-};
-
-TEST_F(GLTest, ClearColorTest) {
- glClearColor(0.2, 0.2, 0.2, 0.2);
- glClear(GL_COLOR_BUFFER_BIT);
- GLubyte expected[4] = { 51, 51, 51, 51 };
- GLubyte pixel[4];
- glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
- ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
- ASSERT_PRED_FORMAT3(AssertPixel, pixel, expected, 2);
-}
-
-} // namespace android
diff --git a/tests/tests/nativeopengl/standalone/src/com/android/gltest/GLTestActivity.java b/tests/tests/nativeopengl/standalone/src/com/android/gltest/GLTestActivity.java
deleted file mode 100644
index f0c250b..0000000
--- a/tests/tests/nativeopengl/standalone/src/com/android/gltest/GLTestActivity.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2013 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.gltest;
-
-import android.app.Activity;
-import android.app.KeyguardManager;
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.os.Bundle;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.Surface;
-
-public class GLTestActivity extends Activity {
-
- private class TestThread extends Thread {
-
- public void run() {
- // it is possible to set the GTest filter flag from here
- // for example "GLTest.ClearColorTest" to run that specific test only
- runTests(null);
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
-
- finish();
- System.exit(0);
- }
- }
-
- private SurfaceView mSurfaceView;
-
- private SurfaceHolder.Callback mHolderCallback = new SurfaceHolder.Callback() {
-
- public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
- setSurface(holder.getSurface());
- }
-
- public void surfaceCreated(SurfaceHolder holder) {
- setSurface(holder.getSurface());
- Thread t = new TestThread();
- t.start();
- }
-
- public void surfaceDestroyed(SurfaceHolder holder) {
- }
- };
-
- @SuppressWarnings("deprecation")
- @Override
- public void onCreate(Bundle savedInstanceState) {
- if (checkCallingOrSelfPermission(android.Manifest.permission.DISABLE_KEYGUARD)
- == PackageManager.PERMISSION_GRANTED) {
- KeyguardManager keyguardManager =
- (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
- keyguardManager.newKeyguardLock("gltest").disableKeyguard();
- }
-
- super.onCreate(savedInstanceState);
-
- mSurfaceView = new SurfaceView(this);
- mSurfaceView.getHolder().addCallback(mHolderCallback);
- setContentView(mSurfaceView);
- System.loadLibrary("stlport_shared");
- System.loadLibrary("nativeopengltests");
- }
-
- private static native void setSurface(Surface surface);
- private static native void runTests(String filter);
-}
diff --git a/tools/utils/buildCts.py b/tools/utils/buildCts.py
index 235e7fc..22f2f01 100755
--- a/tools/utils/buildCts.py
+++ b/tools/utils/buildCts.py
@@ -350,7 +350,6 @@
'android.location' : [],
'android.nativemedia.sl' : [],
'android.nativemedia.xa' : [],
- 'android.nativeopengl' : [],
'android.ndef' : [],
'android.opengl' : [],
'android.openglperf' : [],