A Toronto police officer was shot while investigating an apartment linked to a March attack on the US consulate.