Skip to content

Commit

Permalink
Fold chromevox_tests into browser_tests
Browse files Browse the repository at this point in the history
chromevox_tests compiles and links all of chrome, so folding into
browser_tests will save work on the bots. It will also give coverage
for SingleProcessMash and other projects that run browser_tests with
optional flags.

Rename the tests to start with ChromeVox to make them easier to run
with --gtest_filter (thanks to dtseng for a CL that did the rename).

Fix ChromeVoxEditingTest.RichTextSelectByLine so it isn't sensitive
to exact font widths and remove chromevox_tests fontconfig override.

Bug: 892179, 898213
Test: browser_tests

Change-Id: Ia23c8f4c237677d299bbe774cf3191654974a56b
Reviewed-on: https://chromium-review.googlesource.com/c/1294811
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: David Tseng <dtseng@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602543}
  • Loading branch information
James Cook authored and Commit Bot committed Oct 25, 2018
1 parent 9ebbc50 commit 1380ad1
Show file tree
Hide file tree
Showing 60 changed files with 709 additions and 729 deletions.
13 changes: 0 additions & 13 deletions base/test/fontconfig_util_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,6 @@ const char kFontsConfTemplate[] = R"(<?xml version="1.0"?>
</edit>
</match>
<!-- TODO(thomasanderson): Figure out why this is necessary. -->
<match target="pattern">
<test name="family" compare="eq">
<string>Tinos</string>
</test>
<test name="prgname" compare="eq">
<string>chromevox_tests</string>
</test>
<edit name="hintstyle" mode="assign">
<const>hintslight</const>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>Times</string>
Expand Down
46 changes: 12 additions & 34 deletions chrome/browser/resources/chromeos/chromevox/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -485,46 +485,16 @@ if (chromevox_compress_js) {
}
}

