forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add API to automation to get word start and end indices for string.
This change hooks into AXTextUtils::GetWordBoundariesForString and exposes this information in automation. Bug: 948700 Change-Id: I8fe5852cf1ce5e1eeb02e986d4524d44095d054f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1642390 Reviewed-by: Devlin <rdevlin.cronin@chromium.org> Reviewed-by: Nektarios Paisios <nektar@chromium.org> Commit-Queue: Akihiro Ota <akihiroota@chromium.org> Cr-Commit-Position: refs/heads/master@{#668972}
- Loading branch information
1 parent
9e04a5e
commit b747ffb
Showing
8 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
chrome/test/data/extensions/api_test/automation/sites/word_boundaries.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!-- | ||
* Copyright 2019 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. | ||
--> | ||
<html> | ||
<head> | ||
<title>Automation Tests - Word Boundaries</title> | ||
</head> | ||
<body> | ||
<!-- Used to test wordBoundariesForString. --> | ||
<div role="button">Example text for testing purposes</div> | ||
</body> | ||
</html> |
7 changes: 7 additions & 0 deletions
7
chrome/test/data/extensions/api_test/automation/tests/tabs/word_boundaries.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!-- | ||
* Copyright 2019 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. | ||
--> | ||
<script src="common.js"></script> | ||
<script src="word_boundaries.js"></script> |
24 changes: 24 additions & 0 deletions
24
chrome/test/data/extensions/api_test/automation/tests/tabs/word_boundaries.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2019 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 allTests = [ | ||
function testWordStartAndEndOffsets() { | ||
var node = rootNode.find( | ||
{ attributes: { name: 'Example text for testing purposes' } }); | ||
var expectedWordStarts = [0, 8, 13, 17, 25]; | ||
var expectedWordEnds = [7, 12, 16, 24, 33]; | ||
var wordStarts = node.wordStartOffsets(); | ||
var wordEnds = node.wordEndOffsets(); | ||
assertEq(expectedWordStarts.length, wordStarts.length); | ||
assertEq(expectedWordEnds.length, wordEnds.length); | ||
assertEq(wordStarts.length, wordEnds.length); | ||
for (var i = 0; i < expectedWordStarts.length; ++i){ | ||
assertEq(expectedWordStarts[i], wordStarts[i]); | ||
assertEq(expectedWordEnds[i], wordEnds[i]); | ||
} | ||
chrome.test.succeed(); | ||
} | ||
]; | ||
|
||
setUpAndRunTests(allTests, 'word_boundaries.html'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters