We could use unit tests for these two functions.
https://code.google.com/p/chromium/issues/detail?id=231369