summaryrefslogtreecommitdiff
path: root/MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiBootServicesTableLib.h
blob: c94a9a9f49043796d5880a252174ee820cd7b92b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/** @file
  Google Test mocks for UefiBootServicesTableLib

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

#pragma once

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

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

  MOCK_FUNCTION_DECLARATION (
    EFI_STATUS,
    gBS_GetMemoryMap,
    (IN OUT UINTN                 *MemoryMapSize,
     OUT    EFI_MEMORY_DESCRIPTOR *MemoryMap,
     OUT    UINTN                 *MapKey,
     OUT    UINTN                 *DescriptorSize,
     OUT    UINT32                *DescriptorVersion)
    );

  MOCK_FUNCTION_DECLARATION (
    EFI_STATUS,
    gBS_CreateEvent,
    (IN  UINT32           Type,
     IN  EFI_TPL          NotifyTpl,
     IN  EFI_EVENT_NOTIFY NotifyFunction,
     IN  VOID             *NotifyContext,
     OUT EFI_EVENT        *Event)
    );

  MOCK_FUNCTION_DECLARATION (
    EFI_STATUS,
    gBS_CloseEvent,
    (IN EFI_EVENT Event)
    );

  MOCK_FUNCTION_DECLARATION (
    EFI_STATUS,
    gBS_HandleProtocol,
    (IN  EFI_HANDLE Handle,
     IN  EFI_GUID   *Protocol,
     OUT VOID       **Interface)
    );

  MOCK_FUNCTION_DECLARATION (
    EFI_STATUS,
    gBS_LocateProtocol,
    (IN  EFI_GUID *Protocol,
     IN  VOID      *Registration  OPTIONAL,
     OUT VOID      **Interface)
    );

  MOCK_FUNCTION_DECLARATION (
    EFI_STATUS,
    gBS_CreateEventEx,
    (IN UINT32            Type,
     IN EFI_TPL           NotifyTpl,
     IN EFI_EVENT_NOTIFY  NotifyFunction OPTIONAL,
     IN CONST VOID        *NotifyContext OPTIONAL,
     IN CONST EFI_GUID    *EventGroup OPTIONAL,
     OUT EFI_EVENT        *Event)
    );

  MOCK_FUNCTION_DECLARATION (
    EFI_STATUS,
    gBS_LocateDevicePath,
    (IN EFI_GUID                      *Protocol,
     IN OUT EFI_DEVICE_PATH_PROTOCOL  **DevicePath,
     OUT EFI_HANDLE                   *Device)
    );

  MOCK_FUNCTION_DECLARATION (
    EFI_STATUS,
    gBS_OpenProtocol,
    (IN  EFI_HANDLE  UserHandle,
     IN  EFI_GUID    *Protocol,
     OUT VOID        **Interface OPTIONAL,
     IN  EFI_HANDLE  ImageHandle,
     IN  EFI_HANDLE  ControllerHandle,
     IN  UINT32      Attributes)
    );

  MOCK_FUNCTION_DECLARATION (
    EFI_STATUS,
    gBS_CloseProtocol,
    (IN  EFI_HANDLE  UserHandle,
     IN  EFI_GUID    *Protocol,
     IN  EFI_HANDLE  AgentHandle,
     IN  EFI_HANDLE  ControllerHandle)
    );

  MOCK_FUNCTION_DECLARATION (
    EFI_STATUS,
    gBS_InstallConfigurationTable,
    (IN EFI_GUID  *Guid,
     IN VOID      *Table)
    );
};