Conditionally disable DX sharing extensions

Change-Id: Idbc253f072a9400962b7500e75ba6fd86e5e6b59
Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
Katarzyna Cencelewska
2020-03-18 15:19:03 +01:00
committed by sys_ocldev
parent 71950fa7cc
commit 9c716a8d98
13 changed files with 133 additions and 4 deletions

View File

@ -113,6 +113,13 @@ class MockRegistryReader : public SettingsReader {
properNameKey = true;
} else if (key == "DriverVersion") {
properVersionKey = true;
} else if (key == "UserModeDriverName") {
properMediaSharingExtensions = true;
using64bit = true;
return returnString;
} else if (key == "UserModeDriverNameWOW") {
properMediaSharingExtensions = true;
return returnString;
}
if (key == "DriverStorePathForComputeRuntime") {
return driverStorePath;
@ -127,6 +134,9 @@ class MockRegistryReader : public SettingsReader {
bool properNameKey = false;
bool properVersionKey = false;
std::string driverStorePath = "driverStore\\0x8086";
bool properMediaSharingExtensions = false;
bool using64bit = false;
std::string returnString = "";
};
struct DriverInfoWindowsTest : public ::testing::Test {
@ -160,6 +170,31 @@ TEST_F(DriverInfoWindowsTest, GivenDriverInfoWhenThenReturnNonNullptr) {
EXPECT_TRUE(registryReaderMock->properVersionKey);
};
TEST(DriverInfo, givenDriverInfoWhenGetStringReturnNotMeaningEmptyStringThenEnableSharingSupport) {
MockDriverInfoWindows driverInfo("");
MockRegistryReader *registryReaderMock = new MockRegistryReader();
driverInfo.registryReader.reset(registryReaderMock);
auto enable = driverInfo.getMediaSharingSupport();
EXPECT_TRUE(enable);
EXPECT_EQ(is64bit, registryReaderMock->using64bit);
EXPECT_TRUE(registryReaderMock->properMediaSharingExtensions);
};
TEST(DriverInfo, givenDriverInfoWhenGetStringReturnMeaningEmptyStringThenDisableSharingSupport) {
MockDriverInfoWindows driverInfo("");
MockRegistryReader *registryReaderMock = new MockRegistryReader();
registryReaderMock->returnString = "<>";
driverInfo.registryReader.reset(registryReaderMock);
auto enable = driverInfo.getMediaSharingSupport();
EXPECT_FALSE(enable);
EXPECT_EQ(is64bit, registryReaderMock->using64bit);
EXPECT_TRUE(registryReaderMock->properMediaSharingExtensions);
};
TEST(DriverInfo, givenFullPathToRegistryWhenCreatingDriverInfoWindowsThenTheRegistryPathIsTrimmed) {
std::string registryPath = "Path\\In\\Registry";
std::string fullRegistryPath = "\\REGISTRY\\MACHINE\\" + registryPath;