Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Side by Side Diff: chrome/browser/resources/net_internals/testview.js

Issue 7531005: Rename the net_internals file names to include hyphens. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Add some missing files Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * This view displays the progress and results from the "connection tester".
7 *
8 * - Has an input box to specify the URL.
9 * - Has a button to start running the tests.
10 * - Shows the set of experiments that have been run so far, and their
11 * result.
12 *
13 * @constructor
14 */
15 function TestView() {
16 const mainBoxId = 'testTabContent';
17 const urlInputId = 'testUrlInput';
18 const formId = 'connectionTestsForm';
19 const summaryDivId = 'testSummary';
20
21 DivView.call(this, mainBoxId);
22
23 this.urlInput_ = $(urlInputId);
24 this.summaryDiv_ = $(summaryDivId);
25
26 var form = $(formId);
27 form.addEventListener('submit', this.onSubmitForm_.bind(this), false);
28
29 g_browser.addConnectionTestsObserver(this);
30 }
31
32 inherits(TestView, DivView);
33
34 TestView.prototype.onSubmitForm_ = function(event) {
35 g_browser.sendStartConnectionTests(this.urlInput_.value);
36 event.preventDefault();
37 };
38
39 /**
40 * Callback for when the connection tests have begun.
41 */
42 TestView.prototype.onStartedConnectionTestSuite = function() {
43 this.summaryDiv_.innerHTML = '';
44
45 var p = addNode(this.summaryDiv_, 'p');
46 addTextNode(p, 'Started connection test suite suite on ' +
47 (new Date()).toLocaleString());
48
49 // Add a table that will hold the individual test results.
50 var table = addNode(this.summaryDiv_, 'table');
51 table.className = 'styledTable';
52 var thead = addNode(table, 'thead');
53 thead.innerHTML = '<tr><th>Result</th><th>Experiment</th>' +
54 '<th>Error</th><th>Time (ms)</th></tr>';
55
56 this.tbody_ = addNode(table, 'tbody');
57 };
58
59 /**
60 * Callback for when an individual test in the suite has begun.
61 */
62 TestView.prototype.onStartedConnectionTestExperiment = function(experiment) {
63 var tr = addNode(this.tbody_, 'tr');
64
65 var passFailCell = addNode(tr, 'td');
66
67 var experimentCell = addNode(tr, 'td');
68
69 var resultCell = addNode(tr, 'td');
70 addTextNode(resultCell, '?');
71
72 var dtCell = addNode(tr, 'td');
73 addTextNode(dtCell, '?');
74
75 // We will fill in result cells with actual values (to replace the
76 // placeholder '?') once the test has completed. For now we just
77 // save references to these cells.
78 this.currentExperimentRow_ = {
79 experimentCell: experimentCell,
80 dtCell: dtCell,
81 resultCell: resultCell,
82 passFailCell: passFailCell,
83 startTime: (new Date()).getTime()
84 };
85
86 addTextNode(experimentCell, 'Fetch ' + experiment.url);
87
88 if (experiment.proxy_settings_experiment ||
89 experiment.host_resolver_experiment) {
90 var ul = addNode(experimentCell, 'ul');
91
92 if (experiment.proxy_settings_experiment) {
93 var li = addNode(ul, 'li');
94 addTextNode(li, experiment.proxy_settings_experiment);
95 }
96
97 if (experiment.host_resolver_experiment) {
98 var li = addNode(ul, 'li');
99 addTextNode(li, experiment.host_resolver_experiment);
100 }
101 }
102 };
103
104 /**
105 * Callback for when an individual test in the suite has finished.
106 */
107 TestView.prototype.onCompletedConnectionTestExperiment = function(
108 experiment, result) {
109 var r = this.currentExperimentRow_;
110
111 var endTime = (new Date()).getTime();
112
113 r.dtCell.innerHTML = '';
114 addTextNode(r.dtCell, (endTime - r.startTime));
115
116 r.resultCell.innerHTML = '';
117
118 if (result == 0) {
119 r.passFailCell.style.color = 'green';
120 addTextNode(r.passFailCell, 'PASS');
121 } else {
122 // TODO(eroman): stringize the error code.
123 addTextNode(r.resultCell, result);
124 r.passFailCell.style.color = 'red';
125 addTextNode(r.passFailCell, 'FAIL');
126 }
127
128 this.currentExperimentRow_ = null;
129 };
130
131 /**
132 * Callback for when the last test in the suite has finished.
133 */
134 TestView.prototype.onCompletedConnectionTestSuite = function() {
135 var p = addNode(this.summaryDiv_, 'p');
136 addTextNode(p, 'Completed connection test suite suite');
137 };
138
OLDNEW
« no previous file with comments | « chrome/browser/resources/net_internals/test_view.js ('k') | chrome/browser/resources/net_internals/timeline_view_painter.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698