Unit tests for DISCL-218 - Serialize and restore sessions.

Also added min and max limits to window dimensions. This prevents oversized windows
from crashing the application (seen with PDFs), or too small windows
from being unreachable.
done