File: webrtc_browsertest_perf_unittest.cc

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (76 lines) | stat: -rw-r--r-- 3,670 bytes parent folder | download | duplicates (11)
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
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/media/webrtc/webrtc_browsertest_perf.h"

#include "testing/gtest/include/gtest/gtest.h"

namespace test {

constexpr char kTypicalCompareVideosOutput[] =
    "Adjusting test video with color transformation: \n"
    " 1.00   0.01   0.01  -2.91 \n"
    "-0.01   0.99  -0.04   7.21 \n"
    " 0.00  -0.06   0.99   7.47 \n"
    "RESULT Unique_frames_count: 360p_VP8= 80 score\n"
    "RESULT PSNR: 360p_VP8= "
    "[38.453419,38.453419,38.453419,38.453419,38.453419,38.453419,38.453419,38."
    "453419,38.453419,38.453419,39.102536,39.102536,39.102536,39.767288,39."
    "767288,39.767288,40.023144,40.023144,40.023144,40.562812,40.562812,40."
    "562812,40.72701,40.72701,40.72701,40.72701,40.926442,40.926442,40.926442,"
    "41.198192,41.198192,41.198192,41.397378,41.397378,41.397378,41.435832,41."
    "435832,41.435832,41.456998,41.456998,41.456998,41.66108,41.66108,41.66108,"
    "41.722977,41.722977,41.722977,41.471985,41.471985,41.471985,41.471985,41."
    "471985,41.263275,41.263275,41.263275,40.953795,40.953795,40.890606,40."
    "890606,40.890606,41.055124,41.055124,41.055124,41.371183,41.371183,41."
    "371183,41.64044,41.64044,41.64044,41.64044,41.64044,41.725886,41.725886,"
    "41.725886,41.578544,41.578544,41.646766,41.646766,41.490909,41.490909] "
    "dB\n"
    "RESULT SSIM: 360p_VP8= "
    "[0.96503067,0.96503067,0.96503067,0.96503067,0.96503067,0.96503067,0."
    "96503067,0.96503067,0.96503067,0.96503067,0.96694655,0.96694655,0."
    "96694655,0.97058175,0.97058175,0.97058175,0.97440174,0.97440174,0."
    "97440174,0.97723814,0.97723814,0.97723814,0.97804682,0.97804682,0."
    "97804682,0.97804682,0.98044036,0.98044036,0.98044036,0.98102023,0."
    "98102023,0.98102023,0.98076329,0.98076329,0.98076329,0.98025288,0."
    "98025288,0.98025288,0.98084894,0.98084894,0.98084894,0.98137786,0."
    "98137786,0.98137786,0.9812953,0.9812953,0.9812953,0.97990543,0.97990543,0."
    "97990543,0.97990543,0.97990543,0.97811092,0.97811092,0.97811092,0."
    "97576317,0.97576317,0.97655883,0.97655883,0.97655883,0.97669573,0."
    "97669573,0.97669573,0.9795819,0.9795819,0.9795819,0.98144956,0.98144956,0."
    "98144956,0.98144956,0.98144956,0.98165894,0.98165894,0.98165894,0."
    "98185588,0.98185588,0.98135814,0.98135814,0.98102463,0.98102463] score\n"
    "RESULT Max_repeated: 360p_VP8= 10\n"
    "RESULT Max_skipped: 360p_VP8= 1\n"
    "RESULT Total_skipped: 360p_VP8= 23\n"
    "RESULT Decode_errors_reference: 360p_VP8= 0\n"
    "RESULT Decode_errors_test: 360p_VP8= 0\n";

TEST(WebrtcBrowserTestPerfTest, ParsesTypicalCompareVideosOutput) {
  EXPECT_TRUE(WriteCompareVideosOutputAsHistogram("someLabel",
                                                  kTypicalCompareVideosOutput));
}

TEST(WebrtcBrowserTestPerfTest, FailsOnWrongNumberOfLines) {
  EXPECT_FALSE(WriteCompareVideosOutputAsHistogram(
      "whatever", "RESULT bad_label: 360p_VP8= 80 score\n"));
}

TEST(WebrtcBrowserTestPerfTest, FailsOnBadLabels) {
  EXPECT_FALSE(WriteCompareVideosOutputAsHistogram(
      "whatever", "RESULT bad_label: 360p_VP8= 80 score\na\nb\nc\nd\ne\nf\ng"));
}

TEST(WebrtcBrowserTestPerfTest, FailsOnBadValues) {
  EXPECT_FALSE(WriteCompareVideosOutputAsHistogram(
      "whatever",
      "RESULT bad_label: 360p_VP8= meh score\na\nb\nc\nd\ne\nf\ng"));
}

TEST(WebrtcBrowserTestPerfTest, FailsIfLabelsInWrongOrder) {
  EXPECT_FALSE(WriteCompareVideosOutputAsHistogram(
      "whatever", "RESULT PSNR: 360p_VP8= 80 score\na\nb\nc\nd\ne\nf\ng"));
}

}  // namespace test