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

Unified Diff: LayoutTests/accessibility/input-type-password-value-and-selection.html

Issue 1050123003: Rewrote password layout test and removed obsolete tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Renamed some more tests for consistency. Created 5 years, 8 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: LayoutTests/accessibility/input-type-password-value-and-selection.html
diff --git a/LayoutTests/accessibility/input-type-password-value-and-selection.html b/LayoutTests/accessibility/input-type-password-value-and-selection.html
new file mode 100644
index 0000000000000000000000000000000000000000..85f4f27fc2b1364c5f82fd6457efabed91083ea9
--- /dev/null
+++ b/LayoutTests/accessibility/input-type-password-value-and-selection.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="../resources/js-test.js"></script>
+ </head>
+ <body>
+
+ <input id="password" type="password" value="Secret">
+
+ <p id="description"></p>
+ <div id="console"></div>
+
+ <script>
+ description("This tests that AXValue, caret position and text selection are reported correctly for password fields.");
+
+ if (window.accessibilityController) {
+ var password = document.getElementById("password");
+ var textLength = password.value.length;
+ password.focus();
+ var axPassword = accessibilityController.accessibleElementById("password");
+
+ // Initially the caret should be at the beginning of the field.
+ shouldBeZero("axPassword.selectionStart");
+ shouldBeZero("axPassword.selectionEnd");
+ shouldBeZero("axPassword.selectionStartLineNumber");
+ shouldBeZero("axPassword.selectionEndLineNumber");
+
+ // The password field should contain 6 bullets.
+ // (Bullet is the default mask character, not star.)
+ var axValue = "AXValue: " + new Array(textLength + 1).join(
+ String.fromCharCode(8226 /* Bullet symbol. */));
+ shouldBeEqualToString("axPassword.stringValue", axValue);
+
+ for (var start = 0; start < textLength; ++start) {
+ for (var end = start; end < textLength; ++end) {
+ password.setSelectionRange(start, end);
+ shouldBeEqualToNumber("axPassword.selectionStart", start);
+ shouldBeEqualToNumber("axPassword.selectionEnd", end);
+ shouldBeZero("axPassword.selectionStartLineNumber");
+ shouldBeZero("axPassword.selectionEndLineNumber");
+ }
+ }
+
+ // Invalid range.
+ password.setSelectionRange(7, 0);
+ shouldBeZero("axPassword.selectionStart");
+ shouldBeZero("axPassword.selectionEnd");
+ shouldBeZero("axPassword.selectionStartLineNumber");
+ shouldBeZero("axPassword.selectionEndLineNumber");
+
+ }
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698