Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8929)

Unified Diff: chrome/test/data/extensions/api_test/automation/tests/tabs/find.js

Issue 2650733002: Revert of Update json_schema_compiler to handle the Automation extension API (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/automation/tests/tabs/find.js
diff --git a/chrome/test/data/extensions/api_test/automation/tests/tabs/find.js b/chrome/test/data/extensions/api_test/automation/tests/tabs/find.js
index 39b1d2a89f27dec0b3336ec908799368c1663211..4f0d98efc795a847c86eb2ec0b257997edcbf614 100644
--- a/chrome/test/data/extensions/api_test/automation/tests/tabs/find.js
+++ b/chrome/test/data/extensions/api_test/automation/tests/tabs/find.js
@@ -14,37 +14,37 @@
function initializeNodes(rootNode) {
group = rootNode.firstChild;
- assertEq(RoleType.GROUP, group.role);
+ assertEq(RoleType.group, group.role);
h1 = group.firstChild;
- assertEq(RoleType.HEADING, h1.role);
+ assertEq(RoleType.heading, h1.role);
assertEq(1, h1.hierarchicalLevel);
p1 = group.lastChild;
- assertEq(RoleType.PARAGRAPH, p1.role);
+ assertEq(RoleType.paragraph, p1.role);
link = p1.children[1];
- assertEq(RoleType.LINK, link.role);
+ assertEq(RoleType.link, link.role);
main = rootNode.children[1];
- assertEq(RoleType.MAIN, main.role);
+ assertEq(RoleType.main, main.role);
p2 = main.firstChild;
- assertEq(RoleType.PARAGRAPH, p2.role);
+ assertEq(RoleType.paragraph, p2.role);
p3 = main.lastChild;
- assertEq(RoleType.PARAGRAPH, p3.role);
+ assertEq(RoleType.paragraph, p3.role);
okButton = rootNode.children[2];
- assertEq(RoleType.BUTTON, okButton.role);
+ assertEq(RoleType.button, okButton.role);
assertEq('Ok', okButton.name);
- assertTrue(StateType.DISABLED in okButton.state);
+ assertTrue(StateType.disabled in okButton.state);
assertTrue(okButton.state.disabled);
cancelButton = rootNode.children[3];
- assertEq(RoleType.BUTTON, cancelButton.role);
+ assertEq(RoleType.button, cancelButton.role);
assertEq('Cancel', cancelButton.name);
- assertFalse(StateType.DISABLED in cancelButton.state);
+ assertFalse(StateType.disabled in cancelButton.state);
}
var allTests = [
@@ -52,26 +52,26 @@
initializeNodes(rootNode);
// Should find the only instance of this role.
- assertEq(h1, rootNode.find({role: RoleType.HEADING}));
- assertEq([h1], rootNode.findAll({role: RoleType.HEADING}));
+ assertEq(h1, rootNode.find({ role: RoleType.heading}));
+ assertEq([h1], rootNode.findAll({ role: RoleType.heading}));
// find should find first instance only.
- assertEq(okButton, rootNode.find({role: RoleType.BUTTON}));
- assertEq(p1, rootNode.find({role: RoleType.PARAGRAPH}));
+ assertEq(okButton, rootNode.find({ role: RoleType.button }));
+ assertEq(p1, rootNode.find({ role: RoleType.paragraph }));
// findAll should find all instances.
- assertEq(
- [okButton, cancelButton], rootNode.findAll({role: RoleType.BUTTON}));
- assertEq([p1, p2, p3], rootNode.findAll({role: RoleType.PARAGRAPH}));
+ assertEq([okButton, cancelButton],
+ rootNode.findAll({ role: RoleType.button }));
+ assertEq([p1, p2, p3], rootNode.findAll({ role: RoleType.paragraph }));
// No instances: find should return null; findAll should return empty array.
- assertEq(null, rootNode.find({role: RoleType.CHECKBOX}));
- assertEq([], rootNode.findAll({role: RoleType.CHECKBOX}));
+ assertEq(null, rootNode.find({ role: RoleType.checkbox }));
+ assertEq([], rootNode.findAll({ role: RoleType.checkbox }));
// Calling from node should search only its subtree.
- assertEq(p1, group.find({role: RoleType.PARAGRAPH}));
- assertEq(p2, main.find({role: RoleType.PARAGRAPH}));
- assertEq([p2, p3], main.findAll({role: RoleType.PARAGRAPH}));
+ assertEq(p1, group.find({ role: RoleType.paragraph }));
+ assertEq(p2, main.find({ role: RoleType.paragraph }));
+ assertEq([p2, p3], main.findAll({ role: RoleType.paragraph }));
chrome.test.succeed();
},
@@ -80,25 +80,21 @@
initializeNodes(rootNode);
// Find all focusable elements (disabled button is not focusable).
- assertEq(link, rootNode.find({state: {focusable: true}}));
- assertEq(
- [link, cancelButton], rootNode.findAll({state: {focusable: true}}));
+ assertEq(link, rootNode.find({ state: { focusable: true }}));
+ assertEq([link, cancelButton],
+ rootNode.findAll({ state: { focusable: true }}));
// Find disabled buttons.
- assertEq(
- okButton,
- rootNode.find({role: RoleType.BUTTON, state: {disabled: true}}));
- assertEq(
- [okButton],
- rootNode.findAll({role: RoleType.BUTTON, state: {disabled: true}}));
+ assertEq(okButton, rootNode.find({ role: RoleType.button,
+ state: { disabled: true }}));
+ assertEq([okButton], rootNode.findAll({ role: RoleType.button,
+ state: { disabled: true }}));
// Find enabled buttons.
- assertEq(
- cancelButton,
- rootNode.find({role: RoleType.BUTTON, state: {disabled: false}}));
- assertEq(
- [cancelButton],
- rootNode.findAll({role: RoleType.BUTTON, state: {disabled: false}}));
+ assertEq(cancelButton, rootNode.find({ role: RoleType.button,
+ state: { disabled: false }}));
+ assertEq([cancelButton], rootNode.findAll({ role: RoleType.button,
+ state: { disabled: false }}));
chrome.test.succeed();
},
@@ -106,71 +102,59 @@
initializeNodes(rootNode);
// Find by name attribute.
- assertEq(okButton, rootNode.find({attributes: {name: 'Ok'}}));
- assertEq(cancelButton, rootNode.find({attributes: {name: 'Cancel'}}));
+ assertEq(okButton, rootNode.find({ attributes: { name: 'Ok' }}));
+ assertEq(cancelButton, rootNode.find({ attributes: { name: 'Cancel' }}));
// String attributes must be exact match unless a regex is used.
- assertEq(null, rootNode.find({attributes: {name: 'Canc'}}));
- assertEq(null, rootNode.find({attributes: {name: 'ok'}}));
+ assertEq(null, rootNode.find({ attributes: { name: 'Canc' }}));
+ assertEq(null, rootNode.find({ attributes: { name: 'ok' }}));
// Find by value attribute - regexp.
- var query = {attributes: {name: /relationship/}};
+ var query = { attributes: { name: /relationship/ }};
assertEq(p2, rootNode.find(query).parent);
// Find by role and hierarchicalLevel attribute.
- assertEq(
- h1, rootNode.find(
- {role: RoleType.HEADING, attributes: {hierarchicalLevel: 1}}));
- assertEq(
- [], rootNode.findAll(
- {role: RoleType.HEADING, attributes: {hierarchicalLevel: 2}}));
+ assertEq(h1, rootNode.find({ role: RoleType.heading,
+ attributes: { hierarchicalLevel: 1 }}));
+ assertEq([], rootNode.findAll({ role: RoleType.heading,
+ attributes: { hierarchicalLevel: 2 }}));
// Searching for an attribute which no element has fails.
- assertEq(null, rootNode.find({attributes: {charisma: 12}}));
+ assertEq(null, rootNode.find({ attributes: { charisma: 12 } }));
// Searching for an attribute value of the wrong type fails (even if the
// value is equivalent).
- assertEq(
- null,
- rootNode.find(
- {role: RoleType.HEADING, attributes: {hierarchicalLevel: true}}));
+ assertEq(null, rootNode.find({ role: RoleType.heading,
+ attributes: { hierarchicalLevel: true }} ));
chrome.test.succeed();
},
function testMatches() {
initializeNodes(rootNode);
- assertTrue(
- h1.matches({role: RoleType.HEADING}),
- 'h1 should match RoleType.HEADING');
- assertTrue(
- h1.matches(
- {role: RoleType.HEADING, attributes: {hierarchicalLevel: 1}}),
- 'h1 should match RoleType.HEADING and hierarchicalLevel: 1');
- assertFalse(
- h1.matches({
- role: RoleType.HEADING,
- state: {focusable: true},
- attributes: {hierarchicalLevel: 1}
- }),
- 'h1 should not match focusable: true');
- assertTrue(
- h1.matches({
- role: RoleType.HEADING,
- state: {focusable: false},
- attributes: {hierarchicalLevel: 1}
- }),
- 'h1 should match focusable: false');
+ assertTrue(h1.matches({ role: RoleType.heading }),
+ 'h1 should match RoleType.heading');
+ assertTrue(h1.matches({ role: RoleType.heading,
+ attributes: { hierarchicalLevel: 1 } }),
+ 'h1 should match RoleType.heading and hierarchicalLevel: 1');
+ assertFalse(h1.matches({ role: RoleType.heading,
+ state: { focusable: true },
+ attributes: { hierarchicalLevel: 1 } }),
+ 'h1 should not match focusable: true');
+ assertTrue(h1.matches({ role: RoleType.heading,
+ state: { focusable: false },
+ attributes: { hierarchicalLevel: 1 } }),
+ 'h1 should match focusable: false');
var p2StaticText = p2.firstChild;
assertTrue(
- p2StaticText.matches(
- {role: RoleType.STATIC_TEXT, attributes: {name: /relationship/}}),
+ p2StaticText.matches({ role: RoleType.staticText,
+ attributes: { name: /relationship/ } }),
'p2StaticText should match name: /relationship/ (regex match)');
assertFalse(
- p2StaticText.matches(
- {role: RoleType.STATIC_TEXT, attributes: {name: 'relationship'}}),
- 'p2 should not match name: \'relationship');
+ p2StaticText.matches({ role: RoleType.staticText,
+ attributes: { name: 'relationship' } }),
+ 'p2 should not match name: \'relationship');
chrome.test.succeed();
}

Powered by Google App Engine
This is Rietveld 408576698