Berachot 54a:

Mishnah: It is incumbent on a man to bless [G-d] for the evil in the same way as for the good, as it says, "And you shall love Hashem your G-d with all your heart," etc. (Devarim 6:5) 

'With all your heart,' means with your two impulses, the Evil Impulse as well as the Good Impulse.