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.
9 <title>All TVCM Tests</title>
10 <script src="/tvcm/__init__.js"></script>
11 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
12 <link rel="shortcut icon" href="data:image/x-icon;base64," type="image/x-icon">
15 box-sizing: border-box;
21 body > x-base-interactive-test-runner {
30 tvcm.require('tvcm.unittest');
31 tvcm.require('tvcm.unittest.interactive_test_runner');
35 function loadAndRunTests() {
36 var loader = new tvcm.unittest.SuiteLoader();
37 return loader.allSuitesLoadedPromise.then(function() {
38 var results = new tvcm.unittest.InteractiveTestRunner();
39 results.testLinks = loader.testLinks;
40 results.allTests = loader.getAllTests();
41 document.body.appendChild(results);
43 results.setState(stateFromSearchString(
44 window.location.search.substring(1)));
46 function stateToSearchString(defaultState, state) {
48 for (var k in state) {
49 if (state[k] === defaultState[k])
55 } else if (v === false) {
57 } else if (v === '') {
65 return parts.join('&');
68 function stateFromSearchString(string) {
70 string.split('&').forEach(function(part) {
73 var kv = part.split('=');
90 results.addEventListener('statechange', function() {
92 var state = results.getState();
93 var stateString = stateToSearchString(results.getDefaultState(),
95 if (window.location.search == stateString)
98 if (stateString.length > 0)
99 stateURL = window.location.pathname + '?' + stateString;
101 stateURL = window.location.pathname;
102 window.history.pushState(state, document.title, stateURL);
105 window.addEventListener('popstate', function(state) {
106 results.setState(state);
109 results.getHRefForTestCase = function(testCase) {
110 var state = results.getState();
111 state.testFilterString = testCase.fullyQualifiedName;
112 state.shortFormat = false;
114 var stateString = stateToSearchString(results.getDefaultState(),
116 if (stateString.length > 0)
117 return window.location.pathname + '?' + stateString;
119 return window.location.pathname;
124 window.addEventListener('load', loadAndRunTests);