DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (c68fe15a81fc)

VCS Links

Line Code
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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281
from __future__ import absolute_import

import os


from talos import filter

"""
test definitions for Talos
"""
"""

_TESTS = {}  # internal dict of Talos test classes


def register_test():
def register_test():
    """Decorator to register Talos test classes"""
    def wrapper(klass):
        assert issubclass(klass, Test)
        assert klass.name() not in _TESTS


        _TESTS[klass.name()] = klass
        return klass
    return wrapper



def test_dict():
    """Return the dict of the registered test classes"""
    return _TESTS
    return _TESTS


class Test(object):
    """abstract base class for a Talos test case"""
    """abstract base class for a Talos test case"""
    __test__ = False  # not pytest

    cycles = None  # number of cycles
    keys = []
    desktop = True
    desktop = True
    filters = filter.ignore_first.prepare(1) + filter.median.prepare()
    lower_is_better = True
    alert_threshold = 2.0
    perfherder_framework = 'talos'
    subtest_alerts = False
    subtest_alerts = False
    suite_should_alert = True

    @classmethod
    def name(cls):
        return cls.__name__
        return cls.__name__

    @classmethod
    def description(cls):
        if cls.__doc__ is None:
            return "No documentation available yet."
            return "No documentation available yet."
        else:
            doc = cls.__doc__
            doc = cls.__doc__
            description_lines = [i.strip() for i in doc.strip().splitlines()]
            return "\n".join(description_lines)

    def __init__(self, **kw):
        self.update(**kw)
        self.update(**kw)

    def update(self, **kw):
        self.__dict__.update(kw)

    def items(self):
    def items(self):
        """
        returns a list of 2-tuples
        """
        retval = [('name', self.name())]
        for key in self.keys:
        for key in self.keys:
            value = getattr(self, key, None)
            if value is not None:
                retval.append((key, value))
        return retval


    def __str__(self):
        """string form appropriate for YAML output"""
        items = self.items()


        key, value = items.pop(0)
        lines = ["- %s: %s" % (key, value)]
        for key, value in items:
            lines.append('  %s: %s' % (key, value))
        return '\n'.join(lines)



# ts-style startup tests (ts, twinopen, ts_cold, etc)
# The overall test number is calculated by excluding the max opening time
# and taking an average of the remaining numbers.
class TsBase(Test):
class TsBase(Test):
    """abstract base class for ts-style tests"""
    keys = [
        'url',
        'url_timestamp',
        'timeout',
        'timeout',
        'cycles',
        'profile_path',  # The path containing the template profile. This
                         # directory is copied to the temporary profile during
                         # initialization of the test. If some of the files may
                         # be overwritten by Firefox and need to be reinstalled
                         # be overwritten by Firefox and need to be reinstalled
                         # before each pass, use key |reinstall|
        'gecko_profile',
        'gecko_profile_interval',
        'gecko_profile_entries',
        'gecko_profile_startup',
        'preferences',
        'preferences',
        'xperf_counters',
        'xperf_providers',
        'xperf_user_providers',
        'xperf_stackwalk',
        'tpmozafterpaint',
        'tpmozafterpaint',
        'fnbpaint',
        'tphero',
        'tpmanifest',
        'profile',
        'profile',
        'firstpaint',
        'userready',
        'testeventmap',
        'base_vs_ref',
        'extensions',
        'extensions',
        'filters',
        'setup',
        'cleanup',
        'webextensions',
        'webextensions_folder',
        'webextensions_folder',
        'reinstall',     # A list of files from the profile directory that
                         # should be copied to the temporary profile prior to
                         # running each cycle, to avoid one cycle overwriting
                         # the data used by the next another cycle (may be used
                         # e.g. for sessionstore.js to ensure that all cycles
                         # e.g. for sessionstore.js to ensure that all cycles
                         # use the exact same sessionstore.js, rather than a
                         # more recent copy).
    ]

    def __init__(self, **kw):
    def __init__(self, **kw):
        super(TsBase, self).__init__(**kw)

        # Unless set to False explicitly, all TsBase tests will have the blocklist
        # enabled by default in order to more accurately test the startup paths.
        BLOCKLIST_PREF = "extensions.blocklist.enabled"
        BLOCKLIST_PREF = "extensions.blocklist.enabled"

        if not hasattr(self, "preferences"):
            self.preferences = {
              BLOCKLIST_PREF: True,
            }
        elif BLOCKLIST_PREF not in self.preferences:
            self.preferences[BLOCKLIST_PREF] = True
            self.preferences[BLOCKLIST_PREF] = True


@register_test()
class ts_paint(TsBase):
class ts_paint(TsBase):
    """
    Launches tspaint_test.html with the current timestamp in the url,
    waits for [MozAfterPaint and onLoad] to fire, then records the end
    time and calculates the time to startup.
    """
    """
    cycles = 20
    timeout = 150
    gecko_profile_startup = True
    gecko_profile_entries = 10000000
    url = 'startup_test/tspaint_test.html'
    url = 'startup_test/tspaint_test.html'
    xperf_counters = []
    win7_counters = []
    filters = filter.ignore_first.prepare(1) + filter.median.prepare()
    tpmozafterpaint = True
    mainthread = False
    mainthread = False
    responsiveness = False
    unit = 'ms'


