Relanding https://codereview.chromium.org/564553002/ with fixes for the unit test...