This is a great question. It is also one of the tough ones to answer because there are so many moving parts to it. I think you can get some ideas to it here, but in terms of a "final answer," it might be a bit difficult to ascertain, in general, because of the complexity of the question.
In terms of assessing how Gandhi's campaign could have fared against brutal regimes such as the ones led by Hitler and Stalin, I think that Gandhi would have zealously have said that it would have. Infact, I think that Gandhi would have argued that the worse the regime, the greater the need to awaken individual conscience in moving towards what should be as opposed to what is. Gandhi's spiritual focus in his Satyagraha movement is not contingent on particular regimes. Rather, it is focused on restoring moral goodness to a setting where it is absent. The greater the lack of spiritual redemption, the greater the need for the movement to happen. I cannot see Gandhi's zeal and belief in his cause dissipating in the face of Hitler and Stalin. Rather, I think he would have doubled down his attempts.
With this in mind, I think that we would have to make clear that while the British occupation of India and their attempts to subjugate Indians was morally unacceptable and politically wrong, it is nowhere on the level of Hitler's advocacy of the Holocaust and Stalin's purges. This certainly must be taken into account. It is difficult to ascertain how the Satyagraha movement would have worked in such settings, contexts where something like Gandhi's movement would have been sorely needed. The reality that I think even Gandhi would concede is that while the British stood and watched the movement unfold, uncertain of its success, Hitler and Stalin would have simply slaughtered the leaders of such movements. They would not have given it a second thought, whereas the British did feel that Gandhi should not be killed. Yet, this is exactly where Gandhi would have asserted that the idea of seeking to raise moral conscience and righteousness is sorely needed. He would have insisted that more people join him, so that if he were to be killed, the movement would continue on and the hopes of spiritual redemption recognized in this life could be evident. It is difficult to ascertain whether this would have "worked" because a large scale Gandhian movement in Stalin's context or Hitler's setting was not realized. In this light, one has to look at what Gandhi himself would have felt. Accordingly, I think that he would have asserted that the greater the threat, the greater the need for civil disobedience through active resistance and non- violence would be warranted.
No, Gandhi's non-violent protest would not have worked in pre-WWII Germany or Russia when Stalin was the leader simply because of the vast difference between the objectives of the leadership. Both Stalin and Hitler wanted to create totalitarian dictatorships, whereas England mainly sought to retain control of a colony slipping away. Stalin and Hitler would have used any means necessary to eliminate dissent in their country (and did). As suggested by events like "Night of the Long Knives" and Stalin's purges, the leaders of Germany and Russia would have violently suppressed Gandhi's attempts at civil obedience. Although his death would have had a martyr-like impact and probably inspire more followers to his cause, I personally do not believe that non-violent protest could have a chance against such malice. They would be quickly wiped out. It would be like bringing a butter knife to a nuclear stand-off.