I don't know that there is a definitive answer. Personally, I like to the think that it was not a dream. I like this interpretation because it helps reveal the dual nature of humanity. We are not strictly good, as Brown certainly thinks he is as he leaves Faith behind. We all have the potential for evil in our natures. I like how this is revealed to Brown by the devil. Not only does he learn that his lineage is not so saintly as he would like to think, but he also realizes that his peers are not as pious as he would like to believe. However, Brown appears to ultimately pass the very test he set out to in the beginning. He does not seem to abandon his faith, for at the very moment when he and Faith are about to take communion into the black mass, he tells her not to give in and to look heavenward. It is at this moment that he passes the test; he proves his faith, though it has been severely shaken.