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

Unified Diff: LayoutTests/fast/forms/input-autofilled.html

Issue 26622007: Move isAutofilled and setAutofilled from HTMLInputElement to HTMLFormControlElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update messaging in test. Created 7 years, 2 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
« no previous file with comments | « no previous file | LayoutTests/fast/forms/input-autofilled-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/forms/input-autofilled.html
diff --git a/LayoutTests/fast/forms/input-autofilled.html b/LayoutTests/fast/forms/input-autofilled.html
index fffd0881343246e12a77924020a910181f7901f0..c1ac8be544c3dedf0982f18639c6910141539531 100644
--- a/LayoutTests/fast/forms/input-autofilled.html
+++ b/LayoutTests/fast/forms/input-autofilled.html
@@ -1,4 +1,3 @@
-<html>
<head>
<script src="../js/resources/js-test-pre.js"></script>
<script>
@@ -7,40 +6,75 @@
testRunner.dumpAsText();
}
- var tf = document.getElementById('tf');
- var computedStyle = document.defaultView.getComputedStyle(tf);
- var originalForeground = computedStyle.color;
- var originalBackground = computedStyle.backgroundColor;
+ if (!window.internals) {
+ testFailed('This test requires the test harness to run.');
+ return;
+ }
+
+ var field = document.getElementById('field');
+ var textarea = document.getElementById('textarea');
+
+ var computedStyleField = document.defaultView.getComputedStyle(field);
+ var computedStyleTextarea = document.defaultView.getComputedStyle(textarea);
+ var originalForeground = computedStyleField.color;
+ var originalBackground = computedStyleField.backgroundColor;
+
+ if (originalForeground != computedStyleTextarea.color) {
+ testFailed('Unexpected initial foreground color for <textarea> field.');
+ return;
+ }
+ if (originalForeground != computedStyleTextarea.backgroundColor) {
+ testFailed('Unexpected initial background color for <textarea> field.');
+ return;
+ }
if (window.internals) {
- window.internals.setAutofilled(tf, true);
+ window.internals.setAutofilled(field, true);
+ window.internals.setAutofilled(textarea, true);
}
// Both the foreground and background colors should change.
- computedStyle = document.defaultView.getComputedStyle(tf);
- var autofilledForeground = computedStyle.color;
- var autofilledBackground = computedStyle.backgroundColor;
- if (autofilledForeground == originalForeground) {
- testFailed('Foreground color did not change when autofilled.');
+ computedStyleField = document.defaultView.getComputedStyle(field);
+ computedStyleTextarea = document.defaultView.getComputedStyle(textarea);
+ if (computedStyleField.color == originalForeground) {
+ testFailed('Foreground color for <input> element did not change when autofilled.');
return;
}
- if (autofilledBackground == originalBackground) {
- testFailed('Background color did not change when autofilled.');
+ if (computedStyleField.backgroundColor == originalBackground) {
+ testFailed('Background color for <input> element did not change when autofilled.');
+ return;
+ }
+ if (computedStyleTextarea.color == originalForeground) {
+ testFailed('Foreground color for <textarea> element did not change when autofilled.');
+ return;
+ }
+ if (computedStyleTextarea.backgroundColor == originalBackground) {
+ testFailed('Background color for <textarea> element did not change when autofilled.');
return;
}
if (window.internals) {
- window.internals.setAutofilled(tf, false);
+ window.internals.setAutofilled(field, false);
+ window.internals.setAutofilled(textarea, false);
}
// Colors should be restored.
- computedStyle = document.defaultView.getComputedStyle(tf);
- if (computedStyle.color != originalForeground) {
- testFailed('Foreground color did not revert when un-autofilled.');
+ computedStyleField = document.defaultView.getComputedStyle(field);
+ computedStyleTextarea = document.defaultView.getComputedStyle(textarea);
+ if (computedStyleField.color != originalForeground) {
+ testFailed('Foreground color for <input> element did not revert when un-autofilled.');
+ return;
+ }
+ if (computedStyleField.backgroundColor != originalBackground) {
+ testFailed('Background color for <input> element did not revert when un-autofilled.');
+ return;
+ }
+ if (computedStyleTextarea.color != originalForeground) {
+ testFailed('Foreground color for <textarea> element did not revert when un-autofilled.');
return;
}
- if (computedStyle.backgroundColor != originalBackground) {
- testFailed('Background color did not revert when un-autofilled.');
+ if (computedStyleTextarea.backgroundColor != originalBackground) {
+ testFailed('Background color for <textarea> element did not revert when un-autofilled.');
return;
}
@@ -49,17 +83,17 @@
</script>
<style>
- #tf {
+ #field, #textarea {
color: #FFFFFF;
background-color: #FFFFFF;
}
</style>
</head>
<body onload="test()">
- This tests that foreground and background colors properly change for autofilled inputs. It can only be run using DumpRenderTree.<br>
+ This tests that foreground and background colors properly change for autofilled inputs. It can only be run using the test harness.<br>
<form name="fm">
- <input type="text" id="tf" value="Field value" />
+ <input type="text" id="field" value="Field value">
+ <textarea id="textarea"></textarea>
</form>
<div id="console"></div>
</body>
-</html>
« no previous file with comments | « no previous file | LayoutTests/fast/forms/input-autofilled-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698