Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MockVariablePolicyHelperLib #1238

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MdeModulePkg/Test/MdeModulePkgHostTest.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,4 @@
MdeModulePkg/Test/Mock/Library/GoogleTest/MockCapsuleLib/MockCapsuleLib.inf
MdeModulePkg/Test/Mock/Library/GoogleTest/MockUefiBootManagerLib/MockUefiBootManagerLib.inf
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPlatformHookLib/MockPlatformHookLib.inf
MdeModulePkg/Test/Mock/Library/GoogleTest/MockVariablePolicyHelperLib/MockVariablePolicyHelperLib.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/** @file MockVariablePolicyHelper.h
Google Test mocks for VariablePolicyHelper

Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef MOCK_VARIABLE_POLICY_HELPER_LIB_H_
#define MOCK_VARIABLE_POLICY_HELPER_LIB_H_

#include <Library/GoogleTestLib.h>
#include <Library/FunctionMockLib.h>
extern "C" {
#include <Uefi.h>
#include <Protocol/VariablePolicy.h>
}

//
// Declarations to handle usage of the VariablePolicyHelperLib by creating mock
//
struct MockVariablePolicyHelperLib {
MOCK_INTERFACE_DECLARATION (MockVariablePolicyHelperLib);

MOCK_FUNCTION_DECLARATION (
EFI_STATUS,
RegisterBasicVariablePolicy,
(IN EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy,
IN CONST EFI_GUID *Namespace,
IN CONST CHAR16 *Name OPTIONAL,
IN UINT32 MinSize,
IN UINT32 MaxSize,
IN UINT32 AttributesMustHave,
IN UINT32 AttributesCantHave,
IN UINT8 LockPolicyType)
);
};

#endif
kanechen66 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @file MockVariablePolicyHelperLib.cpp
Google Test mocks for VariablePolicyHelperLib

Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#include <GoogleTest/Library/MockVariablePolicyHelperLib.h>

MOCK_INTERFACE_DEFINITION (MockVariablePolicyHelperLib);
MOCK_FUNCTION_DEFINITION (MockVariablePolicyHelperLib, RegisterBasicVariablePolicy, 8, EFIAPI);
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## @file MockVariablePolicyHelperLib.inf
# Mock Variable Policy Library implementation.
#
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

[Defines]
INF_VERSION = 0x00010005
BASE_NAME = MockVariablePolicyHelperLib
FILE_GUID = 251633CE-1FE7-4500-BF0A-CF3B2B52B9EE
MODULE_TYPE = HOST_APPLICATION
VERSION_STRING = 1.0
LIBRARY_CLASS = VariablePolicyHelperLib
PI_SPECIFICATION_VERSION = 0x0001000A

#
# VALID_ARCHITECTURES = IA32 X64
#

[Sources]
MockVariablePolicyHelperLib.cpp

[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec

[LibraryClasses]
GoogleTestLib

[BuildOptions]
MSFT:*_*_*_CC_FLAGS = /EHsc
Loading