Merge "Drop broadcastradio HAL 1.2."
diff --git a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
index 37095d4..2a5ec8fe 100644
--- a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
+++ b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
@@ -81,7 +81,8 @@
TunerCallbackMock();
MOCK_METHOD2(onTuneFailed, Return<void>(Result, const ProgramSelector&));
- MOCK_TIMEOUT_METHOD1(onCurrentProgramInfoChanged, Return<void>(const ProgramInfo&));
+ MOCK_TIMEOUT_METHOD1(onCurrentProgramInfoChanged_, Return<void>(const ProgramInfo&));
+ virtual Return<void> onCurrentProgramInfoChanged(const ProgramInfo& info);
Return<void> onProgramListUpdated(const ProgramListChunk& chunk);
MOCK_METHOD1(onAntennaStateChange, Return<void>(bool connected));
MOCK_METHOD1(onParametersUpdated, Return<void>(const hidl_vec<VendorKeyValue>& parameters));
@@ -122,12 +123,40 @@
}
TunerCallbackMock::TunerCallbackMock() {
- EXPECT_TIMEOUT_CALL(*this, onCurrentProgramInfoChanged, _).Times(AnyNumber());
+ EXPECT_TIMEOUT_CALL(*this, onCurrentProgramInfoChanged_, _).Times(AnyNumber());
// we expect the antenna is connected through the whole test
EXPECT_CALL(*this, onAntennaStateChange(false)).Times(0);
}
+Return<void> TunerCallbackMock::onCurrentProgramInfoChanged(const ProgramInfo& info) {
+ auto logically = utils::getType(info.logicallyTunedTo);
+ if (logically != IdentifierType::INVALID) {
+ EXPECT_TRUE(logically == IdentifierType::AMFM_FREQUENCY ||
+ logically == IdentifierType::RDS_PI ||
+ logically == IdentifierType::HD_STATION_ID_EXT ||
+ logically == IdentifierType::DAB_SID_EXT ||
+ logically == IdentifierType::DRMO_SERVICE_ID ||
+ logically == IdentifierType::SXM_SERVICE_ID ||
+ (logically >= IdentifierType::VENDOR_START &&
+ logically <= IdentifierType::VENDOR_END) ||
+ logically > IdentifierType::SXM_CHANNEL);
+ }
+
+ auto physically = utils::getType(info.physicallyTunedTo);
+ if (physically != IdentifierType::INVALID) {
+ EXPECT_TRUE(physically == IdentifierType::AMFM_FREQUENCY ||
+ physically == IdentifierType::DAB_ENSEMBLE ||
+ physically == IdentifierType::DRMO_FREQUENCY ||
+ physically == IdentifierType::SXM_CHANNEL ||
+ (physically >= IdentifierType::VENDOR_START &&
+ physically <= IdentifierType::VENDOR_END) ||
+ physically > IdentifierType::SXM_CHANNEL);
+ }
+
+ return onCurrentProgramInfoChanged_(info);
+}
+
Return<void> TunerCallbackMock::onProgramListUpdated(const ProgramListChunk& chunk) {
std::lock_guard<std::mutex> lk(mLock);
@@ -385,7 +414,7 @@
// try tuning
ProgramInfo infoCb = {};
- EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged,
+ EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_,
InfoHasId(utils::make_identifier(IdentifierType::AMFM_FREQUENCY, freq)))
.Times(AnyNumber())
.WillOnce(DoAll(SaveArg<0>(&infoCb), testing::Return(ByMove(Void()))));
@@ -399,7 +428,7 @@
// expect a callback if it succeeds
EXPECT_EQ(Result::OK, result);
- EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged, timeout::tune);
+ EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
ALOGD("current program info: %s", toString(infoCb).c_str());
@@ -469,15 +498,15 @@
// TODO(b/69958777): see FmTune workaround
std::this_thread::sleep_for(100ms);
- EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged, _);
+ EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, _);
auto result = mSession->scan(true /* up */, true /* skip subchannel */);
EXPECT_EQ(Result::OK, result);
- EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged, timeout::tune);
+ EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
- EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged, _);
+ EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, _);
result = mSession->scan(false /* down */, false /* don't skip subchannel */);
EXPECT_EQ(Result::OK, result);
- EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged, timeout::tune);
+ EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
}
/**
@@ -494,19 +523,19 @@
// TODO(b/69958777): see FmTune workaround
std::this_thread::sleep_for(100ms);
- EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged, _).Times(AnyNumber());
+ EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, _).Times(AnyNumber());
auto result = mSession->step(true /* up */);
if (result == Result::NOT_SUPPORTED) {
printSkipped("step not supported");
return;
}
EXPECT_EQ(Result::OK, result);
- EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged, timeout::tune);
+ EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
- EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged, _);
+ EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChanged_, _);
result = mSession->step(false /* down */);
EXPECT_EQ(Result::OK, result);
- EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged, timeout::tune);
+ EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChanged_, timeout::tune);
}
/**
@@ -768,9 +797,6 @@
closeHandle->close();
}
-// TODO(b/70939328): test ProgramInfo's currentlyTunedId and
-// currentlyTunedChannel once the program list is implemented.
-
} // namespace vts
} // namespace V2_0
} // namespace broadcastradio
diff --git a/camera/device/3.4/ICameraDeviceSession.hal b/camera/device/3.4/ICameraDeviceSession.hal
index 7afcf94..c41d90e 100644
--- a/camera/device/3.4/ICameraDeviceSession.hal
+++ b/camera/device/3.4/ICameraDeviceSession.hal
@@ -31,43 +31,6 @@
interface ICameraDeviceSession extends @3.3::ICameraDeviceSession {
/**
- * constructDefaultRequestSettings_3_4:
- *
- * Create capture settings for standard camera use cases. Supports the
- * new template enums added in @3.4.
- *
- * The device must return a settings buffer that is configured to meet the
- * requested use case, which must be one of the CAMERA3_TEMPLATE_*
- * enums. All request control fields must be included.
- *
- * Performance requirements:
- *
- * This must be a non-blocking call. The HAL should return from this call
- * in 1ms, and must return from this call in 5ms.
- *
- * Return values:
- * @return status Status code for the operation, one of:
- * OK:
- * On a successful construction of default settings.
- * INTERNAL_ERROR:
- * An unexpected internal error occurred, and the default settings
- * are not available.
- * ILLEGAL_ARGUMENT:
- * The camera HAL does not support the input template type
- * CAMERA_DISCONNECTED:
- * An external camera device has been disconnected, and is no longer
- * available. This camera device interface is now stale, and a new
- * instance must be acquired if the device is reconnected. All
- * subsequent calls on this interface must return
- * CAMERA_DISCONNECTED.
- * @return requestTemplate The default capture request settings for the requested
- * use case, or an empty metadata structure if status is not OK.
- *
- */
- constructDefaultRequestSettings_3_4(RequestTemplate type) generates
- (Status status, @3.2::CameraMetadata requestTemplate);
-
- /**
* configureStreams_3_4:
*
* Identical to @3.3::ICameraDeviceSession.configureStreams, except that:
diff --git a/camera/device/3.4/default/CameraDeviceSession.cpp b/camera/device/3.4/default/CameraDeviceSession.cpp
index f6c6b2b..771197a 100644
--- a/camera/device/3.4/default/CameraDeviceSession.cpp
+++ b/camera/device/3.4/default/CameraDeviceSession.cpp
@@ -56,14 +56,6 @@
CameraDeviceSession::~CameraDeviceSession() {
}
-Return<void> CameraDeviceSession::constructDefaultRequestSettings_3_4(
- RequestTemplate type, ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb) {
- V3_2::CameraMetadata outMetadata;
- Status status = constructDefaultRequestSettingsRaw( (int) type, &outMetadata);
- _hidl_cb(status, outMetadata);
- return Void();
-}
-
Return<void> CameraDeviceSession::configureStreams_3_4(
const StreamConfiguration& requestedConfiguration,
ICameraDeviceSession::configureStreams_3_4_cb _hidl_cb) {
diff --git a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp
index 51bfe36..fb42605 100644
--- a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp
+++ b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp
@@ -133,15 +133,6 @@
return Void();
}
-Return<void> ExternalCameraDeviceSession::constructDefaultRequestSettings_3_4(
- RequestTemplate type,
- ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb) {
- V3_2::CameraMetadata outMetadata;
- Status status = constructDefaultRequestSettingsRaw(type, &outMetadata);
- _hidl_cb(status, outMetadata);
- return Void();
-}
-
Status ExternalCameraDeviceSession::constructDefaultRequestSettingsRaw(RequestTemplate type,
V3_2::CameraMetadata *outMetadata) {
CameraMetadata emptyMd;
@@ -160,9 +151,7 @@
}
case RequestTemplate::MANUAL:
case RequestTemplate::ZERO_SHUTTER_LAG:
- case RequestTemplate::MOTION_TRACKING_PREVIEW:
- case RequestTemplate::MOTION_TRACKING_BEST:
- // Don't support MANUAL, ZSL, MOTION_TRACKING_* templates
+ // Don't support MANUAL, ZSL templates
status = Status::ILLEGAL_ARGUMENT;
break;
default:
diff --git a/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h b/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h
index 9cd7da7..6e90ed4 100644
--- a/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h
+++ b/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h
@@ -74,11 +74,6 @@
protected:
// Methods from v3.3 and earlier will trampoline to inherited implementation
- // New methods for v3.4
- Return<void> constructDefaultRequestSettings_3_4(
- RequestTemplate type,
- ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb);
-
Return<void> configureStreams_3_4(
const StreamConfiguration& requestedConfiguration,
ICameraDeviceSession::configureStreams_3_4_cb _hidl_cb);
@@ -163,12 +158,6 @@
return mParent->close();
}
- virtual Return<void> constructDefaultRequestSettings_3_4(
- RequestTemplate type,
- ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb) override {
- return mParent->constructDefaultRequestSettings_3_4(type, _hidl_cb);
- }
-
virtual Return<void> configureStreams_3_3(
const V3_2::StreamConfiguration& requestedConfiguration,
configureStreams_3_3_cb _hidl_cb) override {
diff --git a/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h b/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h
index fabf26a..b6a2397 100644
--- a/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h
+++ b/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h
@@ -53,7 +53,7 @@
using ::android::hardware::camera::device::V3_2::ICameraDeviceCallback;
using ::android::hardware::camera::device::V3_2::MsgType;
using ::android::hardware::camera::device::V3_2::NotifyMsg;
-using ::android::hardware::camera::device::V3_4::RequestTemplate;
+using ::android::hardware::camera::device::V3_2::RequestTemplate;
using ::android::hardware::camera::device::V3_2::Stream;
using ::android::hardware::camera::device::V3_4::StreamConfiguration;
using ::android::hardware::camera::device::V3_2::StreamConfigurationMode;
@@ -110,11 +110,7 @@
// Methods from ::android::hardware::camera::device::V3_2::ICameraDeviceSession follow
Return<void> constructDefaultRequestSettings(
- V3_2::RequestTemplate,
- ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb);
-
- Return<void> constructDefaultRequestSettings_3_4(
- RequestTemplate type,
+ RequestTemplate,
ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb);
Return<void> configureStreams(
@@ -341,7 +337,7 @@
mParent(parent) {}
virtual Return<void> constructDefaultRequestSettings(
- V3_2::RequestTemplate type,
+ RequestTemplate type,
V3_3::ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb) override {
return mParent->constructDefaultRequestSettings(type, _hidl_cb);
}
@@ -376,12 +372,6 @@
return mParent->close();
}
- virtual Return<void> constructDefaultRequestSettings_3_4(
- RequestTemplate type,
- ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb) override {
- return mParent->constructDefaultRequestSettings_3_4(type, _hidl_cb);
- }
-
virtual Return<void> configureStreams_3_3(
const V3_2::StreamConfiguration& requestedConfiguration,
configureStreams_3_3_cb _hidl_cb) override {
diff --git a/camera/device/3.4/types.hal b/camera/device/3.4/types.hal
index c8ebb17..5681a5c 100644
--- a/camera/device/3.4/types.hal
+++ b/camera/device/3.4/types.hal
@@ -78,36 +78,6 @@
};
/**
- * New request templates, extending the @3.2 RequestTemplate
- */
-enum RequestTemplate : @3.2::RequestTemplate {
- /**
- * A template for selecting camera parameters that match TEMPLATE_PREVIEW as closely as
- * possible while improving the camera output for motion tracking use cases.
- *
- * This template is best used by applications that are frequently switching between motion
- * tracking use cases and regular still capture use cases, to minimize the IQ changes
- * when swapping use cases.
- *
- * This template is guaranteed to be supported on camera devices that support the
- * REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING capability.
- */
- MOTION_TRACKING_PREVIEW = 7,
-
- /**
- * A template for selecting camera parameters that maximize the quality of camera output for
- * motion tracking use cases.
- *
- * This template is best used by applications dedicated to motion tracking applications,
- * which aren't concerned about fast switches between motion tracking and other use cases.
- *
- * This template is guaranteed to be supported on camera devices that support the
- * REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING capability.
- */
- MOTION_TRACKING_BEST = 8,
-};
-
-/**
* StreamConfiguration:
*
* Identical to @3.2::StreamConfiguration, except that it contains session
diff --git a/camera/metadata/3.3/types.hal b/camera/metadata/3.3/types.hal
index d2a5886..b70802a 100644
--- a/camera/metadata/3.3/types.hal
+++ b/camera/metadata/3.3/types.hal
@@ -94,7 +94,7 @@
/** android.statistics.oisDataMode [dynamic, enum, public]
*
- * <p>Whether the camera device outputs the OIS data in output
+ * <p>A control for selecting whether OIS position information is included in output
* result metadata.</p>
*/
ANDROID_STATISTICS_OIS_DATA_MODE = android.hardware.camera.metadata@3.2::CameraMetadataTag:ANDROID_STATISTICS_END,
@@ -200,12 +200,12 @@
ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA,
};
-/** android.logicalMultiCamera.sensorSyncType enumeration values
- * @see ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE
+/** android.statistics.oisDataMode enumeration values
+ * @see ANDROID_STATISTICS_OIS_DATA_MODE
*/
-enum CameraMetadataEnumAndroidLogicalMultiCameraSensorSyncType : uint32_t {
- ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE,
- ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED,
+enum CameraMetadataEnumAndroidStatisticsOisDataMode : uint32_t {
+ ANDROID_STATISTICS_OIS_DATA_MODE_OFF,
+ ANDROID_STATISTICS_OIS_DATA_MODE_ON,
};
/** android.info.supportedHardwareLevel enumeration values added since v3.2
@@ -216,10 +216,10 @@
ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL,
};
-/** android.statistics.oisDataMode enumeration values
- * @see ANDROID_STATISTICS_OIS_DATA_MODE
+/** android.logicalMultiCamera.sensorSyncType enumeration values
+ * @see ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE
*/
-enum CameraMetadataEnumAndroidStatisticsOisDataMode : uint32_t {
- ANDROID_STATISTICS_OIS_DATA_MODE_OFF,
- ANDROID_STATISTICS_OIS_DATA_MODE_ON,
+enum CameraMetadataEnumAndroidLogicalMultiCameraSensorSyncType : uint32_t {
+ ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE,
+ ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED,
};
diff --git a/configstore/1.0/vts/functional/VtsHalConfigstoreV1_0TargetTest.cpp b/configstore/1.0/vts/functional/VtsHalConfigstoreV1_0TargetTest.cpp
index e501580..a1676be 100644
--- a/configstore/1.0/vts/functional/VtsHalConfigstoreV1_0TargetTest.cpp
+++ b/configstore/1.0/vts/functional/VtsHalConfigstoreV1_0TargetTest.cpp
@@ -17,6 +17,7 @@
#define LOG_TAG "ConfigstoreHidlHalTest"
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <android-base/logging.h>
#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
#include <android/hardware/configstore/1.0/types.h>
@@ -34,13 +35,25 @@
#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
#define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk())
+// Test environment for Configstore HIDL HAL.
+class ConfigstoreHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static ConfigstoreHidlEnvironment* Instance() {
+ static ConfigstoreHidlEnvironment* instance = new ConfigstoreHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<ISurfaceFlingerConfigs>(); }
+};
+
class ConfigstoreHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
sp<ISurfaceFlingerConfigs> sfConfigs;
virtual void SetUp() override {
- sfConfigs = ::testing::VtsHalHidlTargetTestBase::getService<
- ISurfaceFlingerConfigs>();
+ sfConfigs = ::testing::VtsHalHidlTargetTestBase::getService<ISurfaceFlingerConfigs>(
+ ConfigstoreHidlEnvironment::Instance()->getServiceName<ISurfaceFlingerConfigs>());
ASSERT_NE(sfConfigs, nullptr);
}
@@ -119,7 +132,9 @@
}
int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(ConfigstoreHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ ConfigstoreHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
return status;
diff --git a/gatekeeper/1.0/vts/functional/VtsHalGatekeeperV1_0TargetTest.cpp b/gatekeeper/1.0/vts/functional/VtsHalGatekeeperV1_0TargetTest.cpp
index e9a44eb..715e9fc 100644
--- a/gatekeeper/1.0/vts/functional/VtsHalGatekeeperV1_0TargetTest.cpp
+++ b/gatekeeper/1.0/vts/functional/VtsHalGatekeeperV1_0TargetTest.cpp
@@ -33,6 +33,7 @@
#include <log/log.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
@@ -77,6 +78,20 @@
return auth_token;
}
+// Test environment for Gatekeeper HIDL HAL.
+class GatekeeperHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static GatekeeperHidlEnvironment* Instance() {
+ static GatekeeperHidlEnvironment* instance = new GatekeeperHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IGatekeeper>(); }
+ private:
+ GatekeeperHidlEnvironment() {}
+};
+
// The main test class for Gatekeeper HIDL HAL.
class GatekeeperHidlTest : public ::testing::VtsHalHidlTargetTestBase {
protected:
@@ -189,7 +204,8 @@
GatekeeperHidlTest() : uid_(0) {}
virtual void SetUp() override {
GatekeeperResponse rsp;
- gatekeeper_ = ::testing::VtsHalHidlTargetTestBase::getService<IGatekeeper>();
+ gatekeeper_ = ::testing::VtsHalHidlTargetTestBase::getService<IGatekeeper>(
+ GatekeeperHidlEnvironment::Instance()->getServiceName<IGatekeeper>());
ASSERT_NE(nullptr, gatekeeper_.get());
doDeleteAllUsers(rsp);
}
@@ -433,7 +449,9 @@
}
int main(int argc, char **argv) {
+ ::testing::AddGlobalTestEnvironment(GatekeeperHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ GatekeeperHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
ALOGI("Test result = %d", status);
return status;
diff --git a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp
index b3ab594..010a46d 100644
--- a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp
+++ b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp
@@ -19,6 +19,7 @@
#include <log/log.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <chrono>
#include <condition_variable>
@@ -41,6 +42,21 @@
bool sAgpsIsPresent = false; // if SUPL or XTRA assistance available
bool sSignalIsWeak = false; // if GNSS signals are weak (e.g. light indoor)
+// Test environment for GNSS HIDL HAL.
+class GnssHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static GnssHidlEnvironment* Instance() {
+ static GnssHidlEnvironment* instance = new GnssHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IGnss>(); }
+
+ private:
+ GnssHidlEnvironment() {}
+};
+
// The main test class for GNSS HAL.
class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
public:
@@ -51,7 +67,8 @@
info_called_count_ = 0;
notify_count_ = 0;
- gnss_hal_ = ::testing::VtsHalHidlTargetTestBase::getService<IGnss>();
+ gnss_hal_ = ::testing::VtsHalHidlTargetTestBase::getService<IGnss>(
+ GnssHidlEnvironment::Instance()->getServiceName<IGnss>());
ASSERT_NE(gnss_hal_, nullptr);
gnss_cb_ = new GnssCallback(*this);
@@ -456,17 +473,19 @@
}
int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(GnssHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ GnssHidlEnvironment::Instance()->init(&argc, argv);
/*
* These arguments not used by automated VTS testing.
* Only for use in manual testing, when wanting to run
* stronger tests that require the presence of GPS signal.
*/
for (int i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-agps") == 0) {
- sAgpsIsPresent = true;
- } else if (strcmp(argv[i], "-weak") == 0) {
- sSignalIsWeak = true;
+ if (strcmp(argv[i], "-agps") == 0) {
+ sAgpsIsPresent = true;
+ } else if (strcmp(argv[i], "-weak") == 0) {
+ sSignalIsWeak = true;
}
}
int status = RUN_ALL_TESTS();
diff --git a/gnss/1.1/vts/functional/VtsHalGnssV1_1TargetTest.cpp b/gnss/1.1/vts/functional/VtsHalGnssV1_1TargetTest.cpp
index 9b805e4..ca9eef4 100644
--- a/gnss/1.1/vts/functional/VtsHalGnssV1_1TargetTest.cpp
+++ b/gnss/1.1/vts/functional/VtsHalGnssV1_1TargetTest.cpp
@@ -13,12 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#define LOG_TAG "VtsHalGnssV1_1TargetTest"
#include <VtsHalHidlTargetTestBase.h>
+#include "gnss_hal_test.h"
+
int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(GnssHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ GnssHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
ALOGI("Test result = %d", status);
return status;
-}
\ No newline at end of file
+}
diff --git a/gnss/1.1/vts/functional/gnss_hal_test.cpp b/gnss/1.1/vts/functional/gnss_hal_test.cpp
index 7e43b92..23b7317 100644
--- a/gnss/1.1/vts/functional/gnss_hal_test.cpp
+++ b/gnss/1.1/vts/functional/gnss_hal_test.cpp
@@ -27,7 +27,8 @@
notify_count_(0) {}
void GnssHalTest::SetUp() {
- gnss_hal_ = ::testing::VtsHalHidlTargetTestBase::getService<IGnss>();
+ gnss_hal_ = ::testing::VtsHalHidlTargetTestBase::getService<IGnss>(
+ GnssHidlEnvironment::Instance()->getServiceName<IGnss>());
list_gnss_sv_status_.clear();
ASSERT_NE(gnss_hal_, nullptr);
}
diff --git a/gnss/1.1/vts/functional/gnss_hal_test.h b/gnss/1.1/vts/functional/gnss_hal_test.h
index 6aab3cb..6d5bb4c 100644
--- a/gnss/1.1/vts/functional/gnss_hal_test.h
+++ b/gnss/1.1/vts/functional/gnss_hal_test.h
@@ -17,11 +17,10 @@
#ifndef GNSS_HAL_TEST_H_
#define GNSS_HAL_TEST_H_
-#define LOG_TAG "VtsHalGnssV1_1TargetTest"
-
#include <android/hardware/gnss/1.1/IGnss.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <condition_variable>
#include <list>
@@ -40,6 +39,21 @@
#define TIMEOUT_SEC 2 // for basic commands/responses
+// Test environment for GNSS HIDL HAL.
+class GnssHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static GnssHidlEnvironment* Instance() {
+ static GnssHidlEnvironment* instance = new GnssHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IGnss>(); }
+
+ private:
+ GnssHidlEnvironment() {}
+};
+
// The main test class for GNSS HAL.
class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
public:
diff --git a/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp b/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
index a017404..5fd2dd4 100644
--- a/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
+++ b/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
@@ -22,6 +22,7 @@
#include <android/hardware/ir/1.0/types.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <algorithm>
using ::android::hardware::ir::V1_0::IConsumerIr;
@@ -30,11 +31,26 @@
using ::android::hardware::Return;
using ::android::sp;
+// Test environment for Ir
+class ConsumerIrHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static ConsumerIrHidlEnvironment* Instance() {
+ static ConsumerIrHidlEnvironment* instance = new ConsumerIrHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IConsumerIr>(); }
+ private:
+ ConsumerIrHidlEnvironment() {}
+};
+
// The main test class for IR HIDL HAL.
class ConsumerIrHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
- ir = ::testing::VtsHalHidlTargetTestBase::getService<IConsumerIr>();
+ ir = ::testing::VtsHalHidlTargetTestBase::getService<IConsumerIr>(
+ ConsumerIrHidlEnvironment::Instance()->getServiceName<IConsumerIr>());
ASSERT_NE(ir, nullptr);
}
@@ -77,7 +93,9 @@
}
int main(int argc, char **argv) {
+ ::testing::AddGlobalTestEnvironment(ConsumerIrHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ ConsumerIrHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
return status;
diff --git a/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp
index 6abd9bf..3a181a9 100644
--- a/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp
+++ b/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp
@@ -33,19 +33,14 @@
#include "key_param_output.h"
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include "attestation_record.h"
#include "openssl_utils.h"
using ::android::sp;
-
using ::std::string;
-// This service_name will be passed to getService when retrieving the keymaster service to test. To
-// change it from "default" specify the selected service name on the command line. The first
-// non-gtest argument will be used as the service name.
-string service_name = "default";
-
static bool arm_deleteAllKeys = false;
static bool dump_Attestations = false;
@@ -417,6 +412,20 @@
} // namespace
+// Test environment for Keymaster HIDL HAL.
+class KeymasterHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static KeymasterHidlEnvironment* Instance() {
+ static KeymasterHidlEnvironment* instance = new KeymasterHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IKeymasterDevice>(); }
+ private:
+ KeymasterHidlEnvironment() {}
+};
+
class KeymasterHidlTest : public ::testing::VtsHalHidlTargetTestBase {
public:
void TearDown() override {
@@ -428,7 +437,8 @@
// SetUpTestCase runs only once per test case, not once per test.
static void SetUpTestCase() {
- keymaster_ = IKeymasterDevice::getService(service_name);
+ keymaster_ = ::testing::VtsHalHidlTargetTestBase::getService<IKeymasterDevice>(
+ KeymasterHidlEnvironment::Instance()->getServiceName<IKeymasterDevice>());
ASSERT_NE(keymaster_, nullptr);
ASSERT_TRUE(
@@ -4203,8 +4213,10 @@
} // namespace android
int main(int argc, char** argv) {
+ using android::hardware::keymaster::V3_0::test::KeymasterHidlEnvironment;
+ ::testing::AddGlobalTestEnvironment(KeymasterHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
- std::vector<std::string> positional_args;
+ KeymasterHidlEnvironment::Instance()->init(&argc, argv);
for (int i = 1; i < argc; ++i) {
if (argv[i][0] == '-') {
if (std::string(argv[i]) == "--arm_deleteAllKeys") {
@@ -4213,14 +4225,8 @@
if (std::string(argv[i]) == "--dump_attestations") {
dump_Attestations = true;
}
- } else {
- positional_args.push_back(argv[i]);
}
}
- if (positional_args.size()) {
- ALOGI("Running keymaster VTS against service \"%s\"", positional_args[0].c_str());
- service_name = positional_args[0];
- }
int status = RUN_ALL_TESTS();
ALOGI("Test result = %d", status);
return status;
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
index 38cdcd6..42f9947 100644
--- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioDecTest.cpp
@@ -50,85 +50,6 @@
#include <media_hidl_test_common.h>
#include <fstream>
-// A class for test environment setup
-class ComponentTestEnvironment : public ::testing::Environment {
- public:
- virtual void SetUp() {}
- virtual void TearDown() {}
-
- ComponentTestEnvironment() : instance("default"), res("/sdcard/media/") {}
-
- void setInstance(const char* _instance) { instance = _instance; }
-
- void setComponent(const char* _component) { component = _component; }
-
- void setRole(const char* _role) { role = _role; }
-
- void setRes(const char* _res) { res = _res; }
-
- const hidl_string getInstance() const { return instance; }
-
- const hidl_string getComponent() const { return component; }
-
- const hidl_string getRole() const { return role; }
-
- const hidl_string getRes() const { return res; }
-
- int initFromOptions(int argc, char** argv) {
- static struct option options[] = {
- {"instance", required_argument, 0, 'I'},
- {"component", required_argument, 0, 'C'},
- {"role", required_argument, 0, 'R'},
- {"res", required_argument, 0, 'P'},
- {0, 0, 0, 0}};
-
- while (true) {
- int index = 0;
- int c = getopt_long(argc, argv, "I:C:R:P:", options, &index);
- if (c == -1) {
- break;
- }
-
- switch (c) {
- case 'I':
- setInstance(optarg);
- break;
- case 'C':
- setComponent(optarg);
- break;
- case 'R':
- setRole(optarg);
- break;
- case 'P':
- setRes(optarg);
- break;
- case '?':
- break;
- }
- }
-
- if (optind < argc) {
- fprintf(stderr,
- "unrecognized option: %s\n\n"
- "usage: %s <gtest options> <test options>\n\n"
- "test options are:\n\n"
- "-I, --instance: HAL instance to test\n"
- "-C, --component: OMX component to test\n"
- "-R, --role: OMX component Role\n"
- "-P, --res: Resource files directory location\n",
- argv[optind ?: 1], argv[0]);
- return 2;
- }
- return 0;
- }
-
- private:
- hidl_string instance;
- hidl_string component;
- hidl_string role;
- hidl_string res;
-};
-
static ComponentTestEnvironment* gEnv = nullptr;
// audio decoder test fixture class
@@ -1220,6 +1141,7 @@
gEnv = new ComponentTestEnvironment();
::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
+ gEnv->init(&argc, argv);
int status = gEnv->initFromOptions(argc, argv);
if (status == 0) {
status = RUN_ALL_TESTS();
diff --git a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
index 953dc75..d5f1f2d 100644
--- a/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
+++ b/media/omx/1.0/vts/functional/audio/VtsHalMediaOmxV1_0TargetAudioEncTest.cpp
@@ -50,85 +50,6 @@
#include <media_hidl_test_common.h>
#include <fstream>
-// A class for test environment setup
-class ComponentTestEnvironment : public ::testing::Environment {
- public:
- virtual void SetUp() {}
- virtual void TearDown() {}
-
- ComponentTestEnvironment() : instance("default"), res("/sdcard/media/") {}
-
- void setInstance(const char* _instance) { instance = _instance; }
-
- void setComponent(const char* _component) { component = _component; }
-
- void setRole(const char* _role) { role = _role; }
-
- void setRes(const char* _res) { res = _res; }
-
- const hidl_string getInstance() const { return instance; }
-
- const hidl_string getComponent() const { return component; }
-
- const hidl_string getRole() const { return role; }
-
- const hidl_string getRes() const { return res; }
-
- int initFromOptions(int argc, char** argv) {
- static struct option options[] = {
- {"instance", required_argument, 0, 'I'},
- {"component", required_argument, 0, 'C'},
- {"role", required_argument, 0, 'R'},
- {"res", required_argument, 0, 'P'},
- {0, 0, 0, 0}};
-
- while (true) {
- int index = 0;
- int c = getopt_long(argc, argv, "I:C:R:P:", options, &index);
- if (c == -1) {
- break;
- }
-
- switch (c) {
- case 'I':
- setInstance(optarg);
- break;
- case 'C':
- setComponent(optarg);
- break;
- case 'R':
- setRole(optarg);
- break;
- case 'P':
- setRes(optarg);
- break;
- case '?':
- break;
- }
- }
-
- if (optind < argc) {
- fprintf(stderr,
- "unrecognized option: %s\n\n"
- "usage: %s <gtest options> <test options>\n\n"
- "test options are:\n\n"
- "-I, --instance: HAL instance to test\n"
- "-C, --component: OMX component to test\n"
- "-R, --role: OMX component Role\n"
- "-P, --res: Resource files directory location\n",
- argv[optind ?: 1], argv[0]);
- return 2;
- }
- return 0;
- }
-
- private:
- hidl_string instance;
- hidl_string component;
- hidl_string role;
- hidl_string res;
-};
-
static ComponentTestEnvironment* gEnv = nullptr;
// audio encoder test fixture class
@@ -562,6 +483,7 @@
gEnv = new ComponentTestEnvironment();
::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
+ gEnv->init(&argc, argv);
int status = gEnv->initFromOptions(argc, argv);
if (status == 0) {
status = RUN_ALL_TESTS();
diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
index bec733d..c1863d5 100644
--- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
+++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.h
@@ -21,6 +21,7 @@
#define OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS
#endif
+#include <getopt.h>
#include <media/stagefright/foundation/ALooper.h>
#include <utils/Condition.h>
#include <utils/List.h>
@@ -33,6 +34,8 @@
#include <media/openmax/OMX_AudioExt.h>
#include <media/openmax/OMX_VideoExt.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
+
/* TIME OUTS (Wait time in dequeueMessage()) */
/* As component is switching states (loaded<->idle<->execute), dequeueMessage()
@@ -355,4 +358,77 @@
portreconfig fptr = nullptr, OMX_U32 kPortIndexInput = 0,
OMX_U32 kPortIndexOutput = 1, void* args = nullptr);
+// A class for test environment setup
+class ComponentTestEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ private:
+ typedef ::testing::VtsHalHidlTargetTestEnvBase Super;
+
+ public:
+ virtual void registerTestServices() override { registerTestService<IOmx>(); }
+
+ ComponentTestEnvironment() : res("/sdcard/media/") {}
+
+ void setComponent(const char* _component) { component = _component; }
+
+ void setRole(const char* _role) { role = _role; }
+
+ void setRes(const char* _res) { res = _res; }
+
+ const hidl_string getInstance() { return Super::getServiceName<IOmx>(); }
+
+ const hidl_string getComponent() const { return component; }
+
+ const hidl_string getRole() const { return role; }
+
+ const hidl_string getRes() const { return res; }
+
+ int initFromOptions(int argc, char** argv) {
+ static struct option options[] = {{"component", required_argument, 0, 'C'},
+ {"role", required_argument, 0, 'R'},
+ {"res", required_argument, 0, 'P'},
+ {0, 0, 0, 0}};
+
+ while (true) {
+ int index = 0;
+ int c = getopt_long(argc, argv, "C:R:P:", options, &index);
+ if (c == -1) {
+ break;
+ }
+
+ switch (c) {
+ case 'C':
+ setComponent(optarg);
+ break;
+ case 'R':
+ setRole(optarg);
+ break;
+ case 'P':
+ setRes(optarg);
+ break;
+ case '?':
+ break;
+ }
+ }
+
+ if (optind < argc) {
+ fprintf(stderr,
+ "unrecognized option: %s\n\n"
+ "usage: %s <gtest options> <test options>\n\n"
+ "test options are:\n\n"
+ "-C, --component: OMX component to test\n"
+ "-R, --role: OMX component Role\n"
+ "-P, --res: Resource files directory location\n",
+ argv[optind ?: 1], argv[0]);
+ return 2;
+ }
+ return 0;
+ }
+
+ private:
+ hidl_string instance;
+ hidl_string component;
+ hidl_string role;
+ hidl_string res;
+};
+
#endif // MEDIA_HIDL_TEST_COMMON_H
diff --git a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
index d66136d..f7c8433 100644
--- a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
+++ b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
@@ -48,75 +48,6 @@
#include <getopt.h>
#include <media_hidl_test_common.h>
-// A class for test environment setup
-class ComponentTestEnvironment : public ::testing::Environment {
- public:
- virtual void SetUp() {}
- virtual void TearDown() {}
-
- ComponentTestEnvironment() : instance("default") {}
-
- void setInstance(const char* _instance) { instance = _instance; }
-
- void setComponent(const char* _component) { component = _component; }
-
- void setRole(const char* _role) { role = _role; }
-
- const hidl_string getInstance() const { return instance; }
-
- const hidl_string getComponent() const { return component; }
-
- const hidl_string getRole() const { return role; }
-
- int initFromOptions(int argc, char** argv) {
- static struct option options[] = {
- {"instance", required_argument, 0, 'I'},
- {"component", required_argument, 0, 'C'},
- {"role", required_argument, 0, 'R'},
- {0, 0, 0, 0}};
-
- while (true) {
- int index = 0;
- int c = getopt_long(argc, argv, "I:C:R:", options, &index);
- if (c == -1) {
- break;
- }
-
- switch (c) {
- case 'I':
- setInstance(optarg);
- break;
- case 'C':
- setComponent(optarg);
- break;
- case 'R':
- setRole(optarg);
- break;
- case '?':
- break;
- }
- }
-
- if (optind < argc) {
- fprintf(stderr,
- "unrecognized option: %s\n\n"
- "usage: %s <gtest options> <test options>\n\n"
- "test options are:\n\n"
- "-I, --instance: HAL instance to test\n"
- "-C, --component: OMX component to test\n"
- "-R, --Role: OMX component Role\n",
- argv[optind ?: 1], argv[0]);
- return 2;
- }
- return 0;
- }
-
- private:
- hidl_string instance;
- hidl_string component;
- hidl_string role;
-};
-
static ComponentTestEnvironment* gEnv = nullptr;
// generic component test fixture class
@@ -1321,6 +1252,7 @@
gEnv = new ComponentTestEnvironment();
::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
+ gEnv->init(&argc, argv);
int status = gEnv->initFromOptions(argc, argv);
if (status == 0) {
status = RUN_ALL_TESTS();
diff --git a/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp b/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
index 5a31d69..64abe1c 100644
--- a/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
+++ b/media/omx/1.0/vts/functional/master/VtsHalMediaOmxV1_0TargetMasterTest.cpp
@@ -50,54 +50,6 @@
#include <getopt.h>
#include <media_hidl_test_common.h>
-// A class for test environment setup
-class ComponentTestEnvironment : public ::testing::Environment {
- public:
- virtual void SetUp() {}
- virtual void TearDown() {}
-
- ComponentTestEnvironment() : instance("default") {}
-
- void setInstance(const char* _instance) { instance = _instance; }
-
- const hidl_string getInstance() const { return instance; }
-
- int initFromOptions(int argc, char** argv) {
- static struct option options[] = {
- {"instance", required_argument, 0, 'I'}, {0, 0, 0, 0}};
-
- while (true) {
- int index = 0;
- int c = getopt_long(argc, argv, "I:", options, &index);
- if (c == -1) {
- break;
- }
-
- switch (c) {
- case 'I':
- setInstance(optarg);
- break;
- case '?':
- break;
- }
- }
-
- if (optind < argc) {
- fprintf(stderr,
- "unrecognized option: %s\n\n"
- "usage: %s <gtest options> <test options>\n\n"
- "test options are:\n\n"
- "-I, --instance: HAL instance to test\n",
- argv[optind ?: 1], argv[0]);
- return 2;
- }
- return 0;
- }
-
- private:
- hidl_string instance;
-};
-
static ComponentTestEnvironment* gEnv = nullptr;
class MasterHidlTest : public ::testing::VtsHalHidlTargetTestBase {
@@ -226,6 +178,7 @@
gEnv = new ComponentTestEnvironment();
::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
+ gEnv->init(&argc, argv);
int status = gEnv->initFromOptions(argc, argv);
if (status == 0) {
status = RUN_ALL_TESTS();
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
index 034992e..40e76c9 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp
@@ -51,85 +51,6 @@
#include <media_video_hidl_test_common.h>
#include <fstream>
-// A class for test environment setup
-class ComponentTestEnvironment : public ::testing::Environment {
- public:
- virtual void SetUp() {}
- virtual void TearDown() {}
-
- ComponentTestEnvironment() : instance("default"), res("/sdcard/media/") {}
-
- void setInstance(const char* _instance) { instance = _instance; }
-
- void setComponent(const char* _component) { component = _component; }
-
- void setRole(const char* _role) { role = _role; }
-
- void setRes(const char* _res) { res = _res; }
-
- const hidl_string getInstance() const { return instance; }
-
- const hidl_string getComponent() const { return component; }
-
- const hidl_string getRole() const { return role; }
-
- const hidl_string getRes() const { return res; }
-
- int initFromOptions(int argc, char** argv) {
- static struct option options[] = {
- {"instance", required_argument, 0, 'I'},
- {"component", required_argument, 0, 'C'},
- {"role", required_argument, 0, 'R'},
- {"res", required_argument, 0, 'P'},
- {0, 0, 0, 0}};
-
- while (true) {
- int index = 0;
- int c = getopt_long(argc, argv, "I:C:R:P:", options, &index);
- if (c == -1) {
- break;
- }
-
- switch (c) {
- case 'I':
- setInstance(optarg);
- break;
- case 'C':
- setComponent(optarg);
- break;
- case 'R':
- setRole(optarg);
- break;
- case 'P':
- setRes(optarg);
- break;
- case '?':
- break;
- }
- }
-
- if (optind < argc) {
- fprintf(stderr,
- "unrecognized option: %s\n\n"
- "usage: %s <gtest options> <test options>\n\n"
- "test options are:\n\n"
- "-I, --instance: HAL instance to test\n"
- "-C, --component: OMX component to test\n"
- "-R, --role: OMX component Role\n"
- "-P, --res: Resource files directory location\n",
- argv[optind ?: 1], argv[0]);
- return 2;
- }
- return 0;
- }
-
- private:
- hidl_string instance;
- hidl_string component;
- hidl_string role;
- hidl_string res;
-};
-
static ComponentTestEnvironment* gEnv = nullptr;
// video decoder test fixture class
@@ -1488,6 +1409,7 @@
gEnv = new ComponentTestEnvironment();
::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
+ gEnv->init(&argc, argv);
int status = gEnv->initFromOptions(argc, argv);
if (status == 0) {
status = RUN_ALL_TESTS();
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
index 099658f..2056d9e 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
@@ -64,85 +64,6 @@
#include <system/window.h>
#include <fstream>
-// A class for test environment setup
-class ComponentTestEnvironment : public ::testing::Environment {
- public:
- virtual void SetUp() {}
- virtual void TearDown() {}
-
- ComponentTestEnvironment() : instance("default"), res("/sdcard/media/") {}
-
- void setInstance(const char* _instance) { instance = _instance; }
-
- void setComponent(const char* _component) { component = _component; }
-
- void setRole(const char* _role) { role = _role; }
-
- void setRes(const char* _res) { res = _res; }
-
- const hidl_string getInstance() const { return instance; }
-
- const hidl_string getComponent() const { return component; }
-
- const hidl_string getRole() const { return role; }
-
- const hidl_string getRes() const { return res; }
-
- int initFromOptions(int argc, char** argv) {
- static struct option options[] = {
- {"instance", required_argument, 0, 'I'},
- {"component", required_argument, 0, 'C'},
- {"role", required_argument, 0, 'R'},
- {"res", required_argument, 0, 'P'},
- {0, 0, 0, 0}};
-
- while (true) {
- int index = 0;
- int c = getopt_long(argc, argv, "I:C:R:P:", options, &index);
- if (c == -1) {
- break;
- }
-
- switch (c) {
- case 'I':
- setInstance(optarg);
- break;
- case 'C':
- setComponent(optarg);
- break;
- case 'R':
- setRole(optarg);
- break;
- case 'P':
- setRes(optarg);
- break;
- case '?':
- break;
- }
- }
-
- if (optind < argc) {
- fprintf(stderr,
- "unrecognized option: %s\n\n"
- "usage: %s <gtest options> <test options>\n\n"
- "test options are:\n\n"
- "-I, --instance: HAL instance to test\n"
- "-C, --component: OMX component to test\n"
- "-R, --role: OMX component Role\n"
- "-P, --res: Resource files directory location\n",
- argv[optind ?: 1], argv[0]);
- return 2;
- }
- return 0;
- }
-
- private:
- hidl_string instance;
- hidl_string component;
- hidl_string role;
- hidl_string res;
-};
-
static ComponentTestEnvironment* gEnv = nullptr;
// video encoder test fixture class
@@ -1580,6 +1501,7 @@
gEnv = new ComponentTestEnvironment();
::testing::AddGlobalTestEnvironment(gEnv);
::testing::InitGoogleTest(&argc, argv);
+ gEnv->init(&argc, argv);
int status = gEnv->initFromOptions(argc, argv);
if (status == 0) {
status = RUN_ALL_TESTS();
diff --git a/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp b/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
index a3eb54c..d53c062 100644
--- a/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
+++ b/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
@@ -17,7 +17,9 @@
#include <radio_hidl_hal_utils_v1_0.h>
int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(RadioHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ RadioHidlEnvironment::Instance()->init(&argc, argv);
// setup seed for rand function
int seedSrand = time(NULL);
@@ -28,4 +30,4 @@
LOG(INFO) << "Test result = " << status;
return status;
-}
\ No newline at end of file
+}
diff --git a/radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp b/radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp
index 84b67c9..859e6fb 100644
--- a/radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp
+++ b/radio/1.0/vts/functional/VtsHalSapV1_0TargetTest.cpp
@@ -17,7 +17,9 @@
#include <sap_hidl_hal_utils.h>
int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(SapHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
+ SapHidlEnvironment::Instance()->init(&argc, argv);
// setup seed for rand function
int seedSrand = time(NULL);
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
index 1c7653b..d9c00ce 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
@@ -17,12 +17,13 @@
#include <radio_hidl_hal_utils_v1_0.h>
void RadioHidlTest::SetUp() {
- radio =
- ::testing::VtsHalHidlTargetTestBase::getService<IRadio>(hidl_string(RADIO_SERVICE_NAME));
+ radio = ::testing::VtsHalHidlTargetTestBase::getService<IRadio>(
+ RadioHidlEnvironment::Instance()->getServiceName<IRadio>(hidl_string(RADIO_SERVICE_NAME)));
if (radio == NULL) {
sleep(60);
radio = ::testing::VtsHalHidlTargetTestBase::getService<IRadio>(
- hidl_string(RADIO_SERVICE_NAME));
+ RadioHidlEnvironment::Instance()->getServiceName<IRadio>(
+ hidl_string(RADIO_SERVICE_NAME)));
}
ASSERT_NE(nullptr, radio.get());
@@ -67,4 +68,4 @@
}
count--;
return status;
-}
\ No newline at end of file
+}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
index 6b95ab0..15ac0b8 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
+++ b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
@@ -17,6 +17,7 @@
#include <android-base/logging.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <chrono>
#include <condition_variable>
#include <mutex>
@@ -511,6 +512,20 @@
const ::android::hardware::hidl_string& reason);
};
+// Test environment for Radio HIDL HAL.
+class RadioHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static RadioHidlEnvironment* Instance() {
+ static RadioHidlEnvironment* instance = new RadioHidlEnvironment;
+ return instance;
+ }
+ virtual void registerTestServices() override { registerTestService<IRadio>(); }
+
+ private:
+ RadioHidlEnvironment() {}
+};
+
// The main test class for Radio HIDL.
class RadioHidlTest : public ::testing::VtsHalHidlTargetTestBase {
protected:
diff --git a/radio/1.0/vts/functional/sap_hidl_hal_test.cpp b/radio/1.0/vts/functional/sap_hidl_hal_test.cpp
index fc8cb2a..79668bb 100644
--- a/radio/1.0/vts/functional/sap_hidl_hal_test.cpp
+++ b/radio/1.0/vts/functional/sap_hidl_hal_test.cpp
@@ -17,7 +17,8 @@
#include <sap_hidl_hal_utils.h>
void SapHidlTest::SetUp() {
- sap = ::testing::VtsHalHidlTargetTestBase::getService<ISap>(hidl_string(SAP_SERVICE_NAME));
+ sap = ::testing::VtsHalHidlTargetTestBase::getService<ISap>(
+ SapHidlEnvironment::Instance()->getServiceName<ISap>(hidl_string(SAP_SERVICE_NAME)));
ASSERT_NE(sap, nullptr);
sapCb = new SapCallback(*this);
@@ -49,4 +50,4 @@
}
count--;
return status;
-}
\ No newline at end of file
+}
diff --git a/radio/1.0/vts/functional/sap_hidl_hal_utils.h b/radio/1.0/vts/functional/sap_hidl_hal_utils.h
index fb142b7..ec237dc 100644
--- a/radio/1.0/vts/functional/sap_hidl_hal_utils.h
+++ b/radio/1.0/vts/functional/sap_hidl_hal_utils.h
@@ -17,6 +17,7 @@
#include <android-base/logging.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <chrono>
#include <condition_variable>
#include <mutex>
@@ -79,6 +80,20 @@
Return<void> transferProtocolResponse(int32_t token, SapResultCode resultCode);
};
+// Test environment for Sap HIDL HAL.
+class SapHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static SapHidlEnvironment* Instance() {
+ static SapHidlEnvironment* instance = new SapHidlEnvironment;
+ return instance;
+ }
+ virtual void registerTestServices() override { registerTestService<ISap>(); }
+
+ private:
+ SapHidlEnvironment() {}
+};
+
// The main test class for Sap HIDL.
class SapHidlTest : public ::testing::VtsHalHidlTargetTestBase {
private:
@@ -102,4 +117,4 @@
/* Sap Callback object */
sp<SapCallback> sapCb;
-};
\ No newline at end of file
+};
diff --git a/radio/1.1/vts/functional/VtsHalRadioV1_1TargetTest.cpp b/radio/1.1/vts/functional/VtsHalRadioV1_1TargetTest.cpp
index 107a9e0..83564ee 100644
--- a/radio/1.1/vts/functional/VtsHalRadioV1_1TargetTest.cpp
+++ b/radio/1.1/vts/functional/VtsHalRadioV1_1TargetTest.cpp
@@ -17,10 +17,10 @@
#include <radio_hidl_hal_utils_v1_1.h>
int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(RadioHidlEnvironment::Instance());
::testing::InitGoogleTest(&argc, argv);
-
+ RadioHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
LOG(INFO) << "Test result = " << status;
-
return status;
-}
\ No newline at end of file
+}
diff --git a/radio/1.1/vts/functional/radio_hidl_hal_test.cpp b/radio/1.1/vts/functional/radio_hidl_hal_test.cpp
index 773d165..6d16cd8 100644
--- a/radio/1.1/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.1/vts/functional/radio_hidl_hal_test.cpp
@@ -19,11 +19,16 @@
void RadioHidlTest_v1_1::SetUp() {
radio_v1_1 =
::testing::VtsHalHidlTargetTestBase::getService<::android::hardware::radio::V1_1::IRadio>(
- hidl_string(RADIO_SERVICE_NAME));
+ RadioHidlEnvironment::Instance()
+ ->getServiceName<::android::hardware::radio::V1_1::IRadio>(
+ hidl_string(RADIO_SERVICE_NAME)));
if (radio_v1_1 == NULL) {
sleep(60);
radio_v1_1 = ::testing::VtsHalHidlTargetTestBase::getService<
- ::android::hardware::radio::V1_1::IRadio>(hidl_string(RADIO_SERVICE_NAME));
+ ::android::hardware::radio::V1_1::IRadio>(
+ RadioHidlEnvironment::Instance()
+ ->getServiceName<::android::hardware::radio::V1_1::IRadio>(
+ hidl_string(RADIO_SERVICE_NAME)));
}
ASSERT_NE(nullptr, radio_v1_1.get());
diff --git a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
index a081ab9..36d15c7 100644
--- a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
+++ b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
@@ -17,6 +17,7 @@
#include <android-base/logging.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <chrono>
#include <condition_variable>
#include <mutex>
@@ -534,6 +535,22 @@
const ::android::hardware::hidl_string& reason);
};
+// Test environment for Radio HIDL HAL.
+class RadioHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static RadioHidlEnvironment* Instance() {
+ static RadioHidlEnvironment* instance = new RadioHidlEnvironment;
+ return instance;
+ }
+ virtual void registerTestServices() override {
+ registerTestService<::android::hardware::radio::V1_1::IRadio>();
+ }
+
+ private:
+ RadioHidlEnvironment() {}
+};
+
// The main test class for Radio HIDL.
class RadioHidlTest_v1_1 : public ::testing::VtsHalHidlTargetTestBase {
protected:
diff --git a/radio/1.2/Android.bp b/radio/1.2/Android.bp
index 552e33d..48ac5a1 100644
--- a/radio/1.2/Android.bp
+++ b/radio/1.2/Android.bp
@@ -19,6 +19,7 @@
"android.hidl.base@1.0",
],
types: [
+ "AccessNetwork",
"AudioQuality",
"Call",
"CardStatus",
@@ -33,6 +34,7 @@
"CellInfoGsm",
"CellInfoLte",
"CellInfoWcdma",
+ "DataRequestReason",
"IncrementalResultsPeriodicityRange",
"IndicationFilter",
"LinkCapacityEstimate",
diff --git a/radio/1.2/vts/functional/Android.bp b/radio/1.2/vts/functional/Android.bp
index 6f8781a..a4e8c02 100644
--- a/radio/1.2/vts/functional/Android.bp
+++ b/radio/1.2/vts/functional/Android.bp
@@ -22,6 +22,7 @@
"radio_hidl_hal_test.cpp",
"radio_response.cpp",
"radio_indication.cpp",
+ "VtsHalRadioV1_2TargetTest.cpp",
],
static_libs: [
"RadioVtsTestUtilBase",
diff --git a/radio/1.2/vts/functional/VtsHalRadioV1_2TargetTest.cpp b/radio/1.2/vts/functional/VtsHalRadioV1_2TargetTest.cpp
new file mode 100644
index 0000000..c1a2f3d
--- /dev/null
+++ b/radio/1.2/vts/functional/VtsHalRadioV1_2TargetTest.cpp
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2018 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 <radio_hidl_hal_utils_v1_2.h>
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(RadioHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ RadioHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ return status;
+}
diff --git a/radio/1.2/vts/functional/radio_hidl_hal_test.cpp b/radio/1.2/vts/functional/radio_hidl_hal_test.cpp
index c1ab88b..d74d077 100644
--- a/radio/1.2/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.2/vts/functional/radio_hidl_hal_test.cpp
@@ -18,11 +18,13 @@
void RadioHidlTest_v1_2::SetUp() {
radio_v1_2 = ::testing::VtsHalHidlTargetTestBase::getService<V1_2::IRadio>(
- hidl_string(RADIO_SERVICE_NAME));
+ RadioHidlEnvironment::Instance()->getServiceName<V1_2::IRadio>(
+ hidl_string(RADIO_SERVICE_NAME)));
if (radio_v1_2 == NULL) {
sleep(60);
radio_v1_2 = ::testing::VtsHalHidlTargetTestBase::getService<V1_2::IRadio>(
- hidl_string(RADIO_SERVICE_NAME));
+ RadioHidlEnvironment::Instance()->getServiceName<V1_2::IRadio>(
+ hidl_string(RADIO_SERVICE_NAME)));
}
ASSERT_NE(nullptr, radio_v1_2.get());
diff --git a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h
index b3b53b1..781c12a 100644
--- a/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h
+++ b/radio/1.2/vts/functional/radio_hidl_hal_utils_v1_2.h
@@ -17,6 +17,7 @@
#include <android-base/logging.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <chrono>
#include <condition_variable>
#include <mutex>
@@ -525,6 +526,20 @@
const ::android::hardware::hidl_string& reason);
};
+// Test environment for Radio HIDL HAL.
+class RadioHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static RadioHidlEnvironment* Instance() {
+ static RadioHidlEnvironment* instance = new RadioHidlEnvironment;
+ return instance;
+ }
+ virtual void registerTestServices() override { registerTestService<V1_2::IRadio>(); }
+
+ private:
+ RadioHidlEnvironment() {}
+};
+
// The main test class for Radio HIDL.
class RadioHidlTest_v1_2 : public ::testing::VtsHalHidlTargetTestBase {
protected:
diff --git a/radio/config/1.0/vts/functional/Android.bp b/radio/config/1.0/vts/functional/Android.bp
index 66bfd92..aa8266e 100644
--- a/radio/config/1.0/vts/functional/Android.bp
+++ b/radio/config/1.0/vts/functional/Android.bp
@@ -22,6 +22,7 @@
"radio_config_hidl_hal_test.cpp",
"radio_config_response.cpp",
"radio_config_indication.cpp",
+ "VtsHalRadioConfigV1_0TargetTest.cpp",
],
static_libs: [
"RadioVtsTestUtilBase",
diff --git a/radio/config/1.0/vts/functional/VtsHalRadioConfigV1_0TargetTest.cpp b/radio/config/1.0/vts/functional/VtsHalRadioConfigV1_0TargetTest.cpp
new file mode 100644
index 0000000..2fc6b62
--- /dev/null
+++ b/radio/config/1.0/vts/functional/VtsHalRadioConfigV1_0TargetTest.cpp
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2018 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 <radio_config_hidl_hal_utils.h>
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(RadioConfigHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ RadioConfigHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ return status;
+}
diff --git a/radio/config/1.0/vts/functional/radio_config_hidl_hal_test.cpp b/radio/config/1.0/vts/functional/radio_config_hidl_hal_test.cpp
index 8df6842..c01dc4c 100644
--- a/radio/config/1.0/vts/functional/radio_config_hidl_hal_test.cpp
+++ b/radio/config/1.0/vts/functional/radio_config_hidl_hal_test.cpp
@@ -18,11 +18,13 @@
void RadioConfigHidlTest::SetUp() {
radioConfig = ::testing::VtsHalHidlTargetTestBase::getService<IRadioConfig>(
- hidl_string(RADIO_SERVICE_NAME));
+ RadioConfigHidlEnvironment::Instance()->getServiceName<IRadioConfig>(
+ hidl_string(RADIO_SERVICE_NAME)));
if (radioConfig == NULL) {
sleep(60);
radioConfig = ::testing::VtsHalHidlTargetTestBase::getService<IRadioConfig>(
- hidl_string(RADIO_SERVICE_NAME));
+ RadioConfigHidlEnvironment::Instance()->getServiceName<IRadioConfig>(
+ hidl_string(RADIO_SERVICE_NAME)));
}
ASSERT_NE(nullptr, radioConfig.get());
diff --git a/radio/config/1.0/vts/functional/radio_config_hidl_hal_utils.h b/radio/config/1.0/vts/functional/radio_config_hidl_hal_utils.h
index 762cc98..e7d697a 100644
--- a/radio/config/1.0/vts/functional/radio_config_hidl_hal_utils.h
+++ b/radio/config/1.0/vts/functional/radio_config_hidl_hal_utils.h
@@ -17,6 +17,7 @@
#include <android-base/logging.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <chrono>
#include <condition_variable>
#include <mutex>
@@ -75,6 +76,20 @@
RadioIndicationType type, const ::android::hardware::hidl_vec<SimSlotStatus>& slotStatus);
};
+// Test environment for Radio HIDL HAL.
+class RadioConfigHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static RadioConfigHidlEnvironment* Instance() {
+ static RadioConfigHidlEnvironment* instance = new RadioConfigHidlEnvironment;
+ return instance;
+ }
+ virtual void registerTestServices() override { registerTestService<IRadioConfig>(); }
+
+ private:
+ RadioConfigHidlEnvironment() {}
+};
+
// The main test class for Radio config HIDL.
class RadioConfigHidlTest : public ::testing::VtsHalHidlTargetTestBase {
protected:
diff --git a/tetheroffload/config/1.0/vts/functional/VtsHalTetheroffloadConfigV1_0TargetTest.cpp b/tetheroffload/config/1.0/vts/functional/VtsHalTetheroffloadConfigV1_0TargetTest.cpp
index bf211f0..34a95f2 100644
--- a/tetheroffload/config/1.0/vts/functional/VtsHalTetheroffloadConfigV1_0TargetTest.cpp
+++ b/tetheroffload/config/1.0/vts/functional/VtsHalTetheroffloadConfigV1_0TargetTest.cpp
@@ -17,6 +17,7 @@
#define LOG_TAG "VtsOffloadConfigV1_0TargetTest"
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
#include <android/hardware/tetheroffload/config/1.0/IOffloadConfig.h>
@@ -77,10 +78,25 @@
return netlinkSocket(NETLINK_NETFILTER, groups);
}
+// Test environment for OffloadConfig HIDL HAL.
+class OffloadConfigHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static OffloadConfigHidlEnvironment* Instance() {
+ static OffloadConfigHidlEnvironment* instance = new OffloadConfigHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IOffloadConfig>(); }
+ private:
+ OffloadConfigHidlEnvironment() {}
+};
+
class OffloadConfigHidlTest : public testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
- config = testing::VtsHalHidlTargetTestBase::getService<IOffloadConfig>();
+ config = testing::VtsHalHidlTargetTestBase::getService<IOffloadConfig>(
+ OffloadConfigHidlEnvironment::Instance()->getServiceName<IOffloadConfig>());
ASSERT_NE(nullptr, config.get()) << "Could not get HIDL instance";
}
@@ -175,7 +191,9 @@
}
int main(int argc, char** argv) {
- testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(OffloadConfigHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ OffloadConfigHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
ALOGE("Test result with status=%d", status);
return status;
diff --git a/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp b/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp
index d2fa92d..4eef4ec 100644
--- a/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp
+++ b/tetheroffload/control/1.0/vts/functional/VtsHalTetheroffloadControlV1_0TargetTest.cpp
@@ -18,6 +18,7 @@
#include <VtsHalHidlTargetCallbackBase.h>
#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
#include <android/hardware/tetheroffload/config/1.0/IOffloadConfig.h>
@@ -114,6 +115,23 @@
NatTimeoutUpdate last_params;
};
+// Test environment for OffloadControl HIDL HAL.
+class OffloadControlHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static OffloadControlHidlEnvironment* Instance() {
+ static OffloadControlHidlEnvironment* instance = new OffloadControlHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override {
+ registerTestService<IOffloadConfig>();
+ registerTestService<IOffloadControl>();
+ }
+ private:
+ OffloadControlHidlEnvironment() {}
+};
+
class OffloadControlHidlTestBase : public testing::VtsHalHidlTargetTestBase {
public:
virtual void SetUp() override {
@@ -131,7 +149,8 @@
// The IOffloadConfig HAL is tested more thoroughly elsewhere. He we just
// setup everything correctly and verify basic readiness.
void setupConfigHal() {
- config = testing::VtsHalHidlTargetTestBase::getService<IOffloadConfig>();
+ config = testing::VtsHalHidlTargetTestBase::getService<IOffloadConfig>(
+ OffloadControlHidlEnvironment::Instance()->getServiceName<IOffloadConfig>());
ASSERT_NE(nullptr, config.get()) << "Could not get HIDL instance";
unique_fd fd1(conntrackSocket(NF_NETLINK_CONNTRACK_NEW | NF_NETLINK_CONNTRACK_DESTROY));
@@ -159,7 +178,8 @@
}
void prepareControlHal() {
- control = testing::VtsHalHidlTargetTestBase::getService<IOffloadControl>();
+ control = testing::VtsHalHidlTargetTestBase::getService<IOffloadControl>(
+ OffloadControlHidlEnvironment::Instance()->getServiceName<IOffloadControl>());
ASSERT_NE(nullptr, control.get()) << "Could not get HIDL instance";
control_cb = new TetheringOffloadCallback();
@@ -678,7 +698,9 @@
}
int main(int argc, char** argv) {
- testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(OffloadControlHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ OffloadControlHidlEnvironment::Instance()->init(&argc, argv);
int status = RUN_ALL_TESTS();
ALOGE("Test result with status=%d", status);
return status;