Update VTS tests with the new test harness.

Bug: 120601396
Test: All VTS
Change-Id: I539e75585b2cc01d153565814491361adfa048be
Merged-In: I539e75585b2cc01d153565814491361adfa048be
(cherry picked from commit 9e2b97b83cd3163750bebe55e6b55811ca8a6712)
diff --git a/neuralnetworks/1.2/vts/functional/GeneratedTestHarness.h b/neuralnetworks/1.2/vts/functional/GeneratedTestHarness.h
index de45242..27208ce 100644
--- a/neuralnetworks/1.2/vts/functional/GeneratedTestHarness.h
+++ b/neuralnetworks/1.2/vts/functional/GeneratedTestHarness.h
@@ -23,12 +23,46 @@
 #include <functional>
 #include <vector>
 #include "TestHarness.h"
+#include "VtsHalNeuralnetworks.h"
 
 namespace android {
 namespace hardware {
 namespace neuralnetworks {
 namespace V1_2 {
-namespace generated_tests {
+namespace vts {
+namespace functional {
+
+class GeneratedTestBase
+    : public NeuralnetworksHidlTest,
+      public ::testing::WithParamInterface<test_helper::TestModelManager::TestParam> {
+  protected:
+    void SetUp() override {
+        NeuralnetworksHidlTest::SetUp();
+        ASSERT_NE(mTestModel, nullptr);
+    }
+
+    const test_helper::TestModel* mTestModel = GetParam().second;
+};
+
+#define INSTANTIATE_GENERATED_TEST(TestSuite, filter)                                          \
+    INSTANTIATE_TEST_SUITE_P(                                                                  \
+            TestGenerated, TestSuite,                                                          \
+            ::testing::ValuesIn(::test_helper::TestModelManager::get().getTestModels(filter)), \
+            [](const auto& info) { return info.param.first; })
+
+// Tag for the validation tests, instantiated in VtsHalNeuralnetworks.cpp.
+// TODO: Clean up the hierarchy for ValidationTest.
+class ValidationTest : public GeneratedTestBase {
+  protected:
+    void validateEverything(const Model& model, const Request& request);
+    void validateFailure(const Model& model, const Request& request);
+
+  private:
+    void validateModel(const Model& model);
+    void validateRequest(const sp<IPreparedModel>& preparedModel, const Request& request);
+    void validateRequestFailure(const sp<IPreparedModel>& preparedModel, const Request& request);
+    void validateBurst(const sp<IPreparedModel>& preparedModel, const Request& request);
+};
 
 Model createModel(const ::test_helper::TestModel& testModel);
 
@@ -38,10 +72,8 @@
 void EvaluatePreparedModel(const sp<V1_2::IPreparedModel>& preparedModel,
                            const ::test_helper::TestModel& testModel, bool testDynamicOutputShape);
 
-void Execute(const sp<V1_2::IDevice>& device, const ::test_helper::TestModel& testModel,
-             bool testDynamicOutputShape = false);
-
-}  // namespace generated_tests
+}  // namespace functional
+}  // namespace vts
 }  // namespace V1_2
 }  // namespace neuralnetworks
 }  // namespace hardware