Fix WebEngineContext not being ramped down in tests

aboutToQuit is only emitted if QCoreApplication::exec is run, which
isn't used by Qt's testlib.

Register an application shutdown handler using qAddPostRoutine
instead, which is going to be executed whenever the QCoreApplication
is destroyed.

Change-Id: Iec7d1e528dce79cbe7a73b450b2a0d2df793038a
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Fix the new window crash

Task-number: QTBUG-36472
Change-Id: I60267d6b9e2e99b20ddf604a0d6b0d8f2c8f1b27
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Fix resizing not working on new windows

We have to re-run initialize on attached WebContentsAdapter to update
the client. We currently however initialize the renderer
inconditionally at the end if the initialization, which in this case
would create an extra RenderWidgetHostView and keep the old one in
limbo.

Fix the issue by checking if the WebContents already has a live view
before forcing the creation of a new one.

Change-Id: Icfdbde016f9a49bfad643286881a6e409c958e94
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Reviewed-by: Adam Kallai <kadam@inf.u-szeged.hu>