LOS ANGELES—A California court case could turn every cup of coffee here into a jolt of reality on the risks of cancer.

Under a state law, cancer warnings already follow Californians when they enter the lobby of apartment buildings, drive into parking garages and sit down at restaurants. They also pop up on products including kitty litter, ceramic plates and black licorice.

Now,...