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.

Change-Id: I9f77a3cb141db527bbde264c834c6e1c7cf564f7