I read it somewhere, I forget where, so i tested it by taking an Eevee, fainting it, carrying it in my party fainted for an hour, then revived it, used rare candy to level up, and it didnt evolve. so it didnt gain friendship while fainted (or maybe it did and gained very little? but i dont know how to test that)