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

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

Issue 1458723002: Finish implementing ChromeVox Next active indicator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@load_key_map
Patch Set: Made test expectations approximate Created 5 years, 1 month 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
« no previous file with comments | « chrome/test/data/extensions/api_test/automation/tests/tabs/bounds_for_range.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/automation/tests/tabs/bounds_for_range.js
diff --git a/chrome/test/data/extensions/api_test/automation/tests/tabs/bounds_for_range.js b/chrome/test/data/extensions/api_test/automation/tests/tabs/bounds_for_range.js
new file mode 100644
index 0000000000000000000000000000000000000000..73bfc35c1ae7420c9cb884a89c11e78f7f97d254
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/automation/tests/tabs/bounds_for_range.js
@@ -0,0 +1,86 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var RoleType = chrome.automation.RoleType;
+
+var allTests = [
+ function boundsForRange() {
+ function getNthListItemInlineTextBox(index) {
+ var list = rootNode.find({role: RoleType.list});
+ var listItem = list.children[index];
+ assertEq(RoleType.listItem, listItem.role);
+ var staticText = listItem.children[1];
+ assertEq(RoleType.staticText, staticText.role);
+ var inlineTextBox = staticText.firstChild;
+ assertEq(RoleType.inlineTextBox, inlineTextBox.role);
+ return inlineTextBox;
+ }
+
+ // Left-to-right.
+ var ltr = getNthListItemInlineTextBox(0);
+ var bounds = ltr.location;
+ var firstHalf = ltr.boundsForRange(0, 4);
+ var secondHalf = ltr.boundsForRange(4, ltr.name.length);
+ assertEq(bounds.top, firstHalf.top);
+ assertEq(bounds.left, firstHalf.left);
+ assertEq(bounds.height, firstHalf.height);
+ assertEq(bounds.top, secondHalf.top);
+ assertEq(bounds.height, secondHalf.height);
+ assertTrue(secondHalf.left > bounds.left);
+ assertTrue(firstHalf.width < bounds.width);
+ assertTrue(secondHalf.width < bounds.width);
+ assertTrue(Math.abs(bounds.width - firstHalf.width - secondHalf.width) < 3);
+
+ // Right-to-left.
+ var rtl = getNthListItemInlineTextBox(1);
+ bounds = rtl.location;
+ firstHalf = rtl.boundsForRange(0, 4);
+ secondHalf = rtl.boundsForRange(4, rtl.name.length);
+ assertEq(bounds.top, secondHalf.top);
+ assertTrue(Math.abs(bounds.left - secondHalf.left) < 3);
+ assertEq(bounds.height, secondHalf.height);
+ assertEq(bounds.top, firstHalf.top);
+ assertEq(bounds.height, firstHalf.height);
+ assertTrue(firstHalf.left > bounds.left);
+ assertTrue(secondHalf.width < bounds.width);
+ assertTrue(firstHalf.width < bounds.width);
+ assertTrue(Math.abs(bounds.width - secondHalf.width - firstHalf.width) < 3);
+
+ // Top-to-bottom.
+ var ttb = getNthListItemInlineTextBox(2);
+ var bounds = ttb.location;
+ var firstHalf = ttb.boundsForRange(0, 4);
+ var secondHalf = ttb.boundsForRange(4, ttb.name.length);
+ assertEq(bounds.left, firstHalf.left);
+ assertEq(bounds.top, firstHalf.top);
+ assertEq(bounds.width, firstHalf.width);
+ assertEq(bounds.left, secondHalf.left);
+ assertEq(bounds.width, secondHalf.width);
+ assertTrue(secondHalf.top > bounds.top);
+ assertTrue(firstHalf.height < bounds.height);
+ assertTrue(secondHalf.height < bounds.height);
+ assertTrue(Math.abs(bounds.height - firstHalf.height - secondHalf.height)
+ < 3);
+
+ // Bottom-to-top.
+ var btt = getNthListItemInlineTextBox(3);
+ bounds = btt.location;
+ firstHalf = btt.boundsForRange(0, 4);
+ secondHalf = btt.boundsForRange(4, btt.name.length);
+ assertEq(bounds.left, secondHalf.left);
+ assertTrue(Math.abs(bounds.top - secondHalf.top) < 3);
+ assertEq(bounds.width, secondHalf.width);
+ assertEq(bounds.left, firstHalf.left);
+ assertEq(bounds.width, firstHalf.width);
+ assertTrue(firstHalf.top > bounds.top);
+ assertTrue(secondHalf.height < bounds.height);
+ assertTrue(firstHalf.height < bounds.height);
+ assertTrue(Math.abs(bounds.height - secondHalf.height - firstHalf.height)
+ < 3);
+ chrome.test.succeed();
+
+ }
+];
+
+setUpAndRunTests(allTests, 'bounds_for_range.html');
« no previous file with comments | « chrome/test/data/extensions/api_test/automation/tests/tabs/bounds_for_range.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698