1 <!DOCTYPE html> 2 <html> 3 <!-- 4 Copyright (c) 2013 The Chromium Authors. All rights reserved. 5 Use of this source code is governed by a BSD-style license that can be 6 found in the LICENSE file. 7 --> 8 <head> 9 <title>All Tracing Tests</title> 10 <script src="/src/base.js"></script> 11 <script> 12 base.require('base.unittest'); 13 base.require('base.settings'); 14 </script> 15 <link rel="shortcut icon" href="data:image/x-icon;base64," type="image/x-icon"> 16 <script> 17 function getAsync(url, cb) { 18 var req = new XMLHttpRequest(); 19 req.open('GET', url, true); 20 req.onreadystatechange = function(aEvt) { 21 if (req.readyState == 4) { 22 window.setTimeout(function() { 23 if (req.status == 200) { 24 cb(req.responseText); 25 } else { 26 console.log('Failed to load ' + url); 27 } 28 }, 0); 29 } 30 }; 31 req.send(null); 32 } 33 34 function launchTests() { 35 var stats = document.getElementById('stats'); 36 37 var suite = undefined; 38 var tests = []; 39 40 // Note, this is nieve, but works for our purposes. Would explode on 41 // encoded &'s. 42 var queryParams = window.location.search.substring(1).split('&'); 43 queryParams.forEach(function(param) { 44 var parts = param.split('='); 45 if (parts[0] === 'suite') 46 suite = parts[1]; 47 else if (parts[0] === 'test') 48 tests.push(parts[1]); 49 }); 50 51 if (suite !== undefined) { 52 base.unittest.Suites(['/src/' + suite + '_test.js'], tests); 53 } else { 54 getAsync('/json/tests', function(data) { 55 base.unittest.Suites(JSON.parse(data), tests); 56 }); 57 } 58 } 59 60 function launchTestsIfAvailable() { 61 if (base.unittest === undefined || 62 base.unittest.showCondensed === undefined) { 63 window.setTimeout(launchTestsIfAvailable, 100); 64 return; 65 } 66 67 var format = document.getElementById('short-format'); 68 format.checked = localStorage.getItem('testing::short-format') === 'true'; 69 format.addEventListener('click', function(ev) { 70 localStorage.setItem('testing::short-format', ev.target.checked); 71 base.unittest.showCondensed(ev.target.checked); 72 base.unittest.runSuites(); 73 }); 74 base.unittest.showCondensed(format.checked); 75 76 launchTests(); 77 } 78 79 document.addEventListener('DOMContentLoaded', function() { 80 launchTestsIfAvailable(); 81 }); 82 83 </script> 84 </head> 85 86 <body id="test-harness"> 87 <h1><a href='/src/tests.html'>Trace-Viewer Tests</a></h1> 88 89 <div id="stats"> 90 <br /> 91 </div> 92 93 <div id='individual-tests'> 94 <div class="unittest"> 95 View a trace file: 96 <a href="/examples/trace_viewer.html" 97 class="unittest-error-link">Trace viewer</a> 98 </div> 99 <div class="unittest"> 100 Record Selection Interactive Tests: 101 <a href="/src/tracing/record_selection_dialog_interactive_tests.html" 102 class="unittest-error-link">Run manually</a> 103 </div> 104 short format <input type='checkbox' id='short-format' /> 105 </div> 106 107 <div id='messages'> 108 <h1>Warning</h1> 109 <ul id='message-list'></ul> 110 </div> 111 112 <div id='test-results'> 113 </div> 114 115 <div id='exceptions'> 116 <h1>Exceptions</h1> 117 <ol id="exception-list"></ol> 118 </div> 119 </body> 120 </html> 121