forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
results.html
2721 lines (2530 loc) · 93.8 KB
/
results.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<meta charset="UTF-8">
<title>Layout Tests</title>
<!--
Displays web_tests results.
-->
<style>
body {
font-family: sans-serif;
min-height: 120vh;
}
button {
margin-top: 4px;
}
input {
vertical-align: middle;
margin-top: 0;
margin-bottom: 0;
}
p, h2, h3, h4 {
margin: 8px 0 4px 0;
}
#right-toolbar {
position: absolute;
top: 8px;
right: 0;
font-size: smaller;
}
.good {
background-color: rgba(0, 255, 0, 0.1);
}
.bad {
background-color: rgba(255, 0, 0, 0.1);
}
.popup {
font-family: sans-serif;
box-sizing: border-box;
position: fixed;
width: 96vw;
height: 96vh;
top: 2vh;
left: 2vw;
border: 5px solid black;
background-color: white;
padding: 16px;
box-shadow: 0 0 20px;
overflow: auto;
z-index: 1;
}
#summary > p {
margin: 0.2em 0 0 0;
}
#dashboard {
user-select: none;
}
#report {
font-family: monospace;
}
#none {
color: green;
margin-left: 2em;
font-size: x-large;
font-weight: bold;
font-style: italic;
}
.fix-width {
display: inline-block;
width: 7em;
text-align: right;
margin-right: 1em;
}
.hidden {
display: none;
}
.warn {
color: red;
}
.h-expect {
margin-left: 1.25em;
}
.expect {
line-height: 200%;
cursor: zoom-in;
}
.expect:hover, .expect:focus {
background-color: #F4F4F4;
}
.expect:focus > .details {
visibility: visible;
}
.details {
box-sizing: border-box;
visibility: hidden;
display: inline-block;
position: relative;
top: 0.2em;
width: 1em;
height: 1em;
border-top: 0.5em solid transparent;
border-bottom: 0.5em solid transparent;
border-right: none;
border-left: 0.5em solid gray;
margin-right: .25em;
cursor: pointer;
}
.details.open {
visibility: visible !important;
top: 0.5em;
border-left: 0.5em solid transparent;
border-right: 0.5em solid transparent;
border-top: 0.5em solid gray;
border-bottom: none;
}
.result-frame {
border: 1px solid gray;
border-top: 1px solid transparent;
margin-left: 2.25em;
margin-right: 2.25em;
margin-top: 4px;
margin-bottom: 16px;
}
.result-menu {
list-style-type: none;
margin: 0;
padding: 0;
}
.result-menu li {
display: inline-block;
min-width: 100px;
font-size: larger;
border: 1px dotted gray;
border-bottom: 1px solid transparent;
margin-right: 8px;
}
.result-output iframe {
width: 100%;
height: 50vh;
max-height: 800px;
border: 0px solid gray;
resize: both;
overflow: auto;
}
#filters {
margin-top: 8px;
}
#filters label {
font-family: sans-serif;
font-size: smaller;
}
.flag {
display: inline-block;
vertical-align:middle;
width: 1.2em;
height: 1.2em;
border: 1px solid #DDD;
cursor: default;
user-select: none;
margin-right: 8px;
}
.flag.flagged::after {
content: "⚑";
user-select: none;
font-size: x-large;
position: relative;
top: -0.1em;
left: 0.1em;
line-height: 100%;
color: gray;
}
#copied {
color: #4F8A10;
margin-left: 5px;
}
#flag-toolbar.hidden {
display: none;
}
.actual-result {
font-weight: bold;
}
.unexpected-failure {
color: red;
}
.unexpected-pass {
color: green;
}
.timing-stats-table {
text-align: right;
white-space: nowrap;
}
.timing-stats-table th {
padding-left: 10px;
}
.download-button {
display: inline-block;
width: 15px;
height: 15px;
margin-bottom: -2px;
margin-right: 0px;
content: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE4LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgdmlld0JveD0iMCAwIDIxMi45NzMgMjEyLjk3MyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMjEyLjk3MyAyMTIuOTczOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8Zz4NCgk8cGF0aCBkPSJNMjA1LjQ3Myw3Ni4xNDZjLTQuMTQzLDAtNy41LDMuMzU4LTcuNSw3LjV2MTAzLjMySDE1VjgzLjY0NmMwLTQuMTQyLTMuMzU3LTcuNS03LjUtNy41UzAsNzkuNTAzLDAsODMuNjQ2djExMC44Mg0KCQljMCw0LjE0MiwzLjM1Nyw3LjUsNy41LDcuNWgxOTcuOTczYzQuMTQzLDAsNy41LTMuMzU4LDcuNS03LjVWODMuNjQ2QzIxMi45NzMsNzkuNTAzLDIwOS42MTUsNzYuMTQ2LDIwNS40NzMsNzYuMTQ2eiIvPg0KCTxwYXRoIGQ9Ik0xMDEuMTcxLDE1NC43NDZjMS40MDcsMS40MDcsMy4zMTQsMi4xOTcsNS4zMDQsMi4xOTdjMS45ODksMCwzLjg5Ni0wLjc5LDUuMzA0LTIuMTk3bDMyLjM3My0zMi4zNzQNCgkJYzIuOTI5LTIuOTI5LDIuOTI5LTcuNjc4LDAtMTAuNjA2Yy0yLjkzLTIuOTMtNy42NzgtMi45MjktMTAuNjA3LDBsLTE5LjU2OSwxOS41NjlsMC4wMDQtMTEyLjgyOGMwLTQuMTQyLTMuMzU3LTcuNS03LjUtNy41DQoJCWMtNC4xNDIsMC03LjUsMy4zNTgtNy41LDcuNWwtMC4wMDQsMTEyLjgyOWwtMTkuNTQ2LTE5LjU0N2MtMi45MjktMi45MjktNy42NzctMi45My0xMC42MDcsMGMtMi45MjksMi45MjktMi45MjksNy42NzcsMCwxMC42MDYNCgkJTDEwMS4xNzEsMTU0Ljc0NnoiLz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjwvc3ZnPg0K);
}
.stat-bar-count, .stat-bar-time {
width: 12px;
height: 8px;
margin-left: 4px;
}
.stat-bar-count {
background: blue;
}
.stat-bar-time {
background: cyan;
}
</style>
<body>
<h3>Test run summary <span id="builder_name"></span> <span class="flag_name"></span></h3>
<div id="right-toolbar">
<a href="javascript:GUI.showTimingStats()">Timing stats</a>
<a id="help_button" href="javascript:GUI.toggleVisibility('help')">Help</a>
</div>
<div id="timing-stats" class="popup hidden hide-on-esc">
<button style="position:fixed;right:40px;" onclick="GUI.toggleVisibility('timing-stats')">Close</button>
<h3>Timing stats</h3>
<table id="timing-stats-table" class="timing-stats-table"></table>
<h3>Virtual suites</h3>
<table id="timing-stats-virtuals" class="timing-stats-table"></table>
</div>
<div id="help" class="popup hidden hide-on-esc">
<button style="position:fixed;right:40px;" onclick="GUI.toggleVisibility('help')">Close</button>
<h3>Keyboard navigation</h3>
<ul>
<li><b>Space</b> Show full results of the next test. This is the easiest way to navigate, just hit spacebar (and shift space to go back).
<li><b>Tab</b> to select the next test.
<li><b>Enter</b> to see test details. This will automatically close other details.
<li><b>ctrl A</b> to select text of all tests for easy copying.
<li><b>f</b> to flag/unflag a test.
<li><b>?</b> to blink error region of a failed image test.
<li><b>p</b> prints full record of currently selected test to console.
</ul>
<p>Modifiers:</p>
<ul>
<li><b>Shift</b> hold shift key to keep other details open.
<li><b>Meta</b> meta means all. Set/unset all flags or open/close all results (max 100).
</ul>
<p>This page lets you query and display test results.</p>
<h3>Querying Results</h3>
<p>Select the results you are interested in using "Query" buttons.</p>
<p>Narrow down the results further with "Filter" search box and checkboxes.
The search string can be a (full or partial) test name or bug number.
Additionally, the following range specifiers are supported:</p>
<ul>
<li>Range of test time duration: 'time:min-' or 'time:min-max' or 'time:-max' in seconds,</li>
<li>Total pixel difference: 'pixels:min-' or 'pixels:min-max' or 'pixels:-max',</li>
<li>Maximum channel difference: 'channel_max:min-' or 'channel_max:min-max' or 'channel_max:-max'.</li>
</ul>
<h3>Displaying results.</h3>
<p>You can view the list of matched tests in several result formats.
Select format that works best for what you are trying to accomplish
using "format" popup. Following formats are available:</p>
<h4>1. Plain text</h4>
<pre>fast/forms/<a href="https://cs.chromium.org/chromium/src/third_party/blink/web_tests/fast/forms/validation-bubble-appearance-rtl-ui.html?q=validation-bubble-appearance-rtl-ui.html&dr">validation-bubble-appearance-rtl-ui.html</a></pre>
<p>Plain text shows the test path.</p>
<h4>2. TestExpectations</a></h4>
<pre><a href="#">crbug.com/bug</a> layout/test/path/<a href="#">test.html</a> [ Status ]</pre>
<p>TestExpectationsshow lines as they'd appear in <a
href="https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_test_expectations.md">TestExpectations</a> file.</p>
<p>The interesting part here is [ Status ]. Inside TestExpectations file, [ Status ]
can have multiple values, representing all expected results. For example:</p>
<pre>[ Failure Timeout Crash Pass ]</pre>
<p>Result lines include existing expected values, and make a guess about what the new
test expectation line should look like by merging together expected and actual
results. The actual result will be shown in bold, and unexpected actual result will be
shown in red (unexpected failure) or green (unexpected pass). For example:</p>
<pre>TestResult(PASS) + TestExpectation(Failure) => [ Failure <span class="actual-result unexpected-pass">Pass</span> ]
TestResult(TIMEOUT CRASH) + TextExpectation(Timeout Failure) => [ Failure <span class="actual-result">Timeout</span> <span class="actual-result unexpected-failure">Crash</span> ]</pre>
<p>If you are doing a lot of TestExpectation edits, the hope is that this will make
your job as easy as copy and paste.</p>
<h4>3. Crash site</h4>
<pre>
### Crash site: Internals.cpp(3455)
editing/pasteboard/<a href="https://cs.chromium.org/chromium/src/third_party/blink/web_tests/editing/pasteboard/copy-paste-white-space.html?q=copy-paste-white-space.html&dr">copy-paste-white-space.html</a></pre>
<p>Crash site groups "Crash" tests with similar stack traces together. For best results, use it while filtering only crashes.</p>
<h4>4. Text mismatch</h4>
<pre>
### Text mismatch failure: general text mismatch
accessibility/dimensions-include-descendants.html
### Text mismatch failure: newlines only
accessibility/aria-controls-with-tabs.html
### Text mismatch failure: spaces and tabs only
accessibility/aria-describedby-on-input.html
</pre>
<p>Text mistmatch groups "Text failure" tests together.
</p>
<h4>5. Rebaseline</h4>
<p>Generates a bash script to rebaseline based on new results. @xiaochengh knows the details on how to use it, and @kojii is
our one user.</p>
<h3>Viewing results of a single test</h3>
<h4>Image results</h4>
<p>Click on images to zoom in. Select image viewing mode from the popup.</p>
<p>When viewing images for the first time, red flash highlights enclosing
rectangle that was colored red in the diff. Diff flash and color eyedropper
will not be available on file:// urls because of CSP.</p>
<h4>Text results</h4>
<p>Different panels show the expected, actual text results and differences.</p>
<p>For repaint tests, the "repaint" panel visualizes the repaint rectangles.</p>
<h3>Flagging</h3>
<p>Tests can be flagged by clicking on that square box on the right hand side. View all flagged tests with "Flagged" filter. "F" is the keyboard shortcut.
<h3>Bugs</h3>
<p>If you are unhappy with results, please file a bug, or fix it <a href="https://cs.chromium.org/chromium/src/third_party/blink/tools/blinkpy/web_tests/results.html">here</a>.</p>
<p><code>window.localStorage.setItem("testLocationOverride", "file://path/to/your/web_tests")</code> is a secret preference to redirect test links to a custom url.</p>
</div>
<div id="summary">
<p><span class="fix-width">Passed</span><span id="summary_passed"></span></p>
<p><span class="fix-width">Regressions</span><span id="summary_regressions"></span></p>
<p><span class="fix-width">Total</span><span id="summary_total"></span></p>
<p><span class="fix-width">Counts</span><span id="summary_details"></span></p>
</div>
<hr>
<div id="dashboard">
<div>
<span class="fix-width">Query</span>
<button id="button_regressions" onclick="javascript:Query.query('Regressions', Filters.regression, true)">
Regressions
<span id="count_regressions"></span>
</button>
<button onclick="javascript:Query.query('Unexpected passes', Filters.unexpectedPass, true)">
Unexpected Pass
<span id="count_unexpected_pass"></span>
</button>
<button onclick="javascript:Query.query('Did not pass', Filters.notpass, true)">
Did not pass
<span id="count_testexpectations"></span>
</button>
<button onclick="javascript:Query.query('All', Filters.all, true)">
All
<span id="count_all"></span>
</button>
<button onclick="javascript:Query.query('Flaky', Filters.flaky, true)">
Flaky
<span id="count_flaky"></span>
</button>
<button onclick="javascript:Query.query('Unexpected Flaky', Filters.unexpectedFlaky, true)">
Unexpected flaky
<span id="count_unexpected_flaky"></span>
</button>
<button onclick="javascript:Query.query('Flagged', Filters.flagged, true)">
Flagged
</button>
<div id="flag-toolbar" class="hidden">
<span class="fix-width"></span>
<button onclick="javascript:Query.query('Flag failures', Filters.flagFailure, true)">
<span class="flag_name"></span> failures
<span id="count_flag_failure"></span>
</button>
<button onclick="javascript:Query.query('Flag passes', Filters.flagPass, true)">
<span class="flag_name"></span> passes
<span id="count_flag_pass"></span>
</button>
<button onclick="javascript:Query.query('Flag unexpected passes', Filters.flagUnexpectedPass, true)">
<span class="flag_name"></span> unexpected passes
<span id="count_flag_unexpected_pass"></span>
</button>
</div>
</div>
<div id="filters">
<span class="fix-width">Filters</span>
<input id="text-filter" onsearch="Query.filterChanged()" type="search"
placeholder="[test name | bug] [time:min-max] [pixels:min-max] [channel_max:min-max] ⏎"
title="Text filter, see Help for format information.">
<label id="CRASH"><input type="checkbox">Crash <span></span></label>
<label id="TIMEOUT"><input type="checkbox">Timeout <span></span></label>
<label id="TEXT"><input type="checkbox">Text failure <span></span></label>
<label id="HARNESS"><input type="checkbox">Harness failure <span></span></label>
<label id="IMAGE"><input type="checkbox">Image failure <span></span></label>
<label id="IMAGE_TEXT"><input type="checkbox">Image+text failure <span></span></label>
<label id="AUDIO"><input type="checkbox">Audio failure <span></span></label>
<label id="SKIP"><input type="checkbox">Skipped <span></span></label>
<label id="PASS"><input type="checkbox">Pass <span></span></label>
<label id="LEAK"><input type="checkbox">Leak <span></span></label>
</div>
</div>
<div id="report_header" style="margin-top:8px">
<span class="fix-width">Tests shown</span><span id="report_count"></span>
<span id="report_title" style="font-weight:bold"></span>
in format:
<select id="report_format" onchange="Query.generateReport()">
<option value="plain" selected>Plain text</option>
<option value="expectation">TestExpectations</option>
<option value="crashsite">Crash site</option>
<option value="textmismatch">Text mismatch</option>
<option value="rebaseline">Rebaseline script</option>
</select>
<span style="margin-left: 20px">
<button id="copy_report" title="Copy the shown/flagged tests to clipboard in the current format"
onclick="GUI.copyResult(false)" disabled>Copy report</button>
<button id="copy_test_names" title="Copy the names of the shown/flagged tests to clipboard in a single line for use in command lines."
onclick="GUI.copyResult(true)" disabled>Copy test names</button>
<label id="flagged_only" class="hidden"><input id="flagged_only_checkbox" type="checkbox" checked>Flagged only</label>
<span id="copied" class="hidden">Copied.</span>
</span>
</div>
<hr id="progress" align="left">
<div id="report" style="margin-top:8px"></div>
<script>
"use strict";
// Results loaded from full_results_jsonp.js.
let globalResults = {};
let globalTestMap = new Map(); // id => test
const TestResultInformation = {
"CRASH": { index: 1, text: "Crash", isFailure: true, isSuccess: false },
"FAIL": { index: 2, text: "Failure", isFailure: true, isSuccess: false },
"TEXT": { index: 3, text: "Failure", isFailure: true, isSuccess: false },
"IMAGE": { index: 4, text: "Failure", isFailure: true, isSuccess: false },
"IMAGE+TEXT": { index: 5, text: "Failure", isFailure: true, isSuccess: false },
"AUDIO": { index: 6, text: "Failure", isFailure: true, isSuccess: false },
"TIMEOUT": { index: 7, text: "Timeout", isFailure: true, isSuccess: false },
"LEAK": { index: 8, text: "LEAK", isFailure: true, isSuccess: false },
"SKIP": { index: 9, text: "Skip", isFailure: false, isSuccess: false },
"PASS": { index: 10, text: "Pass", isFailure: false, isSuccess: true },
"NOTRUN": { index: 11, text: "NOTRUN", isFailure: false, isSuccess: true }
};
// Sorted from worst to best.
const TestResultComparator = function (a, b) {
if (TestResultInformation[a].index > TestResultInformation[b].index)
return 1;
else if (TestResultInformation[a].index == TestResultInformation[b].index)
return 0;
else
return -1;
};
// Traversal traverses all the tests.
// Use Traversal.traverse(filter, action) to perform action on selected tests.
class Traversal {
constructor(testRoot, textFilter) {
this.root = testRoot;
this.reset();
}
traverse(filter, action, endAction) {
console.time("traverse");
action = action || function() {};
this._helper(this.root, "", filter, action);
if (endAction)
endAction(this);
console.timeEnd("traverse");
}
reset() {
this.testCount = 0;
this.filteredCount = 0;
this.lastDir = "";
this.html = [];
return this;
}
_helper(node, path, filter, action) {
if (GUI.isTest(node)) {
this.testCount++;
if (filter(node, path)) {
this.filteredCount++;
action(node, path, this);
}
} else {
for (let p of node.keys())
this._helper(node.get(p), path + "/" + p, filter, action);
}
}
} // class Traversal
const PathParserGlobals = {
layout_tests_dir: null,
chromium_revision: null
};
class PathParser {
constructor(path) {
this.path = path;
let pathWithoutQuery = path;
const questionMarkIndex = path.indexOf('?');
if (questionMarkIndex !== -1) {
pathWithoutQuery = path.substring(0, questionMarkIndex);
this.query = path.substring(questionMarkIndex);
} else {
this.query = "";
}
const lastDirSeparatorIndex = pathWithoutQuery.lastIndexOf('/');
console.assert(lastDirSeparatorIndex !== -1); // first char should always be '/'
this.dir = pathWithoutQuery.substring(1, lastDirSeparatorIndex + 1);
this.file = pathWithoutQuery.substring(lastDirSeparatorIndex + 1);
try {
[, this.basename, this.extension ] = this.file.match(/(.+)\.(.+)/);
this.resultPrefix = (this.basename + this.query).replace(/[~#%&*{}\:<>?\/|"]/g, "_");
} catch {
this.file = "ERROR";
this.resultPrefix = "ERROR";
}
const href = pathWithoutQuery.replace(/^\/virtual\/[^\/]*/, ""); // virtual suites
this.testHref = this.testBaseHref() + href;
}
static initGlobals(fullResults) {
for (let p in PathParserGlobals)
PathParserGlobals[p] = fullResults[p];
}
resultLink(resultName) {
return this.dir + this.resultPrefix + resultName;
}
resultFilename(resultName) {
return this.resultPrefix + resultName;
}
repaintOverlayLink() {
return this.resultLink("-overlay.html?") + encodeURIComponent(this.testHref);
}
testBaseHref() {
if (window.localStorage.getItem("testLocationOverride")) {
// Experimental preference.
// Use "window.localStorage.setItem("testLocationOverride", "file://path/to/your/web_tests")
return window.localStorage.getItem("testLocationOverride");
} else if (PathParserGlobals.layout_tests_dir) {
return PathParserGlobals.layout_tests_dir;
} else if (location.toString().indexOf('file://') == 0) {
// tests were run locally.
return "../../../third_party/blink/web_tests";
} else if (PathParserGlobals.chromium_revision) {
// Existing crrev list is incorrect: https://crbug.com/750347
let correctedRevision = PathParserGlobals.chromium_revision.replace("refs/heads/main@{#", "").replace("}", "");
return "https://crrev.com/" + correctedRevision + "/third_party/blink/web_tests";
} else {
return "https://chromium.googlesource.com/chromium/src/+/main/third_party/blink/web_tests";
}
}
} // class PathParser
// Report deals with displaying a single test.
const Report = {
getDefaultPrinter: () => {
let val = document.querySelector("#report_format").value;
window.localStorage.setItem("reportFormat", val);
switch(val) {
case "expectation":
return {print: Report.printExpectation, render: Report.renderResultList};
case "crashsite":
return {print: Report.printCrashSite, render: Report.renderGroupCrashSite};
case "textmismatch":
return {print: Report.printTextMismatch, render: Report.renderGroupTextMismatch};
case "rebaseline":
return {print: Report.printRebaseline, endPrint: Report.endPrintRebaseline, render: Report.renderResultList};
case "plain":
default:
return {print: Report.printPlainTest, render: Report.renderResultList};
}
},
printFlag: (test) => {
return `<div class="flag ${test.flagged ? "flagged" : ""}"
title="Hold Meta key to flag/unflag all tests."></div>`;
},
printPlainTest: (test, path, traversal) => {
let pathParser = new PathParser(path);
let html = `
<div class='expect' tabindex='0' data-id='${test.expectId}'>
<div class='details'></div>${Report.printFlag(test)}${pathParser.dir}<a target='test' tabindex='-1' href='${pathParser.testHref}'>${pathParser.file}${pathParser.query}</a>
</div>`;
traversal.html.push(html);
},
printExpectation: (test, path, traversal) => {
// TestExpectations file format is documented at:
// https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_test_expectations.md
let pathParser = new PathParser(path);
// Print directory header if this test's directory is different from the last.
if (pathParser.dir != traversal.lastDir) {
traversal.html.push("<br>");
traversal.html.push("<div class='h-expect'>### " + pathParser.dir + "</div>");
traversal.lastDir = pathParser.dir;
}
let statusMap = new Map(test.expectedMap);
if (statusMap.has("PASS") && statusMap.size == 1)
statusMap.delete("PASS");
test.actualMap.forEach((value, key) => {
if (key == "TEXT" || key == "IMAGE" || key == "IMAGE+TEXT" || key == "AUDIO")
key = "FAIL";
let statusClass = 'actual-result';
if (!test.expectedMap.has(key))
statusClass += key == "PASS" ? " unexpected-pass" : " unexpected-failure";
statusMap.set(key, statusClass);
});
let status = test.is_slow_test ? "Slow" : "";
statusMap.forEach((value, key) => {
status += ` <span class="${value}">${TestResultInformation[key].text}</span>`;
});
let bug = "";
if (test.bugs && test.bugs.length > 0) {
for (let b of test.bugs) {
bug += `<a target='crbug' tabindex='-1' href='https://${b}'>${b}</a> `;
}
}
if (!bug && !Filters.isPass(test.actualMap))
bug = "<span class='warn'>NEEDBUG</span>";
let html = `
<div class='expect' tabindex='0' data-id='${test.expectId}'><div class='details'></div>${Report.printFlag(test)}${bug}
${pathParser.dir}<a target='test' tabindex='-1' href='${pathParser.testHref}'>${pathParser.file}${pathParser.query}</a>
[ ${status} ]
</div>
`;
traversal.html.push(html);
},
printWithKey: (test, path, traversal, key_title) => {
let pathParser = new PathParser(path);
let key = test[key_title];
let html = ""
+ `${Report.printFlag(test)}`
+ pathParser.dir
+ "<a target='test' tabindex='-1' href='" + pathParser.testHref + "'>"
+ pathParser.file + pathParser.query + "</a>";
html = "<div class='expect' tabindex='0' data-id='"+ test.expectId +"'><div class='details'></div>" + html + "</div>";
traversal.html.push({key: key, html: html});
},
printCrashSite: (test, path, traversal) => {
Report.printWithKey(test, path, traversal, "crash_site");
},
printTextMismatch: (test, path, traversal) => {
Report.printWithKey(test, path, traversal, "text_mismatch");
},
printRebaseline: (test, path, traversal) => {
let parser = new PathParser(path);
let actualNames = [];
let expectedNames = [];
switch (test.actualFinal) {
case "IMAGE+TEXT":
actualNames.push("-actual.txt");
expectedNames.push("-expected.txt");
// fall through IMAGE
case "IMAGE":
actualNames.push("-actual.png");
expectedNames.push("-expected.png");
break;
case "TEXT":
actualNames.push("-actual.txt");
expectedNames.push("-expected.txt");
break;
default:
return;
}
// Change directory if in wrong place
let dir = parser.dir;
if (dir != traversal.rebaselineDir) {
if (traversal.rebaselineDir)
traversal.html.push('<div>popd >/dev/null;</div>');
traversal.html.push(`<div>mkdir -p ${dir};</div>`);
traversal.html.push(`<div>pushd ${dir};</div>`);
traversal.rebaselineDir = dir;
}
for (let i=0; i<actualNames.length; i++) {
let url = new URL(parser.resultLink(actualNames[i]), window.location.href);
if (url.href.startsWith('file://')) {
let actualFile = url.href.substring('file://'.length);
traversal.html.push(`<div>cp ${actualFile} ${parser.basename + expectedNames[i]};</div>`);
} else {
traversal.html.push(`<div>wget ${url.href};</div>`);
traversal.html.push(`<div>mv ${parser.basename + actualNames[i]} ${parser.basename + expectedNames[i]};</div>`);
}
}
traversal.rebaselinedTests = `${traversal.rebaselinedTests || ''} ${parser.dir}${parser.file}`;
},
endPrintRebaseline: (traversal) => {
if (traversal.rebaselineDir)
traversal.html.push('<div>popd >/dev/null;</div>');
if (traversal.rebaselinedTests) {
traversal.html.push(
`<div>if ! blink_tool.py optimize-baselines ${traversal.rebaselinedTests}; then</div>`,
'<div>echo The above command needs third_party/blink/tools in PATH</div>',
'<div>fi</div>');
}
},
indicateNone: (report) => {
let pre = document.createElement("div");
pre.id = "none";
pre.textContent = "None";
report.appendChild(pre);
},
renderResultList: (html, report) => {
if (report.childNodes.length === 0 && html.length === 0) {
Report.indicateNone(report);
return;
}
let pre = document.createElement("div");
pre.innerHTML = html.join("\n");
report.appendChild(pre);
},
createContainerForGroup: (report, key, keyed_title, null_title) => {
let container = document.createElement("div");
container.setAttribute("key", key);
container.innerHTML = ""
+ "<br><b>"
+ (key !== 'null' ? `### ${keyed_title}: ${key}`
: `### ${null_title}`)
+ "</b>";
// The containers are sorted by key (except the "null" key) alphabetically.
// The "null" container always appears at the last.
if (key == "null") {
report.appendChild(container);
} else {
let inserted = false;
report.childNodes.forEach(sibling => {
if (inserted)
return;
let siblingKey = sibling.getAttribute("key");
if (siblingKey == "null" || siblingKey > key) {
report.insertBefore(container, sibling);
inserted = true;
}
});
if (!inserted)
report.appendChild(container);
}
return container;
},
renderGroup: (html, report, keyed_title, null_title) => {
if (report.childNodes.length === 0 && html.length === 0) {
Report.indicateNone(report);
return;
}
let renderMap = {};
html.forEach(result => {
let key = result.key || "null";
if (!(key in renderMap)) {
const number_of_items = html.filter(result => (result.key || "null") === key).length;
let container =
report.querySelector(`div[key="${key}"]`) ||
Report.createContainerForGroup(report, key,
`${keyed_title} ${number_of_items}`,
`${null_title} ${number_of_items}`);
renderMap[key] = {container: container, html: ""};
}
renderMap[key].html += result.html;
});
for (let key in renderMap)
renderMap[key].container.insertAdjacentHTML('beforeend', renderMap[key].html);
},
renderGroupCrashSite: (html, report) => {
Report.renderGroup(html, report, "Crash site", "Didn't crash");
},
renderGroupTextMismatch: (html, report) => {
Report.renderGroup(html, report, "Text mismatch failure", "Didn't find text mismatch");
},
getTestById: (testId) => {
return globalTestMap.get(parseInt(testId));
},
// Returns toolbar DOM
getResultToolbars: (test) => {
let toolbars = [];
let pathParser = new PathParser(test.expectPath);
let actual = test.actual;
if (test.time)
actual = actual.replace(/ |$/, `(${test.time}s)` + "$&");
toolbars.push(new PlainHtmlToolbar().createDom(actual));
for (let result of test.actualMap.keys()) {
switch(result) {
case "PASS":
if (Filters.unexpectedPass(test))
toolbars.push(new PlainHtmlToolbar().createDom("Expected: " + test.expected));
if (!test.has_stderr)
toolbars.push(new PlainHtmlToolbar().createDom("No errors"));
break;
case "SKIP":
toolbars.push(new PlainHtmlToolbar().createDom("Test did not run."));
break;
case "CRASH":
toolbars.push(new SimpleLinkToolbar().createDom(
pathParser.resultLink("-crash-log.txt"), "Crash log", "crash log"));
break;
case "TIMEOUT":
toolbars.push(new PlainHtmlToolbar().createDom("Test timed out. "));
if (test.text_mismatch)
toolbars.push(new TextResultsToolbar().createDom(test));
break;
case "TEXT":
toolbars.push(new TextResultsToolbar().createDom(test));
break;
case "IMAGE":
toolbars.push(new ImageResultsToolbar().createDom(test));
break;
case "IMAGE+TEXT":
toolbars.push(new ImageResultsToolbar().createDom(test));
toolbars.push(new TextResultsToolbar().createDom(test));
break;
case "AUDIO":
toolbars.push(new AudioResultsToolbar().createDom(test));
break;
case "LEAK":
toolbars.push(new SimpleLinkToolbar().createDom(
pathParser.resultLink("-leak-log.txt"), "Leak log", "leak log"));
break;
default:
console.error("unexpected actual", test.actual);
}
}
if (test.has_stderr) {
toolbars.push(new SimpleLinkToolbar().createDom(
pathParser.resultLink("-stderr.txt"), "standard error", "stderr"));
}
if (test.command) {
toolbars.push(new SimpleLinkToolbar().createDom(
pathParser.resultLink("-command.txt"), "Command", "command"));
}
if (test.shard != undefined && test.shard != "null") {
toolbars.push(new PlainHtmlToolbar().createDom("Shard: " + test.shard))
}
return toolbars;
},
getResultsDiv: (test) => {
let div = document.createElement("div");
div.classList.add("result-frame");
div.innerHTML = `
<ul class="result-menu"></ul>
<div class="result-output"></div>
`;
// Initialize the results.
let menu = div.querySelector(".result-menu");
for (let toolbar of Report.getResultToolbars(test))
menu.appendChild(toolbar);
if (test.image_diff_stats) {
let diff_stats = document.createElement("div");
diff_stats.classList.add("image-diff-stats")
diff_stats.innerHTML = "<b>Max Channel Difference:</b> " +
test.image_diff_stats.maxDifference + ", <b>Total Pixels Different:</b> " +
test.image_diff_stats.totalPixels
menu.appendChild(diff_stats)
}
return div;
}
}; // Report
// Query generates a report for a given query.
const Query = {
lastReport: null,
currentRAF: null,
currentPromise: null,
currentResolve: null,
currentReject: null,
createReportPromise: function() {
if (this.currentPromise) {
this.currentPromise = null;
this.currentReject();
}
this.currentPromise = new Promise( (resolve, reject) => {
this.currentResolve = resolve;
this.currentReject = reject;
});
this.currentPromise.catch( _ => {}); // stops uncaught rejection errors.
},
completeReportPromise: function(traversal) {
if (this.currentResolve)
this.currentResolve(traversal);
this.currentPromise = null;
this.currentResolve = null;
this.currentReject = null;
},
resetFilters: function() {
// Reset all filters.
for (let el of Array.from(
document.querySelectorAll("#filters > label"))) {
el.querySelector('input').checked = true;
}
},
updateFilters: function() {
for (let el of Array.from(
document.querySelectorAll("#filters > label"))) {
let count = this.resultCounts[el.id.replace("_", "+")];
if (count > 0) {
el.classList.remove("hidden");
el.querySelector('span').innerText = count;
} else {
el.classList.add("hidden");
el.querySelector("span").innerText = "";
}
}
},
filterChanged: function(ev) {
this.query();
},
parseRangeFilter: function(query, key) {
let range = query.match(key + ":([.0-9]*)-([.0-9]*)");
if (range) {
let min = parseFloat(range[1]);
let max = Number.MAX_VALUE;
if (range[2] != "") {
max = parseFloat(range[2]);
}
let rem_query = query.substring(0, range.index) + query.substring(range.index +
range[0].length);
return [min, max, rem_query];
} else {
return [0, Number.MAX_VALUE, query];
}
},
applyFilters: function(queryFilter) {
var filterMap = new Map();
for (let el of Array.from(
document.querySelectorAll("#filters > label"))) {
if (el.querySelector('input').checked)
filterMap.set(el.id.replace("_", "+"), true);
}
let originalQuery = document.querySelector("#text-filter").value;
let [timeMin, timeMax, timeQuery] = this.parseRangeFilter(originalQuery, "time");
let [pixelsMin, pixelsMax, pixelsQuery] = this.parseRangeFilter(timeQuery, "pixels");
let [channelMin, channelMax, channelQuery] = this.parseRangeFilter(pixelsQuery, "channel_max");
let searchText = channelQuery.trim();
let textFilter = test => {
if (searchText.length > 0) {
let match = false;
if (test.expectPath.includes(searchText))
match = true;
else if (Array.isArray(test.bugs)) {
for (let bug of test.bugs) {
if (bug.includes(searchText)) {
match = true;
break;
}