@register_test()
@register_test()
class ts_paint_webext(ts_paint):
    webextensions = '${talos}/webextensions/dummy/dummy.xpi'
    preferences = {'xpinstall.signatures.required': False}



@register_test()
class ts_paint_heavy(ts_paint):
    """
    ts_paint test ran against a heavy-user profile
    ts_paint test ran against a heavy-user profile
    """
    profile = 'simple'


@register_test()
@register_test()
class ts_paint_flex(ts_paint):
    preferences = {'layout.css.emulate-moz-box-with-flex': True}


@register_test()
@register_test()
class startup_about_home_paint(ts_paint):
    url = None
    cycles = 20
    extensions = ['${talos}/startup_test/startup_about_home_paint/addon']
    tpmanifest = '${talos}/startup_test/startup_about_home_paint/startup_about_home_paint.manifest'
    tpmanifest = '${talos}/startup_test/startup_about_home_paint/startup_about_home_paint.manifest'


@register_test()
class startup_about_home_paint_realworld_webextensions(ts_paint):
    url = None
    url = None
    cycles = 20
    extensions = [
        '${talos}/startup_test/startup_about_home_paint/addon',
        '${talos}/getinfooffline'
    ]
    ]
    tpmanifest = '${talos}/startup_test/startup_about_home_paint/startup_about_home_paint.manifest'
    webextensions_folder = '${talos}/webextensions'


@register_test()
@register_test()
class sessionrestore(TsBase):
    """
    A start up test measuring the time it takes to load a sessionstore.js file.

    1. Set up Firefox to restore from a given sessionstore.js file.
    1. Set up Firefox to restore from a given sessionstore.js file.
    2. Launch Firefox.
    3. Measure the delta between firstPaint and sessionRestored.
    """
    extensions = ['${talos}/startup_test/sessionrestore/addon']
    cycles = 10
    cycles = 10
    timeout = 900
    gecko_profile_startup = True
    gecko_profile_entries = 10000000
    profile_path = '${talos}/startup_test/sessionrestore/profile'
    reinstall = ['sessionstore.jsonlz4', 'sessionstore.js', 'sessionCheckpoints.json']
    # Restore the session. We have to provide a URL, otherwise Talos
    # asks for a manifest URL.
    # asks for a manifest URL.
    url = 'about:home'
    preferences = {'browser.startup.page': 3}
    unit = 'ms'



