$(document).ready(function() {
  $('#run').click(function() {
    runTest();
  });
});

var testWin;
var testOutput = {
  userAgent: navigator.userAgent,
  tests: []
};

function runTest() {
  if (!testList.length) {
    $('#content').text(JSON.stringify(testOutput, undefined, 2));
    testWin.close();
  } else {
    var test = testList.shift(),
        root = location.href.replace(/\/([^\/]*?\.[^\/]*?)?$/, '');
    testWin = window.open(root + '/' + test, 'device-size-check-test');
  }
}
function testComplete(testInfo) {
  console.log('testComplete: ' + testInfo.name);
  testOutput.tests.push(testInfo);
  runTest();
}

$(document).ready(function() {
  $('#run').click(function() {
    runTest();
  });
});

var testWin;
var testOutput = {};

function runTest() {
  if (!testList.length) {
    $('#content').text(JSON.stringify({
        userAgent: navigator.userAgent,
        test: testOutput
      }, undefined, 2));
    testWin.close();
  } else {
    var test = testList.shift(),
        root = location.href.replace(/\/([^\/]*?\.[^\/]*?)?$/, '');
    testWin = window.open(root + '/' + test, 'device-size-check-test');
  }
}
function testComplete(testInfo) {
  console.log('testComplete: ' + testInfo.name);
  testOutput[testInfo.name] = testInfo;
  runTest();
}

Convert test data collection to structure
Convert test data collection to structure