Convert VtsHalGraphicsComposerV2_*TargetTest to be parameterized test
Bug: 142397658 Test: atest VtsHalGraphicsComposerV2_1TargetTest Change-Id: Idd6b0a0314be706e06f7812fbf8eb787edd078b1
This commit is contained in:
parent
ec44d92e67
commit
ff7462064d
3 changed files with 72 additions and 92 deletions
|
@ -57,6 +57,7 @@ class Composer {
|
|||
public:
|
||||
Composer();
|
||||
explicit Composer(const std::string& name);
|
||||
explicit Composer(const sp<IComposer>& composer);
|
||||
|
||||
sp<IComposer> getRaw() const;
|
||||
|
||||
|
@ -67,9 +68,6 @@ class Composer {
|
|||
std::string dumpDebugInfo();
|
||||
std::unique_ptr<ComposerClient> createClient();
|
||||
|
||||
protected:
|
||||
explicit Composer(const sp<IComposer>& composer);
|
||||
|
||||
private:
|
||||
const sp<IComposer> mComposer;
|
||||
|
||||
|
|
|
@ -42,5 +42,6 @@ cc_test {
|
|||
header_libs: [
|
||||
"android.hardware.graphics.composer@2.1-command-buffer",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
disable_framework: true,
|
||||
test_suites: ["general-tests", "vts-core"],
|
||||
}
|
||||
|
|
|
@ -20,13 +20,14 @@
|
|||
#include <composer-vts/2.1/ComposerVts.h>
|
||||
#include <composer-vts/2.1/GraphicsComposerCallback.h>
|
||||
#include <composer-vts/2.1/TestCommandReader.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hardware/hwcomposer2.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
#include <mapper-vts/2.0/MapperVts.h>
|
||||
#include <mapper-vts/3.0/MapperVts.h>
|
||||
#include <mapper-vts/4.0/MapperVts.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
#include <VtsHalHidlTargetTestEnvBase.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -52,30 +53,11 @@ using android::hardware::graphics::common::V1_0::PixelFormat;
|
|||
using android::hardware::graphics::common::V1_0::Transform;
|
||||
using GrallocError = android::hardware::graphics::mapper::V2_0::Error;
|
||||
|
||||
// Test environment for graphics.composer
|
||||
class GraphicsComposerHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
|
||||
public:
|
||||
// get the test environment singleton
|
||||
static GraphicsComposerHidlEnvironment* Instance() {
|
||||
static GraphicsComposerHidlEnvironment* instance = new GraphicsComposerHidlEnvironment;
|
||||
return instance;
|
||||
}
|
||||
|
||||
virtual void registerTestServices() override { registerTestService<IComposer>(); }
|
||||
|
||||
private:
|
||||
GraphicsComposerHidlEnvironment() {}
|
||||
|
||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(GraphicsComposerHidlEnvironment);
|
||||
};
|
||||
|
||||
class GraphicsComposerHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
protected:
|
||||
class GraphicsComposerHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
VtsHalHidlTargetTestBase::SetUp();
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
mComposer = std::make_unique<Composer>(
|
||||
GraphicsComposerHidlEnvironment::Instance()->getServiceName<IComposer>()));
|
||||
mComposer = std::make_unique<Composer>(IComposer::getService(GetParam())));
|
||||
ASSERT_NO_FATAL_FAILURE(mComposerClient = mComposer->createClient());
|
||||
|
||||
mComposerCallback = new GraphicsComposerCallback;
|
||||
|
@ -102,7 +84,6 @@ class GraphicsComposerHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
EXPECT_EQ(0, mComposerCallback->getInvalidRefreshCount());
|
||||
EXPECT_EQ(0, mComposerCallback->getInvalidVsyncCount());
|
||||
}
|
||||
VtsHalHidlTargetTestBase::TearDown();
|
||||
}
|
||||
|
||||
// returns an invalid display id (one that has not been registered to a
|
||||
|
@ -151,7 +132,7 @@ class GraphicsComposerHidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
|||
*
|
||||
* Test that IComposer::getCapabilities returns no invalid capabilities.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, GetCapabilities) {
|
||||
TEST_P(GraphicsComposerHidlTest, GetCapabilities) {
|
||||
auto capabilities = mComposer->getCapabilities();
|
||||
ASSERT_EQ(capabilities.end(),
|
||||
std::find(capabilities.begin(), capabilities.end(), IComposer::Capability::INVALID));
|
||||
|
@ -160,7 +141,7 @@ TEST_F(GraphicsComposerHidlTest, GetCapabilities) {
|
|||
/**
|
||||
* Test IComposer::dumpDebugInfo.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, DumpDebugInfo) {
|
||||
TEST_P(GraphicsComposerHidlTest, DumpDebugInfo) {
|
||||
mComposer->dumpDebugInfo();
|
||||
}
|
||||
|
||||
|
@ -169,7 +150,7 @@ TEST_F(GraphicsComposerHidlTest, DumpDebugInfo) {
|
|||
*
|
||||
* Test that IComposerClient is a singleton.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, CreateClientSingleton) {
|
||||
TEST_P(GraphicsComposerHidlTest, CreateClientSingleton) {
|
||||
mComposer->getRaw()->createClient(
|
||||
[&](const auto& tmpError, const auto&) { EXPECT_EQ(Error::NO_RESOURCES, tmpError); });
|
||||
}
|
||||
|
@ -180,7 +161,7 @@ TEST_F(GraphicsComposerHidlTest, CreateClientSingleton) {
|
|||
*
|
||||
* Test that virtual displays can be created and has the correct display type.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, CreateVirtualDisplay) {
|
||||
TEST_P(GraphicsComposerHidlTest, CreateVirtualDisplay) {
|
||||
if (mComposerClient->getMaxVirtualDisplayCount() == 0) {
|
||||
GTEST_SUCCEED() << "no virtual display support";
|
||||
return;
|
||||
|
@ -205,7 +186,7 @@ TEST_F(GraphicsComposerHidlTest, CreateVirtualDisplay) {
|
|||
* Test that passing a bad display handle to destroyVirtualDisplay
|
||||
* returns a BAD_DISPLAY error
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, DestroyVirtualDisplayBadDisplay) {
|
||||
TEST_P(GraphicsComposerHidlTest, DestroyVirtualDisplayBadDisplay) {
|
||||
if (mComposerClient->getMaxVirtualDisplayCount() == 0) {
|
||||
GTEST_SUCCEED() << "no virtual display support";
|
||||
return;
|
||||
|
@ -220,7 +201,7 @@ TEST_F(GraphicsComposerHidlTest, DestroyVirtualDisplayBadDisplay) {
|
|||
*
|
||||
* Test that layers can be created and destroyed.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, CreateLayer) {
|
||||
TEST_P(GraphicsComposerHidlTest, CreateLayer) {
|
||||
Layer layer;
|
||||
ASSERT_NO_FATAL_FAILURE(layer =
|
||||
mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount));
|
||||
|
@ -234,7 +215,7 @@ TEST_F(GraphicsComposerHidlTest, CreateLayer) {
|
|||
* Test that passing in an invalid display handle to createLayer returns
|
||||
* BAD_DISPLAY.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, CreateLayerBadDisplay) {
|
||||
TEST_P(GraphicsComposerHidlTest, CreateLayerBadDisplay) {
|
||||
Error error;
|
||||
mComposerClient->getRaw()->createLayer(
|
||||
mInvalidDisplayId, kBufferSlotCount,
|
||||
|
@ -248,7 +229,7 @@ TEST_F(GraphicsComposerHidlTest, CreateLayerBadDisplay) {
|
|||
* Test that passing in an invalid display handle to destroyLayer returns
|
||||
* BAD_DISPLAY
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, DestroyLayerBadDisplay) {
|
||||
TEST_P(GraphicsComposerHidlTest, DestroyLayerBadDisplay) {
|
||||
Error error;
|
||||
Layer layer;
|
||||
ASSERT_NO_FATAL_FAILURE(layer =
|
||||
|
@ -267,7 +248,7 @@ TEST_F(GraphicsComposerHidlTest, DestroyLayerBadDisplay) {
|
|||
* Test that passing in an invalid layer handle to destroyLayer returns
|
||||
* BAD_LAYER
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, DestroyLayerBadLayerError) {
|
||||
TEST_P(GraphicsComposerHidlTest, DestroyLayerBadLayerError) {
|
||||
// We haven't created any layers yet, so any id should be invalid
|
||||
Error error = mComposerClient->getRaw()->destroyLayer(mPrimaryDisplay, 1);
|
||||
|
||||
|
@ -280,7 +261,7 @@ TEST_F(GraphicsComposerHidlTest, DestroyLayerBadLayerError) {
|
|||
* Test that passing in a bad display handle to getActiveConfig generates a
|
||||
* BAD_DISPLAY error
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, GetActiveConfigBadDisplay) {
|
||||
TEST_P(GraphicsComposerHidlTest, GetActiveConfigBadDisplay) {
|
||||
Error error;
|
||||
mComposerClient->getRaw()->getActiveConfig(
|
||||
mInvalidDisplayId, [&](const auto& tmpOutError, const auto&) { error = tmpOutError; });
|
||||
|
@ -293,7 +274,7 @@ TEST_F(GraphicsComposerHidlTest, GetActiveConfigBadDisplay) {
|
|||
* Test IComposerClient::getDisplayConfigs returns no error
|
||||
* when passed in a valid display
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, GetDisplayConfig) {
|
||||
TEST_P(GraphicsComposerHidlTest, GetDisplayConfig) {
|
||||
std::vector<Config> configs;
|
||||
ASSERT_NO_FATAL_FAILURE(configs = mComposerClient->getDisplayConfigs(mPrimaryDisplay));
|
||||
}
|
||||
|
@ -304,7 +285,7 @@ TEST_F(GraphicsComposerHidlTest, GetDisplayConfig) {
|
|||
* Test IComposerClient::getDisplayConfigs returns BAD_DISPLAY
|
||||
* when passed in an invalid display handle
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, GetDisplayConfigBadDisplay) {
|
||||
TEST_P(GraphicsComposerHidlTest, GetDisplayConfigBadDisplay) {
|
||||
Error error;
|
||||
mComposerClient->getRaw()->getDisplayConfigs(
|
||||
mInvalidDisplayId, [&](const auto& tmpOutError, const auto&) { error = tmpOutError; });
|
||||
|
@ -314,7 +295,7 @@ TEST_F(GraphicsComposerHidlTest, GetDisplayConfigBadDisplay) {
|
|||
/**
|
||||
* Test IComposerClient::getDisplayName.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, GetDisplayName) {
|
||||
TEST_P(GraphicsComposerHidlTest, GetDisplayName) {
|
||||
mComposerClient->getDisplayName(mPrimaryDisplay);
|
||||
}
|
||||
|
||||
|
@ -324,7 +305,7 @@ TEST_F(GraphicsComposerHidlTest, GetDisplayName) {
|
|||
* Test that IComposerClient::getDisplayType returns the correct display type
|
||||
* for the primary display.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, GetDisplayType) {
|
||||
TEST_P(GraphicsComposerHidlTest, GetDisplayType) {
|
||||
ASSERT_EQ(IComposerClient::DisplayType::PHYSICAL,
|
||||
mComposerClient->getDisplayType(mPrimaryDisplay));
|
||||
}
|
||||
|
@ -335,7 +316,7 @@ TEST_F(GraphicsComposerHidlTest, GetDisplayType) {
|
|||
* Test that IComposerClient::getClientTargetSupport returns true for the
|
||||
* required client targets.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, GetClientTargetSupport) {
|
||||
TEST_P(GraphicsComposerHidlTest, GetClientTargetSupport) {
|
||||
std::vector<Config> configs = mComposerClient->getDisplayConfigs(mPrimaryDisplay);
|
||||
for (auto config : configs) {
|
||||
int32_t width = mComposerClient->getDisplayAttribute(mPrimaryDisplay, config,
|
||||
|
@ -358,7 +339,7 @@ TEST_F(GraphicsComposerHidlTest, GetClientTargetSupport) {
|
|||
* Test that IComposerClient::getClientTargetSupport returns BAD_DISPLAY when
|
||||
* passed an invalid display handle
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, GetClientTargetSupportBadDisplay) {
|
||||
TEST_P(GraphicsComposerHidlTest, GetClientTargetSupportBadDisplay) {
|
||||
std::vector<Config> configs = mComposerClient->getDisplayConfigs(mPrimaryDisplay);
|
||||
for (auto config : configs) {
|
||||
int32_t width = mComposerClient->getDisplayAttribute(mPrimaryDisplay, config,
|
||||
|
@ -382,7 +363,7 @@ TEST_F(GraphicsComposerHidlTest, GetClientTargetSupportBadDisplay) {
|
|||
* Test that IComposerClient::getDisplayAttribute succeeds for the required
|
||||
* formats, and succeeds or fails correctly for optional attributes.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, GetDisplayAttribute) {
|
||||
TEST_P(GraphicsComposerHidlTest, GetDisplayAttribute) {
|
||||
std::vector<Config> configs = mComposerClient->getDisplayConfigs(mPrimaryDisplay);
|
||||
for (auto config : configs) {
|
||||
const std::array<IComposerClient::Attribute, 3> requiredAttributes = {{
|
||||
|
@ -408,7 +389,7 @@ TEST_F(GraphicsComposerHidlTest, GetDisplayAttribute) {
|
|||
/**
|
||||
* Test IComposerClient::getHdrCapabilities.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, GetHdrCapabilities) {
|
||||
TEST_P(GraphicsComposerHidlTest, GetHdrCapabilities) {
|
||||
float maxLuminance;
|
||||
float maxAverageLuminance;
|
||||
float minLuminance;
|
||||
|
@ -419,7 +400,7 @@ TEST_F(GraphicsComposerHidlTest, GetHdrCapabilities) {
|
|||
/**
|
||||
* Test IComposerClient::setClientTargetSlotCount.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, SetClientTargetSlotCount) {
|
||||
TEST_P(GraphicsComposerHidlTest, SetClientTargetSlotCount) {
|
||||
mComposerClient->setClientTargetSlotCount(mPrimaryDisplay, kBufferSlotCount);
|
||||
}
|
||||
|
||||
|
@ -429,7 +410,7 @@ TEST_F(GraphicsComposerHidlTest, SetClientTargetSlotCount) {
|
|||
* Test that IComposerClient::setActiveConfig succeeds for all display
|
||||
* configs.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, SetActiveConfig) {
|
||||
TEST_P(GraphicsComposerHidlTest, SetActiveConfig) {
|
||||
std::vector<Config> configs = mComposerClient->getDisplayConfigs(mPrimaryDisplay);
|
||||
for (auto config : configs) {
|
||||
mComposerClient->setActiveConfig(mPrimaryDisplay, config);
|
||||
|
@ -443,7 +424,7 @@ TEST_F(GraphicsComposerHidlTest, SetActiveConfig) {
|
|||
* Test that config set during IComposerClient::setActiveConfig is maintained
|
||||
* during a display on/off power cycle
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, SetActiveConfigPowerCycle) {
|
||||
TEST_P(GraphicsComposerHidlTest, SetActiveConfigPowerCycle) {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
mComposerClient->setPowerMode(mPrimaryDisplay, IComposerClient::PowerMode::OFF));
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
|
@ -467,7 +448,7 @@ TEST_F(GraphicsComposerHidlTest, SetActiveConfigPowerCycle) {
|
|||
*
|
||||
* Test that IComposerClient::getColorMode always returns ColorMode::NATIVE
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, GetColorModes) {
|
||||
TEST_P(GraphicsComposerHidlTest, GetColorModes) {
|
||||
std::vector<ColorMode> modes = mComposerClient->getColorModes(mPrimaryDisplay);
|
||||
auto nativeModeLocation = std::find(modes.begin(), modes.end(), ColorMode::NATIVE);
|
||||
|
||||
|
@ -479,7 +460,7 @@ TEST_F(GraphicsComposerHidlTest, GetColorModes) {
|
|||
*
|
||||
* Test that IComposerClient::setColorMode succeeds for all color modes.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, SetColorMode) {
|
||||
TEST_P(GraphicsComposerHidlTest, SetColorMode) {
|
||||
std::unordered_set<ColorMode> validModes;
|
||||
for (auto mode : hidl_enum_range<ColorMode>()) {
|
||||
validModes.insert(mode);
|
||||
|
@ -499,7 +480,7 @@ TEST_F(GraphicsComposerHidlTest, SetColorMode) {
|
|||
* Test that IComposerClient::setColorMode returns BAD_DISPLAY for
|
||||
* an invalid display handle
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, SetColorModeBadDisplay) {
|
||||
TEST_P(GraphicsComposerHidlTest, SetColorModeBadDisplay) {
|
||||
std::vector<ColorMode> modes = mComposerClient->getColorModes(mPrimaryDisplay);
|
||||
for (auto mode : modes) {
|
||||
Error error = mComposerClient->getRaw()->setColorMode(mInvalidDisplayId, mode);
|
||||
|
@ -513,7 +494,7 @@ TEST_F(GraphicsComposerHidlTest, SetColorModeBadDisplay) {
|
|||
* Test that IComposerClient::setColorMode returns BAD_PARAMETER when passed in
|
||||
* an invalid color mode
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, SetColorModeBadParameter) {
|
||||
TEST_P(GraphicsComposerHidlTest, SetColorModeBadParameter) {
|
||||
Error error =
|
||||
mComposerClient->getRaw()->setColorMode(mPrimaryDisplay, static_cast<ColorMode>(-1));
|
||||
ASSERT_EQ(Error::BAD_PARAMETER, error);
|
||||
|
@ -525,7 +506,7 @@ TEST_F(GraphicsComposerHidlTest, SetColorModeBadParameter) {
|
|||
* Test that IComposerClient::getDozeSupport returns
|
||||
* BAD_DISPLAY when passed an invalid display handle
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, GetDozeSupportBadDisplay) {
|
||||
TEST_P(GraphicsComposerHidlTest, GetDozeSupportBadDisplay) {
|
||||
Error error;
|
||||
mComposerClient->getRaw()->getDozeSupport(
|
||||
mInvalidDisplayId, [&](const auto& tmpOutError, const auto&) { error = tmpOutError; });
|
||||
|
@ -537,7 +518,7 @@ TEST_F(GraphicsComposerHidlTest, GetDozeSupportBadDisplay) {
|
|||
*
|
||||
* Test that IComposerClient::setPowerMode succeeds for all power modes.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, SetPowerMode) {
|
||||
TEST_P(GraphicsComposerHidlTest, SetPowerMode) {
|
||||
std::vector<IComposerClient::PowerMode> modes;
|
||||
modes.push_back(IComposerClient::PowerMode::OFF);
|
||||
|
||||
|
@ -560,7 +541,7 @@ TEST_F(GraphicsComposerHidlTest, SetPowerMode) {
|
|||
* Test IComposerClient::setPowerMode succeeds with different
|
||||
* orderings of power modes
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, SetPowerModeVariations) {
|
||||
TEST_P(GraphicsComposerHidlTest, SetPowerModeVariations) {
|
||||
std::vector<IComposerClient::PowerMode> modes;
|
||||
modes.push_back(IComposerClient::PowerMode::OFF);
|
||||
modes.push_back(IComposerClient::PowerMode::ON);
|
||||
|
@ -611,7 +592,7 @@ TEST_F(GraphicsComposerHidlTest, SetPowerModeVariations) {
|
|||
* Test IComposerClient::setPowerMode returns BAD_DISPLAY when passed an invalid
|
||||
* display handle
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, SetPowerModeBadDisplay) {
|
||||
TEST_P(GraphicsComposerHidlTest, SetPowerModeBadDisplay) {
|
||||
Error error =
|
||||
mComposerClient->getRaw()->setPowerMode(mInvalidDisplayId, IComposerClient::PowerMode::ON);
|
||||
ASSERT_EQ(Error::BAD_DISPLAY, error);
|
||||
|
@ -623,7 +604,7 @@ TEST_F(GraphicsComposerHidlTest, SetPowerModeBadDisplay) {
|
|||
* Test that IComposerClient::setPowerMode returns UNSUPPORTED when passed DOZE
|
||||
* or DOZE_SUSPEND on devices that do not support DOZE/DOZE_SUSPEND
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, SetPowerModeUnsupported) {
|
||||
TEST_P(GraphicsComposerHidlTest, SetPowerModeUnsupported) {
|
||||
if (!mComposerClient->getDozeSupport(mPrimaryDisplay)) {
|
||||
Error error = mComposerClient->getRaw()->setPowerMode(mPrimaryDisplay,
|
||||
IComposerClient::PowerMode::DOZE);
|
||||
|
@ -641,7 +622,7 @@ TEST_F(GraphicsComposerHidlTest, SetPowerModeUnsupported) {
|
|||
* Tests that IComposerClient::setPowerMode returns BAD_PARAMETER when passed an invalid
|
||||
* PowerMode
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, SetPowerModeBadParameter) {
|
||||
TEST_P(GraphicsComposerHidlTest, SetPowerModeBadParameter) {
|
||||
Error error = mComposerClient->getRaw()->setPowerMode(
|
||||
mPrimaryDisplay, static_cast<IComposerClient::PowerMode>(-1));
|
||||
ASSERT_EQ(Error::BAD_PARAMETER, error);
|
||||
|
@ -653,7 +634,7 @@ TEST_F(GraphicsComposerHidlTest, SetPowerModeBadParameter) {
|
|||
* Test that IComposerClient::setVsyncEnabled succeeds and there is no
|
||||
* spurious vsync events.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlTest, SetVsyncEnabled) {
|
||||
TEST_P(GraphicsComposerHidlTest, SetVsyncEnabled) {
|
||||
mComposerCallback->setVsyncAllowed(true);
|
||||
|
||||
mComposerClient->setVsyncEnabled(mPrimaryDisplay, true);
|
||||
|
@ -705,7 +686,7 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_COLOR_TRANSFORM.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_COLOR_TRANSFORM) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_COLOR_TRANSFORM) {
|
||||
const std::array<float, 16> identity = {{
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
1.0f,
|
||||
|
@ -720,7 +701,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_COLOR_TRANSFORM) {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_CLIENT_TARGET.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_CLIENT_TARGET) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_CLIENT_TARGET) {
|
||||
mComposerClient->setClientTargetSlotCount(mPrimaryDisplay, kBufferSlotCount);
|
||||
|
||||
mWriter->selectDisplay(mPrimaryDisplay);
|
||||
|
@ -733,7 +714,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_CLIENT_TARGET) {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_OUTPUT_BUFFER.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_OUTPUT_BUFFER) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_OUTPUT_BUFFER) {
|
||||
if (mComposerClient->getMaxVirtualDisplayCount() == 0) {
|
||||
GTEST_SUCCEED() << "no virtual display support";
|
||||
return;
|
||||
|
@ -756,7 +737,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_OUTPUT_BUFFER) {
|
|||
/**
|
||||
* Test IComposerClient::Command::VALIDATE_DISPLAY.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, VALIDATE_DISPLAY) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, VALIDATE_DISPLAY) {
|
||||
mWriter->selectDisplay(mPrimaryDisplay);
|
||||
mWriter->validateDisplay();
|
||||
execute();
|
||||
|
@ -765,7 +746,7 @@ TEST_F(GraphicsComposerHidlCommandTest, VALIDATE_DISPLAY) {
|
|||
/**
|
||||
* Test IComposerClient::Command::ACCEPT_DISPLAY_CHANGES.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, ACCEPT_DISPLAY_CHANGES) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, ACCEPT_DISPLAY_CHANGES) {
|
||||
mWriter->selectDisplay(mPrimaryDisplay);
|
||||
mWriter->validateDisplay();
|
||||
mWriter->acceptDisplayChanges();
|
||||
|
@ -775,7 +756,7 @@ TEST_F(GraphicsComposerHidlCommandTest, ACCEPT_DISPLAY_CHANGES) {
|
|||
/**
|
||||
* Test IComposerClient::Command::PRESENT_DISPLAY.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, PRESENT_DISPLAY) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, PRESENT_DISPLAY) {
|
||||
mWriter->selectDisplay(mPrimaryDisplay);
|
||||
mWriter->validateDisplay();
|
||||
mWriter->presentDisplay();
|
||||
|
@ -789,7 +770,7 @@ TEST_F(GraphicsComposerHidlCommandTest, PRESENT_DISPLAY) {
|
|||
* additional call to validateDisplay when only the layer buffer handle and
|
||||
* surface damage have been set
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, PRESENT_DISPLAY_NO_LAYER_STATE_CHANGES) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, PRESENT_DISPLAY_NO_LAYER_STATE_CHANGES) {
|
||||
if (!mComposer->hasCapability(
|
||||
static_cast<IComposer::Capability>(HWC2_CAPABILITY_SKIP_VALIDATE))) {
|
||||
std::cout << "Device does not have skip validate capability, skipping" << std::endl;
|
||||
|
@ -845,7 +826,7 @@ TEST_F(GraphicsComposerHidlCommandTest, PRESENT_DISPLAY_NO_LAYER_STATE_CHANGES)
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_LAYER_CURSOR_POSITION.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_CURSOR_POSITION) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_CURSOR_POSITION) {
|
||||
Layer layer;
|
||||
ASSERT_NO_FATAL_FAILURE(layer =
|
||||
mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount));
|
||||
|
@ -887,7 +868,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_CURSOR_POSITION) {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_LAYER_BUFFER.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER) {
|
||||
auto handle = allocate();
|
||||
ASSERT_NE(nullptr, handle);
|
||||
|
||||
|
@ -904,7 +885,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER) {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_LAYER_SURFACE_DAMAGE.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_SURFACE_DAMAGE) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_SURFACE_DAMAGE) {
|
||||
Layer layer;
|
||||
ASSERT_NO_FATAL_FAILURE(layer =
|
||||
mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount));
|
||||
|
@ -923,7 +904,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_SURFACE_DAMAGE) {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_LAYER_BLEND_MODE.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_BLEND_MODE) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_BLEND_MODE) {
|
||||
Layer layer;
|
||||
ASSERT_NO_FATAL_FAILURE(layer =
|
||||
mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount));
|
||||
|
@ -939,7 +920,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_BLEND_MODE) {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_LAYER_COLOR.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_COLOR) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_COLOR) {
|
||||
Layer layer;
|
||||
ASSERT_NO_FATAL_FAILURE(layer =
|
||||
mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount));
|
||||
|
@ -954,7 +935,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_COLOR) {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_LAYER_COMPOSITION_TYPE.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_COMPOSITION_TYPE) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_COMPOSITION_TYPE) {
|
||||
Layer layer;
|
||||
ASSERT_NO_FATAL_FAILURE(layer =
|
||||
mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount));
|
||||
|
@ -971,7 +952,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_COMPOSITION_TYPE) {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_LAYER_DATASPACE.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_DATASPACE) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_DATASPACE) {
|
||||
Layer layer;
|
||||
ASSERT_NO_FATAL_FAILURE(layer =
|
||||
mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount));
|
||||
|
@ -985,7 +966,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_DATASPACE) {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_LAYER_DISPLAY_FRAME.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_DISPLAY_FRAME) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_DISPLAY_FRAME) {
|
||||
Layer layer;
|
||||
ASSERT_NO_FATAL_FAILURE(layer =
|
||||
mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount));
|
||||
|
@ -999,7 +980,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_DISPLAY_FRAME) {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_LAYER_PLANE_ALPHA.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_PLANE_ALPHA) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_PLANE_ALPHA) {
|
||||
Layer layer;
|
||||
ASSERT_NO_FATAL_FAILURE(layer =
|
||||
mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount));
|
||||
|
@ -1014,7 +995,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_PLANE_ALPHA) {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_LAYER_SIDEBAND_STREAM.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_SIDEBAND_STREAM) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_SIDEBAND_STREAM) {
|
||||
if (!mComposer->hasCapability(IComposer::Capability::SIDEBAND_STREAM)) {
|
||||
GTEST_SUCCEED() << "no sideband stream support";
|
||||
return;
|
||||
|
@ -1036,7 +1017,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_SIDEBAND_STREAM) {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_LAYER_SOURCE_CROP.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_SOURCE_CROP) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_SOURCE_CROP) {
|
||||
Layer layer;
|
||||
ASSERT_NO_FATAL_FAILURE(layer =
|
||||
mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount));
|
||||
|
@ -1050,7 +1031,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_SOURCE_CROP) {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_LAYER_TRANSFORM.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_TRANSFORM) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_TRANSFORM) {
|
||||
Layer layer;
|
||||
ASSERT_NO_FATAL_FAILURE(layer =
|
||||
mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount));
|
||||
|
@ -1071,7 +1052,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_TRANSFORM) {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_LAYER_VISIBLE_REGION.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_VISIBLE_REGION) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_VISIBLE_REGION) {
|
||||
Layer layer;
|
||||
ASSERT_NO_FATAL_FAILURE(layer =
|
||||
mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount));
|
||||
|
@ -1090,7 +1071,7 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_VISIBLE_REGION) {
|
|||
/**
|
||||
* Test IComposerClient::Command::SET_LAYER_Z_ORDER.
|
||||
*/
|
||||
TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_Z_ORDER) {
|
||||
TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_Z_ORDER) {
|
||||
Layer layer;
|
||||
ASSERT_NO_FATAL_FAILURE(layer =
|
||||
mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount));
|
||||
|
@ -1102,6 +1083,16 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_Z_ORDER) {
|
|||
execute();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, GraphicsComposerHidlCommandTest,
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(IComposer::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, GraphicsComposerHidlTest,
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(IComposer::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
|
||||
} // namespace
|
||||
} // namespace vts
|
||||
} // namespace V2_1
|
||||
|
@ -1109,13 +1100,3 @@ TEST_F(GraphicsComposerHidlCommandTest, SET_LAYER_Z_ORDER) {
|
|||
} // namespace graphics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
using android::hardware::graphics::composer::V2_1::vts::GraphicsComposerHidlEnvironment;
|
||||
::testing::AddGlobalTestEnvironment(GraphicsComposerHidlEnvironment::Instance());
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
GraphicsComposerHidlEnvironment::Instance()->init(&argc, argv);
|
||||
int status = RUN_ALL_TESTS();
|
||||
ALOGI("Test result = %d", status);
|
||||
return status;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue