Pass full registry path to DriverInfoWindows constructor

Related-To: NEO-4457
Change-Id: I6b417b3a571349947bbbfc94b10c478b8793c2de
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-03-16 10:11:27 +01:00
committed by sys_ocldev
parent e55d4bf234
commit 2dbee6d7c1
3 changed files with 25 additions and 6 deletions

View File

@ -99,7 +99,7 @@ class RegistryReaderMock : public SettingsReader {
};
TEST(DriverInfo, GivenDriverInfoWhenThenReturnNonNullptr) {
DriverInfoWindows driverInfo;
DriverInfoWindows driverInfo("");
RegistryReaderMock *registryReaderMock = new RegistryReaderMock();
driverInfo.setRegistryReader(registryReaderMock);
@ -119,6 +119,15 @@ TEST(DriverInfo, GivenDriverInfoWhenThenReturnNonNullptr) {
EXPECT_TRUE(registryReaderMock->properVersionKey);
};
TEST(DriverInfo, givenFullPathToRegistryWhenCreatingDriverInfoWindowsThenTheRegistryPathIsTrimmed) {
std::string registryPath = "Path\\In\\Registry";
std::string fullRegistryPath = "\\REGISTRY\\MACHINE\\" + registryPath;
std::string expectedTrimmedRegistryPath = registryPath;
DriverInfoWindows driverInfo(std::move(fullRegistryPath));
EXPECT_STREQ(expectedTrimmedRegistryPath.c_str(), driverInfo.getRegistryPath().c_str());
};
TEST(DriverInfo, givenInitializedOsInterfaceWhenCreateDriverInfoThenReturnDriverInfoWindowsNotNullptr) {
MockExecutionEnvironment executionEnvironment;
@ -144,6 +153,7 @@ TEST(DriverInfo, givenNotInitializedOsInterfaceWhenCreateDriverInfoThenReturnDri
class MockDriverInfoWindows : public DriverInfoWindows {
public:
MockDriverInfoWindows() : DriverInfoWindows("") {}
const char *getRegistryReaderRegKey() {
return reader->getRegKey();
}