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