dmazzoni | 2f48975 | 2017-02-16 03:39:16 | [diff] [blame] | 1 | # ChromeVox (for developers) |
| 2 | |
| 3 | ChromeVox is the built-in screen reader on Chrome OS. It was originally |
| 4 | developed as a separate extension but now the code lives inside of the Chromium |
| 5 | tree and it's built as part of Chrome OS. |
| 6 | |
| 7 | To start or stop ChromeVox on Chrome OS, press Ctrl+Alt+Z at any time. |
| 8 | |
| 9 | ## Developer Info |
| 10 | |
| 11 | Code location: ```chrome/browser/resources/chromeos/chromevox``` |
| 12 | |
| 13 | Ninja target: it's built as part of "chrome", but you can build and run |
| 14 | chromevox_tests to test it (Chrome OS target only - you must have target_os = |
| 15 | "chromeos" in your GN args first). |
| 16 | |
| 17 | ## Developing On Linux |
| 18 | |
| 19 | ChromeVox for Chrome OS development is done on Linux. |
| 20 | |
| 21 | See [ChromeVox on Desktop Linux](chromevox_on_desktop_linux.md) |
| 22 | for more information. |
| 23 | |
| 24 | ## ChromeVox Next |
| 25 | |
| 26 | ChromeVox Next is the code name we use for a major new rewrite to ChromeVox that |
| 27 | uses the automation API instead of content scripts. The code is part of |
| 28 | ChromeVox (unique ChromeVox Next code is found in |
| 29 | chrome/browser/resources/chromeos/chromevox/cvox2). |
| 30 | |
| 31 | ChromeVox contains all of the classic and next code in the same codebase, it |
| 32 | switches its behavior dynamically based on the mode: |
| 33 | |
| 34 | * Next: as of version 56 of Chrome/Chrome OS, this is default. ChromeVox uses new key/braille bindings, earcons, speech/braille output style, the Next engine (Automation API), and other major/minor improvements |
| 35 | * Next Compat: in order to maintain compatibility with some clients of the ChromeVox Classic js APIs, some sites have been whitelisted for this mode. ChromeVox will inject classic content scripts, but expose a Next-like user experience (like above) |
| 36 | * Classic: as of version 56 of Chrome/Chrome OS, this mode gets enabled via a keyboard toggle Search+Q. Once enabled, ChromeVox will behave like it did in the past including keyboard bindings, earcons, speech/braille output style, and the underlying engine (content scripts). |
| 37 | * Classic compat for some sites that require Next, while running in Classic, ChromeVox will use the Next engine but expose a Classic user experience (like above) |
| 38 | |
| 39 | Once it's ready, the plan is to retire everything other than Next mode. |
| 40 | |
| 41 | ## ChromeVox Next |
| 42 | |
| 43 | To test ChromeVox Next, click on the Gear icon in the upper-right of the screen |
| 44 | to open the ChromeVox options (or press the keyboard shortcut Search+Shift+O, O) |
| 45 | and then click the box to opt into ChromeVox Next. |
| 46 | |
| 47 | If you are running m56 or later, you already have ChromeVox Next on by |
| 48 | default. To switch back to Classic, press Search+Q. |
| 49 | |
| 50 | ## Debugging ChromeVox |
| 51 | |
| 52 | There are options available that may assist in debugging ChromeVox. Here are a |
| 53 | few use cases. |
| 54 | |
| 55 | ### Feature development |
| 56 | |
| 57 | When developing a new feature, it may be helpful to save time by not having to |
| 58 | go through a compile cycle. This can be achieved by setting |
| 59 | ```chromevox_compress_js``` to 0 in |
| 60 | chrome/browser/resources/chromeos/chromevox/BUILD.gn, or by using a debug build. |
| 61 | |
| 62 | In a debug build or with chromevox_compress_js off, the unflattened files in the |
| 63 | Chrome out directory (e.g. out/Release/resources/chromeos/chromevox/). Now you |
| 64 | can hack directly on the copy of ChromeVox in out/ and toggle ChromeVox to pick |
| 65 | up your changes (via Ctrl+Alt+Z). |
| 66 | |
| 67 | ### Fixing bugs |
| 68 | |
| 69 | The easiest way to debug ChromeVox is from an external browser. Start Chrome |
| 70 | with this command-line flag: |
| 71 | |
| 72 | ```out/Release/chrome --remote-debugging-port=9222``` |
| 73 | |
| 74 | Now open http://localhost:9222 in a separate instance of the browser, and debug the ChromeVox extension background page from there. |
| 75 | |
| 76 | Another option is to use emacs jade (available through -mx |
| 77 | package-list-packages). |
| 78 | |
| 79 | It also talks to localhost:9222 but integrates more tightly into emacs instead. |
| 80 | |
| 81 | Another option is to use the built-in developer console. Go to the |
| 82 | ChromeVox options page with Search+Shift+o, o; then, substitute the |
| 83 | “options.html” path with “background.html”, and then open up the |
| 84 | inspector. |
| 85 | |
| 86 | ### Running tests |
| 87 | |
| 88 | Build the chromevox_tests target. To run |
| 89 | lots of tests in parallel, run it like this: |
| 90 | |
| 91 | ```out/Release/chromevox_tests --test-launcher-jobs=20``` |
| 92 | |
| 93 | Use a test filter if you only want to run some of the tests from a |
| 94 | particular test suite - for example, most of the ChromeVox Next tests |
| 95 | have "E2E" in them (for "end-to-end"), so to only run those: |
| 96 | |
| 97 | ```out/Release/chromevox_tests --test-launcher-jobs=20 --gtest_filter="*E2E*"``` |
| 98 | |
| 99 | ## ChromeVox for other platforms |
| 100 | |
| 101 | ChromeVox can be run as an installable extension, separate from a |
| 102 | linux Chrome OS build. |
| 103 | |
| 104 | ### From source |
| 105 | |
| 106 | chrome/browser/resources/chromeos/chromevox/tools has the required scripts that pack ChromeVox as an extension and make any necessary manifest changes. |
| 107 | |
| 108 | ### From Webstore |
| 109 | |
| 110 | Alternatively, the webstore has the stable version of ChromeVox. |
| 111 | |
| 112 | To install without interacting with the webstore UI, place the |
| 113 | following json block in |
| 114 | /opt/google/chrome-unstable/extensions/kgejglhpjiefppelpmljglcjbhoiplfn.json |
| 115 | |
| 116 | ``` |
| 117 | { |
| 118 | "external_update_url": "https://clients2.google.com/service/update2/crx" |
| 119 | } |
| 120 | ``` |
| 121 | |
| 122 | If you're using the desktop Linux version of Chrome, we recommend you |
| 123 | use Voxin for speech. Run chrome with: “google-chrome |
| 124 | --enable-speech-dispatcher” and select a voice provided by the speechd |
| 125 | package from the ChromeVox options page (ChromeVox+o, o). As of the |
| 126 | latest revision of Chrome 44, speechd support has become stable enough |
| 127 | to use with ChromeVox, but still requires the flag. |
| 128 | |
| 129 | In the ChromeVox options page, select the flat keymap and use sticky |
| 130 | mode (double press quickly of insert) to emulate a modal screen |
| 131 | reader. |