@@ -573,19 +573,33 @@ Item {
573573 compare(topLevelSurfaceList.count, 1);
574574 }
575575
576+ function test_launchAppWithSpreadOpen_data() {
577+ return [
578+ { tag: "expected", expected: true },
579+ { tag: "unexpected", expected: false },
580+ ];
581+ }
576582
577583 /*
578584 Check that when an application starts while the spread is open, the
579585 spread closes and that new app is brought to front (gets focused).
586+
587+ "Expected" means the app is started from the launcher or the spread,
588+ where TLWM's pendingActivation() will be called. "Unexpected" means
589+ the app is launched from outside, such as from the command line.
580590 */
581− function test_launchAppWithSpreadOpen()
591+ function test_launchAppWithSpreadOpen(data)
582592 {
583593 performEdgeSwipeToShowAppSpread();
584594
595+ if (data.expected)
596+ topLevelSurfaceList.pendingActivation();
597+
585598 var webbrowserSurfaceId = topLevelSurfaceList.nextId;
586599 var webbrowserApp = ApplicationManager.startApplication("morph-browser");
587600 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
588601
602+ expectFail(/* tag */ "unexpected", "Surprise launch doesn't work properly yet");
589603 compare(topLevelSurfaceList.idAt(0), webbrowserSurfaceId);
590604 compare(webbrowserApp.focused, true);
591605 }