In the code example CE95391, the button test is used in the Bootloader Project for the Bootloader to wait for the command from the host to start the Bootloader and load a new Bootloadable project. When the kit button is pressed which means it is short to ground, it puts the wait forever pin state to be at 0. In the bootloader project of this code example, the wait for command parameter is enabled for the bootloader component. The zero value for this command is interpreted as wait-forever. You can read the description for the 'wait for command time' parameter in the bootloader component's datasheet.
In short, when the kit button is kept pressed after the device reset, the bootloader waits for the command from the host till the button is pressed. Unlike this, the kit buttons used in the Bootloadable project is to switch between the Bootloadable project and the Bootloader project as you can find clearly under the 'Operation' section of the documentation here : https://www.cypress.com/documentation/code-examples/ce95391-psocr-usb-hid-bootloader
if((Wait_Forever_Read() == 0/*Pressed*/) || (BL_GET_RUN_TYPE == BL_START_BTLDR))
The above lines of code check any of the two conditions to be true before starting the bootloader component. The conditions are:
1. If the kit button is pressed after device reset and thus, wait forever pin is at state 0, it is waiting for the host to send commands.
2. If the PC host has already sent command i.e BL_START_BTLDR, the BL_SET_RUN_TYPE starts the bootloader component.
BL_GET_RUN_TYPE is a macro which basically decides how to proceed with the Bootloader Component.
Please go through the above explanation and let us know in case of further clarifications.