@register_test()
class sessionrestore_no_auto_restore(sessionrestore):
    """
    A start up test measuring the time it takes to load a sessionstore.js file.


    1. Set up Firefox to *not* restore automatically from sessionstore.js file.
    2. Launch Firefox.
    3. Measure the delta between firstPaint and sessionRestored.
    """
    preferences = {
    preferences = {
        'browser.startup.page': 1,
        'talos.sessionrestore.norestore': True,
    }



@register_test()
class sessionrestore_many_windows(sessionrestore):
    """
    A start up test measuring the time it takes to load a sessionstore.js file.
    A start up test measuring the time it takes to load a sessionstore.js file.


    1. Set up Firefox to restore automatically from sessionstore.js file.
    2. Launch Firefox.
    3. Measure the delta between firstPaint and sessionRestored.
    """
    profile_path = '${talos}/startup_test/sessionrestore/profile-manywindows'
    profile_path = '${talos}/startup_test/sessionrestore/profile-manywindows'


# pageloader tests(tp5, etc)

# The overall test number is determined by first calculating the median
# The overall test number is determined by first calculating the median
# page load time for each page in the set (excluding the max page load
# per individual page). The max median from that set is then excluded and
# the average is taken; that becomes the number reported to the tinderbox
# waterfall.



class PageloaderTest(Test):
    """abstract base class for a Talos Pageloader test"""
    extensions = ['${talos}/pageloader']
    tpmanifest = None  # test manifest
    tpcycles = 1  # number of time to run each page
    cycles = None
    timeout = None


    keys = ['tpmanifest', 'tpcycles', 'tppagecycles', 'tprender', 'tpchrome',
            'tpmozafterpaint', 'fnbpaint', 'tphero', 'tploadnocache', 'firstpaint',
            'userready', 'testeventmap', 'base_vs_ref', 'mainthread', 'resolution',
            'userready', 'testeventmap', 'base_vs_ref', 'mainthread', 'resolution',
            'cycles', 'gecko_profile', 'gecko_profile_interval', 'gecko_profile_entries',
            'tptimeout', 'win_counters', 'w7_counters', 'linux_counters', 'mac_counters',
            'tpscrolltest', 'xperf_counters', 'timeout', 'responsiveness',
            'profile_path', 'xperf_providers', 'xperf_user_providers', 'xperf_stackwalk',
            'format_pagename', 'filters', 'preferences', 'extensions', 'setup', 'cleanup',
            'format_pagename', 'filters', 'preferences', 'extensions', 'setup', 'cleanup',
            'lower_is_better', 'alert_threshold', 'unit', 'webextensions', 'profile',
            'suite_should_alert', 'subtest_alerts', 'perfherder_framework', 'pdfpaint',
            'suite_should_alert', 'subtest_alerts', 'perfherder_framework', 'pdfpaint',
            'webextensions_folder', 'a11y']


class QuantumPageloadTest(PageloaderTest):
    """
    """
    Base class for a Quantum Pageload test
    """
    tpcycles = 1
    tppagecycles = 25
    gecko_profile_interval = 1
    gecko_profile_interval = 1
    gecko_profile_entries = 2000000
    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
    unit = 'ms'
    lower_is_better = True
    fnbpaint = True
    fnbpaint = True


@register_test()
class twinopen(PageloaderTest):
class twinopen(PageloaderTest):
    """
    Tests the amount of time it takes an open browser to open a new browser
    window and paint the browser chrome. This test does not include startup
    time. Multiple test windows are opened in succession.
    (Measures ctrl-n performance.)
    (Measures ctrl-n performance.)
    """
    extensions = ['${talos}/pageloader', '${talos}/tests/twinopen']
    extensions = ['${talos}/pageloader', '${talos}/tests/twinopen']
    tpmanifest = '${talos}/tests/twinopen/twinopen.manifest'
    tppagecycles = 20
    timeout = 300
    gecko_profile_interval = 1
    gecko_profile_entries = 2000000
    gecko_profile_entries = 2000000
    tpmozafterpaint = True
    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
    unit = 'ms'
    preferences = {
        'browser.startup.homepage': 'about:blank'
        'browser.startup.homepage': 'about:blank'
    }


@register_test()
@register_test()
class pdfpaint(PageloaderTest):
    """
    Tests the amount of time it takes for the the first page of a PDF to
    be rendered.
    """
    """
    tpmanifest = '${talos}/tests/pdfpaint/pdfpaint.manifest'
    tppagecycles = 20
    gecko_profile_entries = 1000000
    pdfpaint = True
    unit = 'ms'
    preferences = {
        'pdfjs.eventBusDispatchToDOM': True
    }



@register_test()
class cpstartup(PageloaderTest):
    """
    Tests the amount of time it takes to start up a new content process and
    Tests the amount of time it takes to start up a new content process and
    initialize it to the point where it can start processing incoming URLs
    to load.
    """
    extensions = ['${talos}/pageloader', '${talos}/tests/cpstartup/extension']
    tpmanifest = '${talos}/tests/cpstartup/cpstartup.manifest'
    tpmanifest = '${talos}/tests/cpstartup/cpstartup.manifest'
    tppagecycles = 20
    gecko_profile_entries = 1000000
    tploadnocache = True
    unit = 'ms'
    preferences = {
    preferences = {
        # By default, Talos is configured to open links from
        # content in new windows. We're overriding them so that
        # they open in new tabs instead.
        # See http://kb.mozillazine.org/Browser.link.open_newwindow
        # and http://kb.mozillazine.org/Browser.link.open_newwindow.restriction
        'browser.link.open_newwindow': 3,
        'browser.link.open_newwindow.restriction': 2,
    }


@register_test()
@register_test()
class tabpaint(PageloaderTest):
    """
    Tests the amount of time it takes to open new tabs, triggered from
    both the parent process and the content process.
    """
    """
    extensions = ['${talos}/tests/tabpaint', '${talos}/pageloader']
    tpmanifest = '${talos}/tests/tabpaint/tabpaint.manifest'
    tppagecycles = 20
    gecko_profile_entries = 1000000
    tploadnocache = True
    tploadnocache = True
    unit = 'ms'
    preferences = {
        # By default, Talos is configured to open links from
        # content in new windows. We're overriding them so that
        # they open in new tabs instead.
        # they open in new tabs instead.
        # See http://kb.mozillazine.org/Browser.link.open_newwindow
        # and http://kb.mozillazine.org/Browser.link.open_newwindow.restriction
        'browser.link.open_newwindow': 3,
        'browser.link.open_newwindow.restriction': 2,
        'browser.newtab.preload': False,
    }
    }


@register_test()
class tabswitch(PageloaderTest):
    """
    """
    Tests the amount of time it takes to switch between tabs
    """
    extensions = ['${talos}/tests/tabswitch', '${talos}/pageloader']
    tpmanifest = '${talos}/tests/tabswitch/tabswitch.manifest'
    tppagecycles = 5
    tppagecycles = 5
    gecko_profile_entries = 5000000
    tploadnocache = True
    preferences = {
        'addon.test.tabswitch.urlfile': os.path.join('${talos}',
                                                     'tests',
                                                     'tests',
                                                     'tp5o.html'),
        'addon.test.tabswitch.webserver': '${webserver}',
        'addon.test.tabswitch.maxurls': -1,
    }
    }
    unit = 'ms'


@register_test()
class tart(PageloaderTest):
class tart(PageloaderTest):
    """
    Tab Animation Regression Test
    Tests tab animation on these cases:
    1. Simple: single new tab of about:blank open/close without affecting
    1. Simple: single new tab of about:blank open/close without affecting
       (shrinking/expanding) other tabs.
    2. icon: same as above with favicons and long title instead of about:blank.
    3. Newtab: newtab open with thumbnails preview - without affecting other
       tabs, with and without preload.
    4. Fade: opens a tab, then measures fadeout/fadein (tab animation without
    4. Fade: opens a tab, then measures fadeout/fadein (tab animation without
       the overhead of opening/closing a tab).
    - Case 1 is tested with DPI scaling of 1.
    - Case 2 is tested with DPI scaling of 1.0 and 2.0.
    - Case 3 is tested with the default scaling of the test system.
    - Case 4 is tested with DPI scaling of 2.0 with the "icon" tab
    - Case 4 is tested with DPI scaling of 2.0 with the "icon" tab
      (favicon and long title).
    - Each animation produces 3 test results:
      - error: difference between the designated duration and the actual
        completion duration from the trigger.
      - half: average interval over the 2nd half of the animation.
      - half: average interval over the 2nd half of the animation.
      - all: average interval over all recorded intervals.
    """
    tpmanifest = '${talos}/tests/tart/tart.manifest'
    extensions = ['${talos}/pageloader', '${talos}/tests/tart/addon']
    tpcycles = 1
    tppagecycles = 25
    tploadnocache = True
    tploadnocache = True
    tpmozafterpaint = False
    gecko_profile_interval = 10
    gecko_profile_entries = 1000000
    win_counters = w7_counters = linux_counters = mac_counters = None
    """
    """
    ASAP mode
    The recording API is broken with OMTC before ~2013-11-27
    After ~2013-11-27, disabling OMTC will also implicitly disable
    OGL HW composition to disable OMTC with older firefox builds, also
    set 'layers.offmainthreadcomposition.enabled': False
    set 'layers.offmainthreadcomposition.enabled': False
    """
    preferences = {'layout.frame_rate': 0,
                   'docshell.event_starvation_delay_hint': 1,
                   'dom.send_after_paint_to_content': False}
    filters = filter.ignore_first.prepare(1) + filter.median.prepare()
    filters = filter.ignore_first.prepare(1) + filter.median.prepare()
    unit = 'ms'


@register_test()
@register_test()
class tart_flex(tart):
    preferences = {'layout.css.emulate-moz-box-with-flex': True}


@register_test()
@register_test()
class damp(PageloaderTest):
    """
    Devtools At Maximum Performance
    Tests the speed of DevTools toolbox open, close, and page reload
    for each tool, across a very simple and very complicated page.
    for each tool, across a very simple and very complicated page.
    """
    tpmanifest = '${talos}/tests/devtools/damp.manifest'
    extensions = ['${talos}/pageloader', '${talos}/tests/devtools/addon']
    cycles = 5
    tpcycles = 1
    tpcycles = 1
    tppagecycles = 5
    tploadnocache = True
    tpmozafterpaint = False
    gecko_profile_interval = 10
    gecko_profile_entries = 10000000
    gecko_profile_entries = 10000000
    win_counters = w7_counters = linux_counters = mac_counters = None
    filters = filter.ignore_first.prepare(1) + filter.median.prepare()
    preferences = {'devtools.memory.enabled': True}
    unit = 'ms'
    unit = 'ms'
    subtest_alerts = True
    perfherder_framework = 'devtools'


@register_test()
@register_test()
class glterrain(PageloaderTest):
    """
    Simple rotating WebGL scene with moving light source over a
    textured terrain.
    Measures average frame intervals.
    The same sequence is measured 4 times for combinations of alpha and
    antialias as canvas properties.
    antialias as canvas properties.
    Each of these 4 runs is reported as a different test name.
    """
    tpmanifest = '${talos}/tests/webgl/glterrain.manifest'
    tpcycles = 1
    tppagecycles = 25
    tppagecycles = 25
    tploadnocache = True
    tpmozafterpaint = False
    tpchrome = False
    gecko_profile_interval = 10
    gecko_profile_entries = 2000000
    gecko_profile_entries = 2000000
    win_counters = w7_counters = linux_counters = mac_counters = None
    """ ASAP mode """
    preferences = {'layout.frame_rate': 0,
                   'docshell.event_starvation_delay_hint': 1,
                   'dom.send_after_paint_to_content': False}
                   'dom.send_after_paint_to_content': False}
    filters = filter.ignore_first.prepare(1) + filter.median.prepare()
    unit = 'frame interval'


@register_test()
@register_test()
class glvideo(PageloaderTest):
    """
    WebGL video texture update with 1080p video.
    Measures mean tick time across 100 ticks.
    (each tick is texImage2D(<video>)+setTimeout(0))
    (each tick is texImage2D(<video>)+setTimeout(0))
    """
    tpmanifest = '${talos}/tests/webgl/glvideo.manifest'
    tpcycles = 1
    tppagecycles = 5
    tppagecycles = 5
    tploadnocache = True
    tpmozafterpaint = False
    tpchrome = False
    gecko_profile_interval = 2
    gecko_profile_entries = 2000000
    gecko_profile_entries = 2000000
    win_counters = w7_counters = linux_counters = mac_counters = None
    filters = filter.ignore_first.prepare(1) + filter.median.prepare()
    unit = 'ms'



@register_test()
@register_test()
class tp5n(PageloaderTest):
    """
    Tests the time it takes Firefox to load the tp5 web page test set.

    The tp5 is an updated web page test set to 100 pages from April 8th, 2011.
    The tp5 is an updated web page test set to 100 pages from April 8th, 2011.
    Effort was made for the pages to no longer be splash screens/login
    pages/home pages but to be pages that better reflect the actual content
    of the site in question.
    """
    resolution = 20
    resolution = 20
    tpmanifest = '${talos}/tests/tp5n/tp5n.manifest'
    tpcycles = 1
    tppagecycles = 1
    cycles = 1
    tpmozafterpaint = True
    tpmozafterpaint = True
    tptimeout = 10000
    mainthread = True
    w7_counters = []
    win_counters = []
    linux_counters = []
    mac_counters = []
    xperf_counters = ['main_startup_fileio', 'main_startup_netio',
    xperf_counters = ['main_startup_fileio', 'main_startup_netio',
                      'main_normal_fileio', 'main_normal_netio',
                      'nonmain_startup_fileio', 'nonmain_normal_fileio',
                      'nonmain_normal_netio', 'mainthread_readcount',
                      'mainthread_readbytes', 'mainthread_writecount',
                      'mainthread_writebytes',
                      'time_to_session_store_window_restored_ms',
                      ]
                      ]
    xperf_providers = ['PROC_THREAD', 'LOADER', 'HARD_FAULTS', 'FILENAME',
                       'FILE_IO', 'FILE_IO_INIT']
    xperf_user_providers = ['Mozilla Generic Provider',
                            'Microsoft-Windows-TCPIP']
    xperf_stackwalk = ['FileCreate', 'FileRead', 'FileWrite', 'FileFlush',
    xperf_stackwalk = ['FileCreate', 'FileRead', 'FileWrite', 'FileFlush',
                       'FileClose']
    filters = filter.ignore_first.prepare(1) + filter.median.prepare()
    timeout = 1800
    setup = '${talos}/xtalos/start_xperf.py -c ${talos}/bcontroller.json'
    cleanup = '${talos}/xtalos/parse_xperf.py -c ${talos}/bcontroller.json'
    cleanup = '${talos}/xtalos/parse_xperf.py -c ${talos}/bcontroller.json'
    preferences = {'extensions.enabledScopes': '',
                   'talos.logfile': 'browser_output.txt'}
    unit = 'ms'



@register_test()
class tp5o(PageloaderTest):
    """
    Derived from the tp5n pageset, this is the 49 most reliable webpages.
    """
    """
    tpcycles = 1
    tppagecycles = 25
    cycles = 1
    tpmozafterpaint = True
    tptimeout = 5000
    tptimeout = 5000
    mainthread = False
    tpmanifest = '${talos}/tests/tp5n/tp5o.manifest'
    win_counters = ['% Processor Time']
    w7_counters = ['% Processor Time']
    linux_counters = ['XRes']
    linux_counters = ['XRes']
    mac_counters = []
    responsiveness = True
    gecko_profile_interval = 2
    gecko_profile_entries = 4000000
    gecko_profile_entries = 4000000
    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
    timeout = 1800
    unit = 'ms'



@register_test()
@register_test()
class tp5o_webext(tp5o):
    webextensions = '${talos}/webextensions/dummy/dummy.xpi'
    preferences = {'xpinstall.signatures.required': False}



@register_test()
class tp5o_scroll(PageloaderTest):
    """
    Tests scroll (like tscrollx does, including ASAP) but on the tp5o pageset.
    """
    """
    tpmanifest = '${talos}/tests/tp5n/tp5o.manifest'
    tpcycles = 1
    tppagecycles = 12
    gecko_profile_interval = 2
    gecko_profile_entries = 2000000
    gecko_profile_entries = 2000000
    tpscrolltest = True
    """ASAP mode"""
    tpmozafterpaint = False
    tpmozafterpaint = False
    preferences = {'layout.frame_rate': 0,
    preferences = {'layout.frame_rate': 0,
                   'docshell.event_starvation_delay_hint': 1,
                   'dom.send_after_paint_to_content': True,
                   'apz.paint_skipping.enabled': False,
                   'apz.paint_skipping.enabled': False,
                   'layout.css.scroll-behavior.spring-constant': "'10'",
                   'toolkit.framesRecording.bufferSize': 10000}
    filters = filter.ignore_first.prepare(1) + filter.median.prepare()
    unit = '1/FPS'
    unit = '1/FPS'


@register_test()
class v8_7(PageloaderTest):
    """
    """
    This is the V8 (version 7) javascript benchmark taken verbatim and
    slightly modified to fit into our pageloader extension and talos harness.

    The previous version of this test is V8 version 5 which was run on
    selective branches and operating systems.
    selective branches and operating systems.
    """
    tpmanifest = '${talos}/tests/v8_7/v8.manifest'
    gecko_profile_interval = 1
    gecko_profile_entries = 1000000
    tpcycles = 1
    tpcycles = 1
    resolution = 20
    tpmozafterpaint = False
    preferences = {'dom.send_after_paint_to_content': False}
    filters = filter.v8_subtest.prepare()
    unit = 'score'
    unit = 'score'
    lower_is_better = False


@register_test()
@register_test()
class kraken(PageloaderTest):
    """
    This is the Kraken javascript benchmark taken verbatim and slightly
    modified to fit into our pageloader extension and talos harness.
    modified to fit into our pageloader extension and talos harness.
    """
    tpmanifest = '${talos}/tests/kraken/kraken.manifest'
    tpcycles = 1
    tppagecycles = 1
    gecko_profile_interval = 1
    gecko_profile_interval = 1
    gecko_profile_entries = 5000000
    tpmozafterpaint = False
    tpchrome = False
    preferences = {'dom.send_after_paint_to_content': False}
    filters = filter.mean.prepare()
    filters = filter.mean.prepare()
    unit = 'score'


@register_test()
class basic_compositor_video(PageloaderTest):
class basic_compositor_video(PageloaderTest):
    """
    Video test
    """
    tpmanifest = '${talos}/tests/video/video.manifest'
    tpcycles = 1
    tpcycles = 1
    tppagecycles = 12
    tpchrome = False
    timeout = 10000
    gecko_profile_interval = 1
    gecko_profile_entries = 2000000
    gecko_profile_entries = 2000000
    preferences = {'full-screen-api.allow-trusted-requests-only': False,
                   'layers.acceleration.force-enabled': False,
                   'layers.acceleration.disabled': True,
                   'layout.frame_rate': 0,
                   'docshell.event_starvation_delay_hint': 1,
                   'docshell.event_starvation_delay_hint': 1,
                   'full-screen-api.warning.timeout': 500,
                   'media.ruin-av-sync.enabled': True}
    filters = filter.ignore_first.prepare(1) + filter.median.prepare()
    unit = 'ms/frame'
    lower_is_better = True
    lower_is_better = True


class dromaeo(PageloaderTest):
    """abstract base class for dramaeo tests"""
    filters = filter.dromaeo.prepare()
    filters = filter.dromaeo.prepare()
    lower_is_better = False
    alert_threshold = 5.0
    tpchrome = False



@register_test()
class dromaeo_css(dromaeo):
    """
    Dromaeo suite of tests for JavaScript performance testing.
    See the Dromaeo wiki (https://wiki.mozilla.org/Dromaeo)
    See the Dromaeo wiki (https://wiki.mozilla.org/Dromaeo)
    for more information.

    Each page in the manifest is part of the dromaemo css benchmark.
    """
    gecko_profile_interval = 2
    gecko_profile_interval = 2
    gecko_profile_entries = 10000000
    tpmanifest = '${talos}/tests/dromaeo/css.manifest'
    unit = 'score'



@register_test()
class dromaeo_dom(dromaeo):
    """
    Dromaeo suite of tests for JavaScript performance testing.
    See the Dromaeo wiki (https://wiki.mozilla.org/Dromaeo)
    See the Dromaeo wiki (https://wiki.mozilla.org/Dromaeo)
    for more information.

    Each page in the manifest is part of the dromaemo dom benchmark.
    """
    """
    gecko_profile_interval = 2
    gecko_profile_entries = 10000000
    tpmanifest = '${talos}/tests/dromaeo/dom.manifest'
    unit = 'score'


@register_test()
@register_test()
class tresize(PageloaderTest):
    """
    This test does some resize thing.
    """
    tpmanifest = '${talos}/tests/tresize/tresize.manifest'
    tpmanifest = '${talos}/tests/tresize/tresize.manifest'
    extensions = ['${talos}/pageloader', '${talos}/tests/tresize/addon']
    tppagecycles = 20
    timeout = 900
    gecko_profile_interval = 2
    gecko_profile_entries = 1000000
    gecko_profile_entries = 1000000
    tpmozafterpaint = True
    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
    unit = 'ms'



@register_test()
class tsvgm(PageloaderTest):
    """
    An svg-only number that measures SVG rendering performance
    for dynamic content only.
    for dynamic content only.
    """
    tpmanifest = '${talos}/tests/svgx/svgm.manifest'
    tpcycles = 1
    tppagecycles = 7
    tpmozafterpaint = False
    tpchrome = False
    gecko_profile_interval = 10
    gecko_profile_interval = 10
    gecko_profile_entries = 1000000
    """ASAP mode"""
    preferences = {'layout.frame_rate': 0,
                   'docshell.event_starvation_delay_hint': 1,
                   'dom.send_after_paint_to_content': False}
    filters = filter.ignore_first.prepare(2) + filter.median.prepare()
    unit = 'ms'
    unit = 'ms'


@register_test()
class tsvgx(PageloaderTest):
    """
    """
    An svg-only number that measures SVG rendering performance
    for dynamic content only.
    """
    tpmanifest = '${talos}/tests/svgx/svgx.manifest'
    tpcycles = 1
    tpcycles = 1
    tppagecycles = 25
    tpmozafterpaint = False
    tpchrome = False
    gecko_profile_interval = 10
    gecko_profile_entries = 1000000
    gecko_profile_entries = 1000000
    """ASAP mode"""
    preferences = {'layout.frame_rate': 0,
    preferences = {'layout.frame_rate': 0,
                   'docshell.event_starvation_delay_hint': 1,
                   'dom.send_after_paint_to_content': False}
    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
    unit = 'ms'



@register_test()
class tsvg_static(PageloaderTest):
    """
    An svg-only number that measures SVG rendering performance
    An svg-only number that measures SVG rendering performance
    for static content only.
    """
    tpmanifest = '${talos}/tests/svg_static/svg_static.manifest'
    tpcycles = 1
    tpcycles = 1
    tppagecycles = 25
    tpmozafterpaint = True
    tpchrome = False
    gecko_profile_interval = 1
    gecko_profile_entries = 10000000
    gecko_profile_entries = 10000000
    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
    unit = 'ms'


@register_test()
@register_test()
class tsvgr_opacity(PageloaderTest):
    """
    An svg-only number that measures SVG rendering performance.
    """
    tpmanifest = '${talos}/tests/svg_opacity/svg_opacity.manifest'
    tpmanifest = '${talos}/tests/svg_opacity/svg_opacity.manifest'
    tpcycles = 1
    tppagecycles = 25
    tpmozafterpaint = True
    tpchrome = False
    gecko_profile_interval = 1
    gecko_profile_interval = 1
    gecko_profile_entries = 10000000
    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
    unit = 'ms'



@register_test()
class tscrollx(PageloaderTest):
    """
    This test does some scrolly thing.
    """
    """
    tpmanifest = '${talos}/tests/scroll/scroll.manifest'
    tpcycles = 1
    tppagecycles = 25
    tpmozafterpaint = False
    tpchrome = False
    tpchrome = False
    gecko_profile_interval = 1
    gecko_profile_entries = 1000000
    """ ASAP mode """
    """ ASAP mode """
    preferences = {'layout.frame_rate': 0,
                   'docshell.event_starvation_delay_hint': 1,
                   'dom.send_after_paint_to_content': True,
                   'apz.paint_skipping.enabled': False,
                   'layout.css.scroll-behavior.spring-constant': "'10'",
                   'layout.css.scroll-behavior.spring-constant': "'10'",
                   'toolkit.framesRecording.bufferSize': 10000}
    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
    unit = 'ms'



@register_test()
class a11yr(PageloaderTest):
    """
    This test ensures basic a11y tables and permutations do not cause
    performance regressions.
    performance regressions.
    """
    tpmanifest = '${talos}/tests/a11y/a11y.manifest'
    tpcycles = 1
    tppagecycles = 25
    tpmozafterpaint = True
    tpmozafterpaint = True
    tpchrome = False
    preferences = {'dom.send_after_paint_to_content': False}
    unit = 'ms'
    alert_threshold = 5.0
    alert_threshold = 5.0
    a11y = True


class WebkitBenchmark(PageloaderTest):
    tpcycles = 1
    tpcycles = 1
    tppagecycles = 5
    tpmozafterpaint = False
    tpchrome = False
    format_pagename = False
    lower_is_better = False
    lower_is_better = False
    unit = 'score'


@register_test()
class stylebench(WebkitBenchmark):
class stylebench(WebkitBenchmark):
    # StyleBench benchmark used by many browser vendors (from webkit)
    tpmanifest = '${talos}/tests/stylebench/stylebench.manifest'


@register_test()
@register_test()
class motionmark_animometer(WebkitBenchmark):
    # MotionMark benchmark used by many browser vendors (from webkit)
    tpmanifest = '${talos}/tests/motionmark/animometer.manifest'



@register_test()
class motionmark_webgl(WebkitBenchmark):
class motionmark_webgl(WebkitBenchmark):
    # MotionMark benchmark used by many browser vendors (from webkit)
    tpmanifest = '${talos}/tests/motionmark/webgl.manifest'
    unit = 'fps'



@register_test()
class ARES6(WebkitBenchmark):
    # ARES-6 benchmark used by many browser vendors (from webkit)
    tpmanifest = '${talos}/tests/ares6/ares6.manifest'
    tppagecycles = 1
    tppagecycles = 1
    lower_is_better = True


@register_test()
class motionmark_htmlsuite(WebkitBenchmark):
class motionmark_htmlsuite(WebkitBenchmark):
    # MotionMark benchmark used by many browser vendors (from webkit)
    tpmanifest = '${talos}/tests/motionmark/htmlsuite.manifest'


@register_test()
@register_test()
class JetStream(WebkitBenchmark):
    # JetStream benchmark used by many browser vendors (from webkit)
    tpmanifest = '${talos}/tests/jetstream/jetstream.manifest'
    tppagecycles = 1


@register_test()
class perf_reftest(PageloaderTest):
    """
    """
    Style perf-reftest a set of tests where the result is the difference of base vs ref pages
    """
    base_vs_ref = True  # compare the two test pages with eachother and report comparison
    tpmanifest = '${talos}/tests/perf-reftest/perf_reftest.manifest'
    tpcycles = 1
    tpcycles = 1
    tppagecycles = 10
    tptimeout = 30000
    gecko_profile_interval = 1
    gecko_profile_entries = 2000000
    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
    unit = 'ms'
    lower_is_better = True
    alert_threshold = 5.0
    subtest_alerts = True



@register_test()
class perf_reftest_singletons(PageloaderTest):
    """
    Style perf-reftests run as individual tests
    Style perf-reftests run as individual tests
    """
    tpmanifest = '${talos}/tests/perf-reftest-singletons/perf_reftest_singletons.manifest'
    tpcycles = 1
    tppagecycles = 15
    tppagecycles = 15
    tptimeout = 30000
    gecko_profile_interval = 1
    gecko_profile_entries = 2000000
    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
    unit = 'ms'
    unit = 'ms'
    lower_is_better = True
    alert_threshold = 5.0
    subtest_alerts = True
    suite_should_alert = False



@register_test()
class displaylist_mutate(PageloaderTest):
    """
    Test modifying single items in a large display list. Measure transaction speed
    Test modifying single items in a large display list. Measure transaction speed
    to the compositor.
    """
    tpmanifest = '${talos}/tests/layout/displaylist_mutate.manifest'
    tpcycles = 1
    tppagecycles = 5
    tppagecycles = 5
    tploadnocache = True
    tpmozafterpaint = False
    tpchrome = False
    gecko_profile_interval = 2
    gecko_profile_entries = 2000000
    gecko_profile_entries = 2000000
    win_counters = w7_counters = linux_counters = mac_counters = None
    filters = filter.ignore_first.prepare(1) + filter.median.prepare()
    """ASAP mode"""
    preferences = {'layout.frame_rate': 0,
                   'docshell.event_starvation_delay_hint': 1,
                   'dom.send_after_paint_to_content': False}
    unit = 'ms'



@register_test()
class rasterflood_svg(PageloaderTest):
    """
    Test modifying single items in a large display list. Measure transaction speed
    to the compositor.
    to the compositor.
    """
    tpmanifest = '${talos}/tests/gfx/rasterflood_svg.manifest'
    tpcycles = 1
    tppagecycles = 10
    tploadnocache = True
    tploadnocache = True
    tpmozafterpaint = False
    tpchrome = False
    gecko_profile_interval = 2
    gecko_profile_entries = 2000000
    win_counters = w7_counters = linux_counters = mac_counters = None
    win_counters = w7_counters = linux_counters = mac_counters = None
    filters = filter.ignore_first.prepare(1) + filter.median.prepare()
    """ASAP mode"""
    preferences = {'layout.frame_rate': 0,
                   'docshell.event_starvation_delay_hint': 1,
                   'dom.send_after_paint_to_content': False}
    unit = 'ms'


@register_test()
class rasterflood_gradient(PageloaderTest):
    """
    """
    Test expensive rasterization while the main thread is busy.
    """
    tpmanifest = '${talos}/tests/gfx/rasterflood_gradient.manifest'
    tpcycles = 1
    tppagecycles = 10
    tppagecycles = 10
    tploadnocache = True
    tpmozafterpaint = False
    tpchrome = False
    gecko_profile_interval = 2
    gecko_profile_entries = 2000000
    gecko_profile_entries = 2000000
    win_counters = w7_counters = linux_counters = mac_counters = None
    filters = filter.ignore_first.prepare(1) + filter.median.prepare()
    """ASAP mode"""
    preferences = {'layout.frame_rate': 0,
                   'docshell.event_starvation_delay_hint': 1,
                   'docshell.event_starvation_delay_hint': 1,
                   'dom.send_after_paint_to_content': False}
    lower_is_better = False
    unit = 'score'


@register_test()
class about_preferences_basic(PageloaderTest):
    """
    Base class for about_preferences test
    Base class for about_preferences test
    """
    tpmanifest = '${talos}/tests/about-preferences/about_preferences_basic.manifest'
    # this test uses 'about:blank' as a dummy page (see manifest) so that the pages
    # that just change url categories (i.e. about:preferences#search) will get a load event
    # also any of the url category pages cannot have more than one tppagecycle
    # also any of the url category pages cannot have more than one tppagecycle
    tpcycles = 25
    tppagecycles = 1
    gecko_profile_interval = 1
    gecko_profile_entries = 2000000
    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
    unit = 'ms'
    lower_is_better = True
    fnbpaint = True



@register_test()
class about_newtab_with_snippets(PageloaderTest):
    """
    Load about ActivityStream (about:home and about:newtab) with snippets enabled
    """
    """
    tpmanifest = '${talos}/tests/about-newtab/about_newtab.manifest'
    tpcycles = 25
    tppagecycles = 1
    responsiveness = True
    gecko_profile_interval = 1
    gecko_profile_interval = 1
    gecko_profile_entries = 2000000
    filters = filter.ignore_first.prepare(5) + filter.median.prepare()
    unit = 'ms'
    lower_is_better = True
    fnbpaint = True
    fnbpaint = True
    preferences = {
            # ensure that snippets are turned on and load the json messages
            'browser.newtabpage.activity-stream.asrouter.providers.snippets':\
            '{"id":"snippets","enabled":true,"type":"json","location":\
            "http://fakedomain/tests/about-newtab/snippets.json",\
            "http://fakedomain/tests/about-newtab/snippets.json",\
            "updateCycleInMs":14400000}',
            'browser.newtabpage.activity-stream.feeds.snippets': True,
            'browser.newtabpage.activity-stream.feeds.section.topstories': True,
            'browser.newtabpage.activity-stream.feeds.section.topstories.options':\
            '{"provider_name":""}',
            'browser.newtabpage.activity-stream.discoverystream.endpoints': 'http://fakedomain',
            'browser.newtabpage.activity-stream.discoverystream.config':\
            '{"api_key_pref":"extensions.pocket.oAuthConsumerKey","collapsible":true,\
            "enabled":true,"show_spocs":false,"hardcoded_layout":false,"personalized":true,\
            "enabled":true,"show_spocs":false,"hardcoded_layout":false,"personalized":true,\
            "layout_endpoint":\
            "http://fakedomain/tests/about-newtab/ds_layout.json"}'
            }