mirror of https://github.com/acidanthera/audk.git
SecurityPkg: Apply uncrustify formatting to relevant files
Apply uncrustify formatting to GoogleTest cpp and header files. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Vivian Nowka-Keane <vnowkakeane@linux.microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
parent
716a3292e0
commit
a00f7a355a
|
@ -26,7 +26,10 @@ class SetSecureBootModeTest : public Test {
|
|||
UINT8 SecureBootMode;
|
||||
EFI_STATUS Status;
|
||||
|
||||
void SetUp() override {
|
||||
void
|
||||
SetUp (
|
||||
) override
|
||||
{
|
||||
// Any random magic number can be used for these tests
|
||||
SecureBootMode = 0xAB;
|
||||
}
|
||||
|
@ -46,13 +49,16 @@ TEST_F(SetSecureBootModeTest, SetVarError) {
|
|||
// expected secure boot mode is written to the correct variable in the call
|
||||
// to gRT->SetVariable().
|
||||
TEST_F (SetSecureBootModeTest, PropogateModeToSetVar) {
|
||||
EXPECT_CALL(RtServicesMock,
|
||||
EXPECT_CALL (
|
||||
RtServicesMock,
|
||||
gRT_SetVariable (
|
||||
Char16StrEq (EFI_CUSTOM_MODE_NAME),
|
||||
BufferEq (&gEfiCustomModeEnableGuid, sizeof (EFI_GUID)),
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof (SecureBootMode),
|
||||
BufferEq(&SecureBootMode, sizeof(SecureBootMode))))
|
||||
BufferEq (&SecureBootMode, sizeof (SecureBootMode))
|
||||
)
|
||||
)
|
||||
.WillOnce (Return (EFI_SUCCESS));
|
||||
|
||||
Status = SetSecureBootMode (SecureBootMode);
|
||||
|
@ -67,7 +73,10 @@ class GetSetupModeTest : public Test {
|
|||
EFI_STATUS Status;
|
||||
UINT8 ExpSetupMode;
|
||||
|
||||
void SetUp() override {
|
||||
void
|
||||
SetUp (
|
||||
) override
|
||||
{
|
||||
// Any random magic number can be used for these tests
|
||||
ExpSetupMode = 0xAB;
|
||||
}
|
||||
|
@ -87,17 +96,23 @@ TEST_F(GetSetupModeTest, GetVarError) {
|
|||
// setup mode is returned (and with a success return code) when the mode is
|
||||
// successfully read from the call to gRT->GetVariable().
|
||||
TEST_F (GetSetupModeTest, FetchModeFromGetVar) {
|
||||
EXPECT_CALL(RtServicesMock,
|
||||
EXPECT_CALL (
|
||||
RtServicesMock,
|
||||
gRT_GetVariable (
|
||||
Char16StrEq (EFI_SETUP_MODE_NAME),
|
||||
BufferEq (&gEfiGlobalVariableGuid, sizeof (EFI_GUID)),
|
||||
_,
|
||||
Pointee (Eq (sizeof (SetupMode))),
|
||||
NotNull()))
|
||||
.WillOnce(DoAll(
|
||||
NotNull ()
|
||||
)
|
||||
)
|
||||
.WillOnce (
|
||||
DoAll (
|
||||
SetArgPointee<3>(sizeof (ExpSetupMode)),
|
||||
SetArgBuffer<4>(&ExpSetupMode, sizeof (ExpSetupMode)),
|
||||
Return(EFI_SUCCESS)));
|
||||
Return (EFI_SUCCESS)
|
||||
)
|
||||
);
|
||||
|
||||
Status = GetSetupMode (&SetupMode);
|
||||
ASSERT_EQ (Status, EFI_SUCCESS);
|
||||
|
@ -126,7 +141,10 @@ class IsSecureBootEnabledAllocTest : public IsSecureBootEnabledTest {
|
|||
protected:
|
||||
UINT8 *BootEnabledBuffer;
|
||||
|
||||
void SetUp() override {
|
||||
void
|
||||
SetUp (
|
||||
) override
|
||||
{
|
||||
BootEnabledBuffer = (UINT8 *)AllocatePool (1);
|
||||
ASSERT_NE (BootEnabledBuffer, nullptr);
|
||||
}
|
||||
|
@ -137,14 +155,20 @@ class IsSecureBootEnabledAllocTest : public IsSecureBootEnabledTest {
|
|||
// returns SECURE_BOOT_MODE_ENABLE.
|
||||
TEST_F (IsSecureBootEnabledAllocTest, IsEnabled) {
|
||||
*BootEnabledBuffer = SECURE_BOOT_MODE_ENABLE;
|
||||
EXPECT_CALL(UefiLibMock,
|
||||
EXPECT_CALL (
|
||||
UefiLibMock,
|
||||
GetEfiGlobalVariable2 (
|
||||
Char16StrEq (EFI_SECURE_BOOT_MODE_NAME),
|
||||
NotNull (),
|
||||
_))
|
||||
.WillOnce(DoAll(
|
||||
_
|
||||
)
|
||||
)
|
||||
.WillOnce (
|
||||
DoAll (
|
||||
SetArgBuffer<1>(&BootEnabledBuffer, sizeof (VOID *)),
|
||||
Return(EFI_SUCCESS)));
|
||||
Return (EFI_SUCCESS)
|
||||
)
|
||||
);
|
||||
|
||||
Enabled = IsSecureBootEnabled ();
|
||||
EXPECT_EQ (Enabled, TRUE);
|
||||
|
@ -155,20 +179,31 @@ TEST_F(IsSecureBootEnabledAllocTest, IsEnabled) {
|
|||
// returns SECURE_BOOT_MODE_DISABLE.
|
||||
TEST_F (IsSecureBootEnabledAllocTest, IsDisabled) {
|
||||
*BootEnabledBuffer = SECURE_BOOT_MODE_DISABLE;
|
||||
EXPECT_CALL(UefiLibMock,
|
||||
EXPECT_CALL (
|
||||
UefiLibMock,
|
||||
GetEfiGlobalVariable2 (
|
||||
Char16StrEq (EFI_SECURE_BOOT_MODE_NAME),
|
||||
NotNull (),
|
||||
_))
|
||||
.WillOnce(DoAll(
|
||||
_
|
||||
)
|
||||
)
|
||||
.WillOnce (
|
||||
DoAll (
|
||||
SetArgBuffer<1>(&BootEnabledBuffer, sizeof (VOID *)),
|
||||
Return(EFI_SUCCESS)));
|
||||
Return (EFI_SUCCESS)
|
||||
)
|
||||
);
|
||||
|
||||
Enabled = IsSecureBootEnabled ();
|
||||
EXPECT_EQ (Enabled, FALSE);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
int
|
||||
main (
|
||||
int argc,
|
||||
char *argv[]
|
||||
)
|
||||
{
|
||||
testing::InitGoogleTest (&argc, argv);
|
||||
return RUN_ALL_TESTS ();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue