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: I296e0dd5f2bb2f294642195f5c9ac1418db3e63a