Discussed in Harry Potter and the Methods of Rationality. Harry explains that, in a true Prisoner's dilemma, you want to figure out how the other prisoner is going to react—if the prisoner is different enough to act opposite to you, then you rat him/her out. If not, you don't—knowing full well that the other person like you will come to the same conclusion, which is the only reason you're silent in the first place.
I want you to see that my reasons for doing this are not selfish, only this: I'd hope that you would do the same for me.
In Starship Troopers, a marine is snatched by a flying Arachnid, which begins to dismember him alive. Lt. Rasczak, his CO, grabs a sniper rifle and shoots him through the heart. He then turns to the remaining marines and says gravely: "And I expect anyone to do the same for me." Rico later does.Fridge Logic kicks in when you consider that Rasczak could have at least tried shooting the Arachnid first.
Worth noting that this is exactly the opposite of the book's philosophy, which is all about No One Gets Left Behind. The lieutenant's death, in fact, comes when he's making sure every last one of his troopers, dead or alive, is evacuated from a battle.
This trope happens in The Simpsons Movie, as Ned is saving them from the mob. He starts to tell Bart that Homer would do the same thing, but a glaring look from Bart causes him to backtrack.
Lampshaded in The Perfect Storm. As a long line is being played out of the fishing vessel, a hook snags one of the crew and he gets yanked into the sea; a crewmember he'd quarreled with earlier dives in and saves his life. He's too upset to thank the man at this time and snaps, "I'd have done the same for you — isn't that what I'm supposed to say?"
In William King's Warhammer 40,000 novel Space Wolf, after Ragnar comes to Kjel's aid when two other aspirants are beating him, Kjel thanks him, and Ragnar dismisses it, "Think nothing of it. You'd do the same for me."
"I'm sure if the situation were reversed, you'd do exactly the same for me."
In one episode of Everybody Hates Chris, Chris abandons his Homecoming date to help Greg. Greg doesn't feel to good about it, because Chris' date will hate him forever. Chris doesn't care about that, and says that Greg would do the same for him; Narrator Chris notes that years later, when the situation came up, he didn't.
"I would be dead if not for you. You risked your life to save mine."
"You would have done the same."
"Yes, but I'm a better person."
Firefly: When Mal is held hostage, Kaylee says to Zoe, "If it were any one of us, captain wouldn't hesitate." As she's arming up with Simon and Book.
In an episode of CSI: Crime Scene Investigation, a guy steals his recently deceased friend's corpse from an ambulance so he can "attend" one last party with him and other friends. Once the police shows up and informs him that he's going to jail for this he calmly replies "He would have done it for me".
Captain Horatio Hornblower R.N.: In "The Duchess and the Devil", Horatio ends up in Spanish jail, and by some incredible chance, his friend Archie from his ship who was lost during a raid happens to be imprisoned there as well. Archie's health and spirits are broken, and seeing his friend as a self-assured Acting Lieutenant is the last straw. He tries to starve himself so that they could plan their escape and not consider him or wait for him to get better. When Horatio notices, Archie refuses to get helped. It's a very poignant scene when Horatio insists that Archie would do the same for him, but Archie refutes by telling him that he would never be in his position, feeling that Horatio never screws up.
Horatio: You'd do the same for me if I were in your shoes.
Archie: But you're not. And you never would be.
Rampant in the Stargate Verse, what with the True Companions constantly getting themselves into trouble. A particularly heartwarming example occurs in Stargate Atlantis after Sheppard mounts a daring rescue to save Teyla and her newborn baby.
Teyla: I never gave up hope because I knew. I knew that you would come for me, John.
On The Simpsons, when Homer asks why Ned's helping him, and Ned says that Homer would do the same. Cue Imagine Spot of Homer not helping Ned in any way, shape or form. Homer confirms anyway.
In the Futurama episode "Jurassic Bark", a jealous Bender has tossed Fry's fossilized pooch Seymore into a lava pit. Despite fact that it's a lava pit, he strips down to his tighty-whities and rushes to save his old friend. His reasoning? "He'd do the same for me!"