Moved logic from chrome mock to unit tests.