Makefile changes to use build-system supported native test settings (for device-based tests only).

Change-Id: Iccd6d628cd16cc23c6944d284a4da1075a6042af
diff --git a/tests/test-apps/NativeTestSampleApp/Android.mk b/tests/test-apps/NativeTestSampleApp/Android.mk
index 5bba518..f1ef111 100644
--- a/tests/test-apps/NativeTestSampleApp/Android.mk
+++ b/tests/test-apps/NativeTestSampleApp/Android.mk
@@ -12,22 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Makefile to build sample static library with native tests.
-
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
 
-#All source files for the library
-LOCAL_SRC_FILES := \
-    src/TradeFedNativeTestSampleLib.cpp
-
-LOCAL_C_INCLUDES := \
-	$(LOCAL_PATH)/include
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MODULE := tfnativetestsamplelib
-
-include $(BUILD_STATIC_LIBRARY)
 include $(call all-makefiles-under,$(LOCAL_PATH))
 
diff --git a/tests/test-apps/NativeTestSampleApp/src/Android.mk b/tests/test-apps/NativeTestSampleApp/src/Android.mk
new file mode 100644
index 0000000..1bb595c
--- /dev/null
+++ b/tests/test-apps/NativeTestSampleApp/src/Android.mk
@@ -0,0 +1,30 @@
+# 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.
+
+# Makefile to build sample static library that has native tests.
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+#All source files for the library
+LOCAL_SRC_FILES := TradeFedNativeTestSampleLib.cpp
+
+LOCAL_C_INCLUDES := \
+	$(LOCAL_PATH)/../include
+
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_MODULE := tfnativetestsamplelib
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/tests/test-apps/NativeTestSampleApp/tests/Android.mk b/tests/test-apps/NativeTestSampleApp/tests/Android.mk
index bee4d65..3c97119 100644
--- a/tests/test-apps/NativeTestSampleApp/tests/Android.mk
+++ b/tests/test-apps/NativeTestSampleApp/tests/Android.mk
@@ -12,10 +12,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Makefile to build device-based native tests.
+# Makefile to build device-based native tests for a test static library.
 
-# GTest does not build on the simulator because it depends on
-# STLport.
+# GTest does not build on the simulator because it depends on STLport.
 ifneq ($(TARGET_SIMULATOR),true)
 
 LOCAL_PATH := $(call my-dir)
@@ -26,36 +25,22 @@
 	TradeFedNativeTestSample_test.cpp \
 	TradeFedNativeTestSample2_test.cpp
 
-# stlport required for gtest
-LOCAL_SHARED_LIBRARIES := \
-	libstlport
-
-# GTest libraries
+# Library to be tested
 LOCAL_STATIC_LIBRARIES := \
-	libgtest \
-	libgtest_main \
 	tfnativetestsamplelib
 
-# bionic, libstdc++, and stlport are required for gtest
 LOCAL_C_INCLUDES := \
-    bionic \
-    bionic/libstdc++/include \
-    external/gtest/include \
-    external/stlport/stlport \
 	$(LOCAL_PATH)/../include
 
-LOCAL_MODULE_TAGS := tests
-
 # All gtests in all files should be compiled into one binary
 # The standard naming should conform to: <module_being_tested>tests
 LOCAL_MODULE := tfnativetestsamplelibtests
 
-# Always put native tests into data/nativetest
-# TODO: change this to use a global variable
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
+# Standard location for native device tests; automatically defaults
+# to $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE) - only define this if you
+# want to override the default location to use a different subdirectory, such as:
+# LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS)/special_tfnativetestsamplelib
 
-EXTRA_CFLAGS := -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING
+include $(BUILD_NATIVE_TEST)
 
-include $(BUILD_EXECUTABLE)
-
-endif  #($(TARGET_SIMULATOR),true)
+endif
diff --git a/tests/test-apps/TradeFedNativeTestApp/Android.mk b/tests/test-apps/TradeFedNativeTestApp/Android.mk
index 1404f43..63f11e5 100644
--- a/tests/test-apps/TradeFedNativeTestApp/Android.mk
+++ b/tests/test-apps/TradeFedNativeTestApp/Android.mk
@@ -21,37 +21,13 @@
 include $(CLEAR_VARS)
 
 # All source files will be bundled into one test module
-LOCAL_SRC_FILES := \
-	TradeFedNativeTestApp_test.cpp
-
-# stlport required for gtest
-LOCAL_SHARED_LIBRARIES := \
-	libstlport
-
-# GTest libraries
-LOCAL_STATIC_LIBRARIES := \
-	libgtest \
-	libgtest_main
-
-# bionic, libstdc++, and stlport are required for gtest
-LOCAL_C_INCLUDES := \
-    bionic \
-    bionic/libstdc++/include \
-    external/gtest/include \
-    external/stlport/stlport
-
-LOCAL_MODULE_TAGS := tests
+LOCAL_SRC_FILES := TradeFedNativeTestApp_test.cpp
 
 # All gtests in all files should be compiled into one binary
 # The standard naming should conform to: <module_being_tested>tests
 # For example, for libjingle, use libjingletests
 LOCAL_MODULE := nativetestapp
 
-# Always put native tests into data/nativetest
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest/tfnativetests
-# TODO: Move this into a new variable: TARGET_OUT_DATA_NATIVE_TESTS, eg:
-#LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS)/tfnativetests
+include $(BUILD_NATIVE_TEST)
 
-include $(BUILD_EXECUTABLE)
-
-endif  # ($(TARGET_SIMULATOR),true)
+endif