Simplify unit test detection and design mode detection.

Remove old platform directives.
Move UnitTestDetector and DesignModeDetector to their own files.