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

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

Issue 2601333002: Update json_schema_compiler to handle the Automation extension API (Closed)
Patch Set: Fix select_to_speak 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 4f0d98efc795a847c86eb2ec0b257997edcbf614..8e80ed438e2a8dbce7a78fe750c2dccc4035a821 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 @@ var cancelButton;
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 @@ var allTests = [
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}));
Dan Beam 2017/01/10 22:54:43 {\s -> { \s} -> }
dmazzoni 2017/01/11 22:20:42 Done.
Dan Beam 2017/01/11 23:04:26 for the sake of this awesome CL landing, i'll hold
dmazzoni 2017/01/11 23:23:57 Sure, went ahead and ran clang-format on this file
+ 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 }));
+ 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();
},
@@ -85,15 +85,15 @@ var allTests = [
rootNode.findAll({ state: { focusable: true }}));
// Find disabled buttons.
- assertEq(okButton, rootNode.find({ role: RoleType.button,
+ assertEq(okButton, rootNode.find({ role: RoleType.BUTTON,
state: { disabled: true }}));
- assertEq([okButton], rootNode.findAll({ role: RoleType.button,
+ assertEq([okButton], rootNode.findAll({ role: RoleType.BUTTON,
state: { disabled: true }}));
// Find enabled buttons.
- assertEq(cancelButton, rootNode.find({ role: RoleType.button,
+ assertEq(cancelButton, rootNode.find({ role: RoleType.BUTTON,
state: { disabled: false }}));
- assertEq([cancelButton], rootNode.findAll({ role: RoleType.button,
+ assertEq([cancelButton], rootNode.findAll({ role: RoleType.BUTTON,
state: { disabled: false }}));
chrome.test.succeed();
},
@@ -114,9 +114,9 @@ var allTests = [
assertEq(p2, rootNode.find(query).parent);
// Find by role and hierarchicalLevel attribute.
- assertEq(h1, rootNode.find({ role: RoleType.heading,
+ assertEq(h1, rootNode.find({ role: RoleType.HEADING,
attributes: { hierarchicalLevel: 1 }}));
- assertEq([], rootNode.findAll({ role: RoleType.heading,
+ assertEq([], rootNode.findAll({ role: RoleType.HEADING,
attributes: { hierarchicalLevel: 2 }}));
// Searching for an attribute which no element has fails.
@@ -124,7 +124,7 @@ var allTests = [
// Searching for an attribute value of the wrong type fails (even if the
// value is equivalent).
- assertEq(null, rootNode.find({ role: RoleType.heading,
+ assertEq(null, rootNode.find({ role: RoleType.HEADING,
attributes: { hierarchicalLevel: true }} ));
chrome.test.succeed();
@@ -132,27 +132,27 @@ var allTests = [
function testMatches() {
initializeNodes(rootNode);
- assertTrue(h1.matches({ role: RoleType.heading }),
- 'h1 should match RoleType.heading');
- assertTrue(h1.matches({ role: RoleType.heading,
+ 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,
+ '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,
+ 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.staticText,
+ p2StaticText.matches({ role: RoleType.STATIC_TEXT,
attributes: { name: /relationship/ } }),
'p2StaticText should match name: /relationship/ (regex match)');
assertFalse(
- p2StaticText.matches({ role: RoleType.staticText,
+ p2StaticText.matches({ role: RoleType.STATIC_TEXT,
attributes: { name: 'relationship' } }),
'p2 should not match name: \'relationship');

Powered by Google App Engine
This is Rietveld 408576698