tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_accessibility_tree_navigation_oop.js (3740B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const TEST_URI = `<h1>Top level header</h1><p>This is a paragraph.</p>`;
      7 
      8 /**
      9 * Test data has the format of:
     10 * {
     11 *   desc     {String}    description for better logging
     12 *   setup    {Function}  An optional setup that needs to be performed before
     13 *                        the state of the tree and the sidebar can be checked.
     14 *   expected {JSON}      An expected states for the tree and the sidebar.
     15 * }
     16 */
     17 const tests = [
     18  {
     19    desc: "Test the initial accessibility tree and sidebar states.",
     20    expected: {
     21      tree: [
     22        {
     23          role: "document",
     24          name: `""text label`,
     25          badges: ["text label"],
     26        },
     27      ],
     28      sidebar: {
     29        name: null,
     30        role: "document",
     31        actions: [],
     32        value: "",
     33        description: "",
     34        keyboardShortcut: "",
     35        childCount: 1,
     36        indexInParent: 0,
     37        states: [
     38          // The focused state is an outdated state, since the toolbox should now
     39          // have the focus and not the content page. See Bug 1702709.
     40          "focused",
     41          "readonly",
     42          "focusable",
     43          "selectable text",
     44          "opaque",
     45          "enabled",
     46          "sensitive",
     47        ],
     48      },
     49    },
     50  },
     51  {
     52    desc: "Expand first tree node.",
     53    setup: ({ doc }) => toggleRow(doc, 0),
     54    expected: {
     55      tree: [
     56        {
     57          role: "document",
     58          name: `""text label`,
     59          badges: ["text label"],
     60        },
     61        {
     62          role: "internal frame",
     63          name: `"Accessibility Panel Test (OOP)"`,
     64        },
     65      ],
     66    },
     67  },
     68  {
     69    desc: "Expand second tree node. Display OOP document.",
     70    setup: ({ doc }) => toggleRow(doc, 1),
     71    expected: {
     72      tree: [
     73        {
     74          role: "document",
     75          name: `""text label`,
     76          badges: ["text label"],
     77        },
     78        {
     79          role: "internal frame",
     80          name: `"Accessibility Panel Test (OOP)"`,
     81        },
     82        {
     83          role: "document",
     84          name: `"Accessibility Panel Test (OOP)"`,
     85        },
     86      ],
     87      sidebar: {
     88        name: "Accessibility Panel Test (OOP)",
     89        role: "internal frame",
     90        actions: [],
     91        value: "",
     92        description: "",
     93        keyboardShortcut: "",
     94        childCount: 1,
     95        indexInParent: 0,
     96        states: ["focusable", "opaque", "enabled", "sensitive"],
     97      },
     98    },
     99  },
    100  {
    101    desc: "Expand third tree node. Display OOP frame content.",
    102    setup: ({ doc }) => toggleRow(doc, 2),
    103    expected: {
    104      tree: [
    105        {
    106          role: "document",
    107          name: `""text label`,
    108          badges: ["text label"],
    109        },
    110        {
    111          role: "internal frame",
    112          name: `"Accessibility Panel Test (OOP)"`,
    113        },
    114        {
    115          role: "document",
    116          name: `"Accessibility Panel Test (OOP)"`,
    117        },
    118        {
    119          role: "heading",
    120          name: `"Top level header"`,
    121        },
    122        {
    123          role: "paragraph",
    124          name: `""`,
    125        },
    126      ],
    127      sidebar: {
    128        name: "Accessibility Panel Test (OOP)",
    129        role: "document",
    130        actions: [],
    131        value: "",
    132        description: "",
    133        keyboardShortcut: "",
    134        childCount: 2,
    135        indexInParent: 0,
    136        states: [
    137          "readonly",
    138          "focusable",
    139          "selectable text",
    140          "opaque",
    141          "enabled",
    142          "sensitive",
    143        ],
    144      },
    145    },
    146  },
    147 ];
    148 
    149 /**
    150 * Check navigation within the tree.
    151 */
    152 addA11yPanelTestsTask(
    153  tests,
    154  TEST_URI,
    155  "Test Accessibility panel tree navigation with OOP frame.",
    156  { remoteIframe: true }
    157 );