In a medium saucepan, whisk together sugar, cornstarch, cocoa and salt until combined. Whisk in milk until well blended.
Heat mixture to boiling over medium heat, whisking constantly, until mixture thickens slightly, 10-15 minutes. Remove from heat and whisk in chocolate and vanilla until smooth.
Transfer chocolate pudding to a medium bowl. Cover with plastic wrap, touching the surface pudding so that it doesn't allow a film to settle on top. Refrigerate for at least two hours or overnight.
Once pudding is cold, alternate layering pudding with Cool Whip in individual serving glasses. Top with fresh berries, if desired.