-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: TsunFeng <[email protected]>
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
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,47 @@ | ||
/** @file MockIsaHc.h | ||
This file declares a mock of Isa Hc Protocol. | ||
Copyright (c) Microsoft Corporation. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef MOCK_ISA_HC_PROTOCOL_H | ||
#define MOCK_ISA_HC_PROTOCOL_H | ||
|
||
#include <Library/GoogleTestLib.h> | ||
#include <Library/FunctionMockLib.h> | ||
|
||
extern "C" { | ||
#include <Uefi.h> | ||
#include <Protocol/IsaHc.h> | ||
} | ||
|
||
struct MockIsaHcProtocol { | ||
MOCK_INTERFACE_DECLARATION (MockIsaHcProtocol); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
OpenIoAperture, | ||
( | ||
IN CONST EFI_ISA_HC_PROTOCOL *This, | ||
IN UINT16 IoAddress, | ||
IN UINT16 IoLength, | ||
OUT UINT64 *IoApertureHandle | ||
) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
CloseIoAperture, | ||
( | ||
IN CONST EFI_ISA_HC_PROTOCOL *This, | ||
IN UINT64 IoApertureHandle | ||
) | ||
); | ||
}; | ||
|
||
extern "C" { | ||
extern EFI_ISA_HC_PROTOCOL *gIsaHcProtocol; | ||
} | ||
|
||
#endif // MOCK_ISA_HC_PROTOCOL_H |
22 changes: 22 additions & 0 deletions
22
MdePkg/Test/Mock/Library/GoogleTest/Protocol/MockIsaHc.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,22 @@ | ||
/** @file MockIsaHc.cpp | ||
Google Test mock for Service Binding Protocol. | ||
Copyright (c) Microsoft Corporation. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#include <GoogleTest/Protocol/MockIsaHc.h> | ||
|
||
MOCK_INTERFACE_DEFINITION (MockIsaHcProtocol); | ||
MOCK_FUNCTION_DEFINITION (MockIsaHcProtocol, OpenIoAperture, 4, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockIsaHcProtocol, CloseIoAperture, 2, EFIAPI); | ||
|
||
EFI_ISA_HC_PROTOCOL ISA_HC_PROTOCOL_INSTANCE = { | ||
0, // UINT32 Version; | ||
OpenIoAperture, // EFI_ISA_HC_OPEN_IO OpenIoAperture; | ||
CloseIoAperture // EFI_ISA_HC_CLOSE_IO CloseIoAperture; | ||
}; | ||
|
||
extern "C" { | ||
EFI_ISA_HC_PROTOCOL *gIsaHcProtocol = &ISA_HC_PROTOCOL_INSTANCE; | ||
} |