```
function onLaunchedEventTest(resolve) {
  xwalk.app.runtime.onLaunched.addListener(function() {
    xwalk.app.test.notifyPass(function() {
      entryWindow = window.open("index.html");
      resolve();
    });
  });
}

function onSuspendEventTest(resolve) {
  xwalk.app.runtime.onSuspend.addListener(function() {
    xwalk.app.test.notifyPass();
  });
  entryWindow.close();
}

var tests = [
   onLauchedEventTest,
   onSuspendEventTest,
];
```
Maybe a test like above is better. The onLaunchedEventTest can get test result directly; onSuspendEventTest can keep the window handling logic in JS. WDYT?