Index: chrome/browser/resources/chromeos/chromevox/common/content_editable_extractor_test.unitjs |
diff --git a/chrome/browser/resources/chromeos/chromevox/common/content_editable_extractor_test.unitjs b/chrome/browser/resources/chromeos/chromevox/common/content_editable_extractor_test.unitjs |
index 92351626a4ca1403c6343c3afb3f12c359fd7665..c5f0fa3ba5757b3a5c53b6e5c95a33f0c6829434 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/common/content_editable_extractor_test.unitjs |
+++ b/chrome/browser/resources/chromeos/chromevox/common/content_editable_extractor_test.unitjs |
@@ -21,6 +21,22 @@ CvoxContentEditableExtractorUnitTest.prototype = { |
] |
}; |
+/** |
+ * Helper function to set the selection |
+ * @param {Node} startNode The base/start node of the range. |
+ * @param {number} startOffset The 0-based character index of the start. |
+ * @param {Node} endNode The extent/end node of the range. |
+ * @param {number} endOffset The 0-based character index of the end. |
+ */ |
+function setSelection(startNode, startOffset, endNode, endOffset) { |
+ var r = document.createRange(); |
+ r.setStart(startNode, startOffset); |
+ r.setEnd(endNode, endOffset); |
+ var sel = window.getSelection(); |
+ sel.removeAllRanges(); |
+ sel.addRange(r); |
+} |
+ |
TEST_F('CvoxContentEditableExtractorUnitTest', 'EmptyElement', function() { |
this.loadDoc(function() {/*! |
<div> |