Commit 67def4fd authored by Dominic Mazzoni's avatar Dominic Mazzoni Committed by Commit Bot

Disable built-in TTS engine during Chrome OS accessibility E2E tests

All of these tests were triggering starting the "real" TTS engine, even
though a mock TTS engine was installed.

I ran all of the ChromeVoxBackground tests before and after this change
on my system with --test-launcher-jobs=20. If the speech engine is
installed, the average test time drops 30%, from 8200 ms to 6200 ms.
Even if the speech engine is not installed, it still drops 25% from
7700 ms to 6200 ms.

Bug: none
Change-Id: Iea23951ce397176cd1fda64d801422f3031a1fba
AX-Relnotes: N/A
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2422585
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810437}
parent c176476e
...@@ -14,6 +14,7 @@ AccessibilityCommonE2ETest = class extends E2ETestBase { ...@@ -14,6 +14,7 @@ AccessibilityCommonE2ETest = class extends E2ETestBase {
/** @override */ /** @override */
testGenCppIncludes() { testGenCppIncludes() {
super.testGenCppIncludes();
GEN(` GEN(`
#include "ash/accessibility/accessibility_delegate.h" #include "ash/accessibility/accessibility_delegate.h"
#include "ash/shell.h" #include "ash/shell.h"
...@@ -27,6 +28,7 @@ AccessibilityCommonE2ETest = class extends E2ETestBase { ...@@ -27,6 +28,7 @@ AccessibilityCommonE2ETest = class extends E2ETestBase {
/** @override */ /** @override */
testGenPreamble() { testGenPreamble() {
super.testGenPreamble();
// Note that at least one accessibility common feature has to be enabled for // Note that at least one accessibility common feature has to be enabled for
// the extension to load. Extension load is required for this test suite to // the extension to load. Extension load is required for this test suite to
// have a place to be injected. // have a place to be injected.
......
...@@ -15,6 +15,7 @@ GEN_INCLUDE([ ...@@ -15,6 +15,7 @@ GEN_INCLUDE([
ChromeVoxE2ETest = class extends E2ETestBase { ChromeVoxE2ETest = class extends E2ETestBase {
/** @override */ /** @override */
testGenCppIncludes() { testGenCppIncludes() {
super.testGenCppIncludes();
GEN(` GEN(`
#include "ash/accessibility/accessibility_delegate.h" #include "ash/accessibility/accessibility_delegate.h"
#include "ash/shell.h" #include "ash/shell.h"
...@@ -29,6 +30,7 @@ ChromeVoxE2ETest = class extends E2ETestBase { ...@@ -29,6 +30,7 @@ ChromeVoxE2ETest = class extends E2ETestBase {
/** @override */ /** @override */
testGenPreamble() { testGenPreamble() {
super.testGenPreamble();
GEN(` GEN(`
auto allow = extension_l10n_util::AllowGzippedMessagesAllowedForTest(); auto allow = extension_l10n_util::AllowGzippedMessagesAllowedForTest();
base::Closure load_cb = base::Closure load_cb =
......
...@@ -16,6 +16,20 @@ E2ETestBase = class extends testing.Test { ...@@ -16,6 +16,20 @@ E2ETestBase = class extends testing.Test {
this.desktop_; this.desktop_;
} }
/** @override */
testGenCppIncludes() {
GEN(`
#include "chrome/browser/speech/extension_api/tts_engine_extension_api.h"
`);
}
/** @override */
testGenPreamble() {
GEN(`
TtsExtensionEngine::GetInstance()->DisableBuiltInTTSEngineForTesting();
`);
}
/** /**
* Listens and waits for the first event on the given node of the given type. * Listens and waits for the first event on the given node of the given type.
* @param {!chrome.automation.AutomationNode} node * @param {!chrome.automation.AutomationNode} node
......
...@@ -10,6 +10,7 @@ GEN_INCLUDE(['../common/testing/e2e_test_base.js']); ...@@ -10,6 +10,7 @@ GEN_INCLUDE(['../common/testing/e2e_test_base.js']);
SelectToSpeakE2ETest = class extends E2ETestBase { SelectToSpeakE2ETest = class extends E2ETestBase {
/** @override */ /** @override */
testGenCppIncludes() { testGenCppIncludes() {
super.testGenCppIncludes();
GEN(` GEN(`
#include "ash/accessibility/accessibility_delegate.h" #include "ash/accessibility/accessibility_delegate.h"
#include "ash/keyboard/ui/keyboard_util.h" #include "ash/keyboard/ui/keyboard_util.h"
...@@ -24,6 +25,7 @@ SelectToSpeakE2ETest = class extends E2ETestBase { ...@@ -24,6 +25,7 @@ SelectToSpeakE2ETest = class extends E2ETestBase {
/** @override */ /** @override */
testGenPreamble() { testGenPreamble() {
super.testGenPreamble();
GEN(` GEN(`
//keyboard::SetRequestedKeyboardState(keyboard::KEYBOARD_STATE_ENABLED); //keyboard::SetRequestedKeyboardState(keyboard::KEYBOARD_STATE_ENABLED);
//ash::Shell::Get()->CreateKeyboard(); //ash::Shell::Get()->CreateKeyboard();
......
...@@ -10,6 +10,7 @@ GEN_INCLUDE([ ...@@ -10,6 +10,7 @@ GEN_INCLUDE([
SwitchAccessE2ETest = class extends E2ETestBase { SwitchAccessE2ETest = class extends E2ETestBase {
/** @override */ /** @override */
testGenCppIncludes() { testGenCppIncludes() {
super.testGenCppIncludes();
GEN(` GEN(`
#include "ash/accessibility/accessibility_delegate.h" #include "ash/accessibility/accessibility_delegate.h"
#include "ash/shell.h" #include "ash/shell.h"
...@@ -24,6 +25,7 @@ SwitchAccessE2ETest = class extends E2ETestBase { ...@@ -24,6 +25,7 @@ SwitchAccessE2ETest = class extends E2ETestBase {
/** @override */ /** @override */
testGenPreamble() { testGenPreamble() {
super.testGenPreamble();
GEN(` GEN(`
base::Closure load_cb = base::Closure load_cb =
base::Bind(&chromeos::AccessibilityManager::SetSwitchAccessEnabled, base::Bind(&chromeos::AccessibilityManager::SetSwitchAccessEnabled,
......
...@@ -329,6 +329,9 @@ void TtsExtensionEngine::Resume(content::TtsUtterance* utterance) { ...@@ -329,6 +329,9 @@ void TtsExtensionEngine::Resume(content::TtsUtterance* utterance) {
bool TtsExtensionEngine::LoadBuiltInTtsEngine( bool TtsExtensionEngine::LoadBuiltInTtsEngine(
content::BrowserContext* browser_context) { content::BrowserContext* browser_context) {
if (disable_built_in_tts_engine_for_testing_)
return false;
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
Profile* profile = Profile::FromBrowserContext(browser_context); Profile* profile = Profile::FromBrowserContext(browser_context);
......
...@@ -36,6 +36,13 @@ class TtsExtensionEngine : public content::TtsEngineDelegate { ...@@ -36,6 +36,13 @@ class TtsExtensionEngine : public content::TtsEngineDelegate {
void Pause(content::TtsUtterance* utterance) override; void Pause(content::TtsUtterance* utterance) override;
void Resume(content::TtsUtterance* utterance) override; void Resume(content::TtsUtterance* utterance) override;
bool LoadBuiltInTtsEngine(content::BrowserContext* browser_context) override; bool LoadBuiltInTtsEngine(content::BrowserContext* browser_context) override;
void DisableBuiltInTTSEngineForTesting() {
disable_built_in_tts_engine_for_testing_ = true;
}
private:
bool disable_built_in_tts_engine_for_testing_ = false;
}; };
// Function that allows tts engines to update its list of supported voices at // Function that allows tts engines to update its list of supported voices at
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment