What does "when the chips are down" mean? and is it common phrase?

Native speaker’s answer
Rebecca
"When the chips are down" means "when a difficult situation occurs / when something bad happens". Ex: When the chips are down, try not to get depressed or give up. Keep smiling and do the best that you can. Ex: Your real friends will never leave you, even when the chips are down.