Apply pull request #525, fixes tests, and fix a pending TODO

R=jmesserly@google.com

Review URL: https://chromiumcodereview.appspot.com//15810005