test("chromevox_tests") {
sources = [
"//chrome/browser/extensions/browsertest_util.cc",
"//chrome/browser/extensions/browsertest_util.h",
"//chrome/browser/ui/webui/web_ui_test_handler.cc",
"//chrome/browser/ui/webui/web_ui_test_handler.h",
"//chrome/test/base/extension_js_browser_test.cc",
"//chrome/test/base/extension_js_browser_test.h",
"//chrome/test/base/extension_load_waiter_one_shot.cc",
"//chrome/test/base/extension_load_waiter_one_shot.h",
"//chrome/test/base/javascript_browser_test.cc",
"//chrome/test/base/javascript_browser_test.h",
"//chrome/test/base/test_chrome_web_ui_controller_factory.cc",
"//chrome/test/base/test_chrome_web_ui_controller_factory.h",
"//chrome/test/base/web_ui_browser_test.cc",
"//chrome/test/base/web_ui_browser_test.h",
]
source_set("browser_tests") {
testonly = true
assert(enable_extensions)

deps = [
":chromevox_extjs_tests",
":chromevox_unitjs_tests",
"//base",
"//base:i18n",
"//base/test:test_support",
"//chrome:browser_tests_pak",
"//chrome:packed_resources",
"//chrome:resources",
"//chrome:strings",
"//chrome/browser",
"//chrome/renderer",
"//chrome/test:browser_tests_runner",
"//chrome/test:test_support",
"//chrome/test:test_support_ui",
"//content/test:test_support",
"//services/service_manager/background:lib",
"//testing/gmock",
"//testing/gtest",
"//ui/keyboard:resources",
]

# TODO(jamescook): Figure out which of these are really necessary.
data = [
"$root_out_dir/chrome_100_percent.pak",
"$root_out_dir/chrome_200_percent.pak",
Expand Down Expand Up @@ -661,6 +631,14 @@ js2gtest("chromevox_extjs_tests") {
"testing/chromevox_next_e2e_test_base.js",
"testing/mock_feedback.js",
]

# The test base classes generate C++ code with these deps.
deps = [
"//ash",
"//base",
"//chrome/browser/chromeos",
"//chrome/common",
]
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ GEN_INCLUDE(['../testing/chromevox_unittest_base.js',
* @constructor
* @extends {ChromeVoxUnitTestBase}
*/
function CvoxBrailleDisplayManagerUnitTest() {}
function ChromeVoxBrailleDisplayManagerUnitTest() {}

CvoxBrailleDisplayManagerUnitTest.prototype = {
ChromeVoxBrailleDisplayManagerUnitTest.prototype = {
__proto__: ChromeVoxUnitTestBase.prototype,

/** @override */
Expand Down Expand Up @@ -179,7 +179,7 @@ chrome.storage = {
};


TEST_F('CvoxBrailleDisplayManagerUnitTest', 'NoApi', function() {
TEST_F('ChromeVoxBrailleDisplayManagerUnitTest', 'NoApi', function() {
var manager = new cvox.BrailleDisplayManager(this.translatorManager);
manager.setContent(this.NAV_BRAILLE);
this.translatorManager.setTranslator(this.translator);
Expand All @@ -190,7 +190,7 @@ TEST_F('CvoxBrailleDisplayManagerUnitTest', 'NoApi', function() {
* Test that we don't write to the display when the API is available, but
* the display is not.
*/
TEST_F('CvoxBrailleDisplayManagerUnitTest', 'NoDisplay', function() {
TEST_F('ChromeVoxBrailleDisplayManagerUnitTest', 'NoDisplay', function() {
this.addFakeApi();
this.displayState = {available: false};

Expand All @@ -204,7 +204,8 @@ TEST_F('CvoxBrailleDisplayManagerUnitTest', 'NoDisplay', function() {
/**
* Tests the typical sequence: setContent, setTranslator, setContent.
*/
TEST_F('CvoxBrailleDisplayManagerUnitTest', 'BasicSetContent', function() {
TEST_F('ChromeVoxBrailleDisplayManagerUnitTest', 'BasicSetContent',
function() {
this.addFakeApi();
this.displayAvailable();
var manager = new cvox.BrailleDisplayManager(this.translatorManager);
Expand All @@ -220,8 +221,8 @@ TEST_F('CvoxBrailleDisplayManagerUnitTest', 'BasicSetContent', function() {
/**
* Tests that setting empty content clears the display.
*/
TEST_F('CvoxBrailleDisplayManagerUnitTest', 'SetEmptyContentWithTranslator',
function() {
TEST_F('ChromeVoxBrailleDisplayManagerUnitTest',
'SetEmptyContentWithTranslator', function() {
this.addFakeApi();
this.displayAvailable();

Expand All @@ -236,7 +237,8 @@ TEST_F('CvoxBrailleDisplayManagerUnitTest', 'SetEmptyContentWithTranslator',
});


TEST_F('CvoxBrailleDisplayManagerUnitTest', 'CursorAndPanning', function() {
TEST_F('ChromeVoxBrailleDisplayManagerUnitTest', 'CursorAndPanning',
function() {
var text = 'This is a test string';
function createNavBrailleWithCursor(start, end) {
return new cvox.NavBraille({ text: text, startIndex: start,
Expand Down Expand Up @@ -276,7 +278,7 @@ TEST_F('CvoxBrailleDisplayManagerUnitTest', 'CursorAndPanning', function() {
* Tests that the grouping algorithm works with one text character that maps
* to one braille cell.
*/
TEST_F('CvoxBrailleDisplayManagerUnitTest', 'BasicGroup', function() {
TEST_F('ChromeVoxBrailleDisplayManagerUnitTest', 'BasicGroup', function() {
var text = 'a';
var translated = '1';
var mapping = [0];
Expand All @@ -292,7 +294,7 @@ TEST_F('CvoxBrailleDisplayManagerUnitTest', 'BasicGroup', function() {
* Tests that the grouping algorithm works with one text character that maps
* to multiple braille cells.
*/
TEST_F('CvoxBrailleDisplayManagerUnitTest', 'OneRtoManyB', function() {
TEST_F('ChromeVoxBrailleDisplayManagerUnitTest', 'OneRtoManyB', function() {
var text = 'A';
var translated = '11';
var mapping = [0,0];
Expand All @@ -308,7 +310,7 @@ TEST_F('CvoxBrailleDisplayManagerUnitTest', 'OneRtoManyB', function() {
* Tests that the grouping algorithm works with one braille cell that maps
* to multiple text characters.
*/
TEST_F('CvoxBrailleDisplayManagerUnitTest', 'OneBtoManyR', function() {
TEST_F('ChromeVoxBrailleDisplayManagerUnitTest', 'OneBtoManyR', function() {
var text = 'knowledge';
var translated = '1';
var mapping = [0];
Expand All @@ -324,7 +326,8 @@ TEST_F('CvoxBrailleDisplayManagerUnitTest', 'OneBtoManyR', function() {
* Tests that the grouping algorithm works with one string that on both ends,
* have text characters that map to multiple braille cells.
*/
TEST_F('CvoxBrailleDisplayManagerUnitTest', 'OneRtoManyB_BothEnds', function() {
TEST_F('ChromeVoxBrailleDisplayManagerUnitTest', 'OneRtoManyB_BothEnds',
function() {
var text = 'AbbC';
var translated = 'X122X3';
var mapping = [0,0,1,2,3,3];
Expand All @@ -340,7 +343,8 @@ TEST_F('CvoxBrailleDisplayManagerUnitTest', 'OneRtoManyB_BothEnds', function() {
* Tests that the grouping algorithm works with one string that on both ends,
* have braille cells that map to multiple text characters.
*/
TEST_F('CvoxBrailleDisplayManagerUnitTest', 'OneBtoManyR_BothEnds', function() {
TEST_F('ChromeVoxBrailleDisplayManagerUnitTest', 'OneBtoManyR_BothEnds',
function() {
var text = 'knowledgehappych';
var translated = '1234456';
var mapping = [0, 9, 10, 11, 12, 13, 14];
Expand All @@ -357,7 +361,7 @@ TEST_F('CvoxBrailleDisplayManagerUnitTest', 'OneBtoManyR_BothEnds', function() {
* Tests that the grouping algorithm works with one string that has both types
* of mapping.
*/
TEST_F('CvoxBrailleDisplayManagerUnitTest', 'RandB_Random', function() {
TEST_F('ChromeVoxBrailleDisplayManagerUnitTest', 'RandB_Random', function() {
var text = 'knowledgeIsPower';
var translated = '1X23X45678';
var mapping = [0, 9, 9, 10, 11, 11, 12, 13, 14, 15];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,9 @@ function cellsToArray(cells) {
* @constructor
* @extends {ChromeVoxUnitTestBase}
*/
function CvoxBrailleInputHandlerUnitTest() {}
function ChromeVoxBrailleInputHandlerUnitTest() {}

CvoxBrailleInputHandlerUnitTest.prototype = {
ChromeVoxBrailleInputHandlerUnitTest.prototype = {
__proto__: ChromeVoxUnitTestBase.prototype,

/** @override */
Expand Down Expand Up @@ -534,15 +534,15 @@ CvoxBrailleInputHandlerUnitTest.prototype = {
}
};

TEST_F('CvoxBrailleInputHandlerUnitTest', 'ConnectFromUnknownExtension',
TEST_F('ChromeVoxBrailleInputHandlerUnitTest', 'ConnectFromUnknownExtension',
function() {
this.port.sender.id = 'your unknown friend';
chrome.runtime.onConnectExternal.getListener()(this.port);
this.port.onMessage.assertNoListener();
});


TEST_F('CvoxBrailleInputHandlerUnitTest', 'NoTranslator', function() {
TEST_F('ChromeVoxBrailleInputHandlerUnitTest', 'NoTranslator', function() {
var editor = this.createEditor();
editor.setContent('blah', 0);
editor.setActive(true);
Expand All @@ -554,7 +554,7 @@ TEST_F('CvoxBrailleInputHandlerUnitTest', 'NoTranslator', function() {
});


TEST_F('CvoxBrailleInputHandlerUnitTest', 'InputUncontracted', function() {
TEST_F('ChromeVoxBrailleInputHandlerUnitTest', 'InputUncontracted', function() {
this.translatorManager.setTranslators(this.uncontractedTranslator, null);
var editor = this.createEditor();
editor.setActive(true);
Expand All @@ -581,7 +581,7 @@ TEST_F('CvoxBrailleInputHandlerUnitTest', 'InputUncontracted', function() {
});


TEST_F('CvoxBrailleInputHandlerUnitTest', 'InputContracted', function() {
TEST_F('ChromeVoxBrailleInputHandlerUnitTest', 'InputContracted', function() {
var editor = this.createEditor();
this.translatorManager.setTranslators(this.contractedTranslator,
this.uncontractedTranslator);
Expand Down Expand Up @@ -641,7 +641,7 @@ TEST_F('CvoxBrailleInputHandlerUnitTest', 'InputContracted', function() {
});


TEST_F('CvoxBrailleInputHandlerUnitTest', 'TypingUrlWithContracted',
TEST_F('ChromeVoxBrailleInputHandlerUnitTest', 'TypingUrlWithContracted',
function() {
var editor = this.createEditor();
this.translatorManager.setTranslators(this.contractedTranslator,
Expand All @@ -665,7 +665,7 @@ TEST_F('CvoxBrailleInputHandlerUnitTest', 'TypingUrlWithContracted',
});


TEST_F('CvoxBrailleInputHandlerUnitTest', 'Backspace', function() {
TEST_F('ChromeVoxBrailleInputHandlerUnitTest', 'Backspace', function() {
var editor = this.createEditor();
this.translatorManager.setTranslators(this.contractedTranslator,
this.uncontractedTranslator);
Expand Down Expand Up @@ -695,7 +695,7 @@ TEST_F('CvoxBrailleInputHandlerUnitTest', 'Backspace', function() {
});


TEST_F('CvoxBrailleInputHandlerUnitTest', 'KeysImeNotActive', function() {
TEST_F('ChromeVoxBrailleInputHandlerUnitTest', 'KeysImeNotActive', function() {
var editor = this.createEditor();
this.sendKeyEvent('Enter');
this.sendKeyEvent('ArrowUp');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ GEN_INCLUDE(['../testing/chromevox_e2e_test_base.js',
* @constructor
* @extends {ChromeVoxE2ETest}
*/
function CvoxBrailleTableTest() {
function ChromeVoxBrailleTableTest() {
ChromeVoxE2ETest.call(this);
}

CvoxBrailleTableTest.prototype = {
ChromeVoxBrailleTableTest.prototype = {
__proto__: ChromeVoxE2ETest.prototype,
};

/**
* Tests that {@code getAll} can fetch and parse the tables file.
* NOTE: This will need to be adjusted when more tables are added.
*/
TEST_F('CvoxBrailleTableTest', 'testGetAllAndValidate', function() {
TEST_F('ChromeVoxBrailleTableTest', 'testGetAllAndValidate', function() {
cvox.BrailleTable.getAll(this.newCallback(function(tables) {
expectEquals(68, tables.length);
assertNotNullNorUndefined(
Expand All @@ -40,7 +40,7 @@ TEST_F('CvoxBrailleTableTest', 'testGetAllAndValidate', function() {
});

/** Tests getDisplayName for some specific representative cases. */
TEST_F('CvoxBrailleTableTest', 'testGetDisplayName', function() {
TEST_F('ChromeVoxBrailleTableTest', 'testGetDisplayName', function() {
cvox.BrailleTable.getAll(this.newCallback(function(tables) {
var table = cvox.BrailleTable.forId(tables, 'bg-comp8');
expectEquals('Bulgarian', cvox.BrailleTable.getDisplayName(table));
Expand All @@ -55,7 +55,7 @@ TEST_F('CvoxBrailleTableTest', 'testGetDisplayName', function() {
/**
* Tests the getUncontracted function.
*/
TEST_F('CvoxBrailleTableTest', 'testGetUncontracted', function() {
TEST_F('ChromeVoxBrailleTableTest', 'testGetUncontracted', function() {
cvox.BrailleTable.getAll(this.newCallback(function(tables) {
function expectUncontracted(uncontractedId, idToCheck) {
var checkedTable = cvox.BrailleTable.forId(tables, idToCheck);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ GEN_INCLUDE(['../testing/chromevox_e2e_test_base.js',
* @constructor
* @extends {ChromeVoxE2ETest}
*/
function CvoxBrailleTranslatorManagerTest() {
function ChromeVoxBrailleTranslatorManagerTest() {
ChromeVoxE2ETest.call(this);
}

CvoxBrailleTranslatorManagerTest.prototype = {
ChromeVoxBrailleTranslatorManagerTest.prototype = {
__proto__: ChromeVoxE2ETest.prototype,

/** @override */
Expand Down Expand Up @@ -78,7 +78,7 @@ function callOnce(callback) {
};
}

TEST_F('CvoxBrailleTranslatorManagerTest', 'testInitial', function() {
TEST_F('ChromeVoxBrailleTranslatorManagerTest', 'testInitial', function() {
assertEquals(null, this.manager.getExpandingTranslator());
assertEquals(null, this.manager.getDefaultTranslator());
assertEquals(null, this.manager.getUncontractedTranslator());
Expand All @@ -89,7 +89,7 @@ TEST_F('CvoxBrailleTranslatorManagerTest', 'testInitial', function() {
});
});

TEST_F('CvoxBrailleTranslatorManagerTest', 'testRefreshWithoutChange',
TEST_F('ChromeVoxBrailleTranslatorManagerTest', 'testRefreshWithoutChange',
function() {
this.addChangeListener(function() {
assertNotEquals(null, this.manager.getExpandingTranslator());
Expand All @@ -101,7 +101,7 @@ TEST_F('CvoxBrailleTranslatorManagerTest', 'testRefreshWithoutChange',
});
});

TEST_F('CvoxBrailleTranslatorManagerTest', 'testRefreshWithChange',
TEST_F('ChromeVoxBrailleTranslatorManagerTest', 'testRefreshWithChange',
function() {
this.addChangeListener(function() {
assertNotEquals(null, this.manager.getExpandingTranslator());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ GEN_INCLUDE(['../testing/chromevox_unittest_base.js',
* @constructor
* @extends {ChromeVoxUnitTestBase}
*/
function CvoxExpandingBrailleTranslatorUnitTest() {}
function ChromeVoxExpandingBrailleTranslatorUnitTest() {}

CvoxExpandingBrailleTranslatorUnitTest.prototype = {
ChromeVoxExpandingBrailleTranslatorUnitTest.prototype = {
__proto__: ChromeVoxUnitTestBase.prototype,

/** @override */
Expand Down Expand Up @@ -78,7 +78,7 @@ function assertArrayBufferMatches(expected, actual) {
}
}

TEST_F('CvoxExpandingBrailleTranslatorUnitTest', 'TranslationError',
TEST_F('ChromeVoxExpandingBrailleTranslatorUnitTest', 'TranslationError',
function() {
var text = new Spannable('error ok', new cvox.ValueSpan());
text.setSpan(new cvox.ValueSelectionSpan, 0, 0);
Expand Down Expand Up @@ -255,7 +255,7 @@ function createText(text, opt_selectionStart, opt_selectionEnd, opt_style) {

var TEXT = 'Hello, world!';

TEST_F('CvoxExpandingBrailleTranslatorUnitTest', 'successfulTranslations',
TEST_F('ChromeVoxExpandingBrailleTranslatorUnitTest', 'successfulTranslations',
function() {
/**
* Dictionary of test strings, keyed on a descriptive name for the
Expand Down Expand Up @@ -313,7 +313,7 @@ TEST_F('CvoxExpandingBrailleTranslatorUnitTest', 'successfulTranslations',
assertEquals(totalExpectedTranslationTests, totalRunTranslationTests);
});

TEST_F('CvoxExpandingBrailleTranslatorUnitTest', 'StyleTranslations',
TEST_F('ChromeVoxExpandingBrailleTranslatorUnitTest', 'StyleTranslations',
function() {
var formTypeMap = {};
formTypeMap[cvox.LibLouis.FormType.BOLD] = 'b';
Expand Down
Loading

0 comments on commit 1380ad1

Please sign in to comment.