Who has the right of way where a pedestrian is crossing while a traffic signal changes?

Driving Test Canada Test 5 - Who has the right of way where a pedestrian is crossing while a traffic signal changes?