Preheat oven to 350°F. Spray two shiny 9-inch cake pans with flour-added cooking spray or grease and flour using your favorite method.
Whisk together the flour, sugar, brown sugar, cocoa powder, baking powder and salt. Set aside.
Heat the Dr Pepper in a small saucepan over medium. When it starts to bubble, reduce heat to low, add the chocolate chips and stir until melted. Turn off the heat and stir in the butter. Set aside to cool for about10 minutes.
With an electric mixer on low speed, beat the eggs, buttermilk, oil and vanilla for 2 minutes. At lowest speed (or use a whisk if you prefer), slowly add the Dr Pepper mixture and beat for 1 additional minute. Gradually add the dry ingredients (flour mixture), and beat until smooth by hand or using medium to low speed of mixer.
Divide the batter evenly between the prepared pans, and bake for 30 to 38 (mine took 38) minutes, or until a toothpick comes out clean. Cool in pans for 15 minutes, then invert onto cooling racks, lift off pans and allow to cool completely before frosting. The frosting requires cooling time, so you may want to get started on that right away.
For the frosting, off the heat, combine the sugar, flour and cocoa in a small saucepan. Gradually add milk and whisk until smooth.
Put the mixture over medium heat and cook, whisking constantly, until mixture thickens and boils. Reduce heat to low, cook 2 minutes, whisking all the while. Remove saucepan from heat; cool completely. This cooling period should take 40 minutes to an hour.
In a large bowl with mixer at medium speed, beat softened butter until creamy. Gradually beat in cooled milk mixture, vanilla and melted chocolate. Note: If you do all the steps above and get a gooey mess, it's probably because something was too warm. I've done this a couple of times in the past and the fix is to beat in the chocolate as directed, but put bowl in refrigerator for 30-40 minutes to chill. The chilled mixture will whip up into a delicious, silky frosting.