forked from microsoft/mu_basecore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MdeModulePkg: Added MockSmmVarCheck gmock
Added a gmock for GoogleTests
- Loading branch information
1 parent
68350eb
commit 4321868
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
MdeModulePkg/Test/Mock/Include/GoogleTest/Protocol/MockSmmVarCheck.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** @file MockSmmVarCheck.h | ||
This file declares a mock of Smm Variable check Protocol. | ||
Copyright (c) Microsoft Corporation. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef MOCK_SMM_VAR_CHECK_H | ||
#define MOCK_SMM_VAR_CHECK_H | ||
|
||
#include <Library/GoogleTestLib.h> | ||
#include <Library/FunctionMockLib.h> | ||
|
||
extern "C" { | ||
#include <Uefi.h> | ||
#include <Protocol/SmmVarCheck.h> | ||
} | ||
|
||
struct MockSmmVarCheck { | ||
MOCK_INTERFACE_DECLARATION (MockSmmVarCheck); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
SmmRegisterSetVariableCheckHandler, | ||
( | ||
IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER Handler | ||
) | ||
); | ||
}; | ||
|
||
extern "C" { | ||
extern EDKII_SMM_VAR_CHECK_PROTOCOL *gEdkiiSmmVarCheckProtocol; | ||
} | ||
|
||
#endif // MOCK_SMM_VAR_CHECK_H |
21 changes: 21 additions & 0 deletions
21
MdeModulePkg/Test/Mock/Library/GoogleTest/Protocol/MockSmmVarCheck.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** @file MockSmmVarCheck.cpp | ||
Google Test mock for Smm Variable Check Protocol | ||
Copyright (c) Microsoft Corporation. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#include <GoogleTest/Protocol/MockSmmVarCheck.h> | ||
|
||
MOCK_INTERFACE_DEFINITION (MockSmmVarCheck); | ||
MOCK_FUNCTION_DEFINITION (MockSmmVarCheck, SmmRegisterSetVariableCheckHandler, 1, EFIAPI); | ||
|
||
EDKII_SMM_VAR_CHECK_PROTOCOL SMMVARCHECK_PROTOCOL_INSTANCE = { | ||
SmmRegisterSetVariableCheckHandler, // EFI_MM_READ_SAVE_STATE | ||
NULL, // EDKII_VAR_CHECK_VARIABLE_PROPERTY_SET | ||
NULL // EDKII_VAR_CHECK_VARIABLE_PROPERTY_GET | ||
}; | ||
|
||
extern "C" { | ||
EDKII_SMM_VAR_CHECK_PROTOCOL *gEdkiiSmmVarCheckProtocol = &SMMVARCHECK_PROTOCOL_INSTANCE; | ||
} |