summaryrefslogtreecommitdiffstats
path: root/renderscript
diff options
context:
space:
mode:
authorZhuoyao Zhang <zhuoyao@google.com>2017-11-15 18:16:46 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-11-15 18:16:46 +0000
commita529b73890d88044fd1cfaeac3cd8bf8d8fff807 (patch)
tree2737f9a0fae3c3f1d62b62946e1bf8aa6fe45729 /renderscript
parent0c9df89f885c6e7866aed1046323d05be17c13ee (diff)
parent4fae0e4f75cb66f34e9e928702681291d9fa74db (diff)
downloadandroid_hardware_interfaces-a529b73890d88044fd1cfaeac3cd8bf8d8fff807.tar.gz
android_hardware_interfaces-a529b73890d88044fd1cfaeac3cd8bf8d8fff807.tar.bz2
android_hardware_interfaces-a529b73890d88044fd1cfaeac3cd8bf8d8fff807.zip
Merge "Convert Renderscript Hal test to test against each of the service names."
am: 4fae0e4f75 Change-Id: I76769806c8e90411055c4864b57e8271cc1894a8
Diffstat (limited to 'renderscript')
-rw-r--r--renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp14
-rw-r--r--renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h13
2 files changed, 17 insertions, 10 deletions
diff --git a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
index c6eecd6af..0636cf951 100644
--- a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
+++ b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
@@ -18,7 +18,8 @@
// The main test class for RENDERSCRIPT HIDL HAL.
void RenderscriptHidlTest::SetUp() {
- device = ::testing::VtsHalHidlTargetTestBase::getService<IDevice>();
+ device = ::testing::VtsHalHidlTargetTestBase::getService<IDevice>(
+ RenderscriptHidlEnvironment::Instance()->getServiceName<IDevice>());
ASSERT_NE(nullptr, device.get());
uint32_t version = 0;
@@ -34,17 +35,10 @@ void RenderscriptHidlTest::TearDown() {
}
}
-// A class for test environment setup (kept since this file is a template).
-class RenderscriptHidlEnvironment : public ::testing::Environment {
-public:
- virtual void SetUp() {}
- virtual void TearDown() {}
-};
-
-
int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(new RenderscriptHidlEnvironment);
+ ::testing::AddGlobalTestEnvironment(RenderscriptHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ RenderscriptHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
return status;
diff --git a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h
index 527fef082..e11ab92b6 100644
--- a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h
+++ b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.h
@@ -25,6 +25,7 @@
#include <android/hardware/renderscript/1.0/types.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <gtest/gtest.h>
using ::android::hardware::renderscript::V1_0::Allocation;
@@ -99,4 +100,16 @@ private:
sp<IDevice> device;
};
+// Test environment for RENDERSCRIPT HIDL HAL.
+class RenderscriptHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static RenderscriptHidlEnvironment* Instance() {
+ static RenderscriptHidlEnvironment* instance = new RenderscriptHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IDevice>(); }
+};
+
#endif // VTS_HAL_RENDERSCRIPT_V1_0_TARGET_TESTS_H