Fixed tests, refactored chrome.py to be more testable