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

Unified Diff: third_party/WebKit/Source/core/editing/EditorTest.cpp

Issue 2740823003: [PasswordGeneration] Makes generated passwords copyable (Closed)
Patch Set: Changes in the test addressed to reviewer comments Created 3 years, 9 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 | « third_party/WebKit/Source/core/editing/Editor.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/EditorTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/EditorTest.cpp b/third_party/WebKit/Source/core/editing/EditorTest.cpp
index b2bd10e3626068ade95aaa7fa945eff5978df0d0..3e5cd3ac412dab619be3dd0ac7fe1d1aeb3c07e1 100644
--- a/third_party/WebKit/Source/core/editing/EditorTest.cpp
+++ b/third_party/WebKit/Source/core/editing/EditorTest.cpp
@@ -10,6 +10,7 @@
#include "core/html/HTMLDivElement.h"
#include "core/html/HTMLHeadElement.h"
#include "core/html/HTMLHtmlElement.h"
+#include "core/html/HTMLInputElement.h"
namespace blink {
@@ -59,4 +60,26 @@ TEST_F(EditorTest, tidyUpHTMLStructureFromHead) {
EXPECT_EQ(document().documentElement(), head->parentNode());
}
+TEST_F(EditorTest, copyGeneratedPassword) {
+ // Checks that if the password field has the value generated by Chrome
+ // (HTMLInputElement::shouldRevealPassword will be true), copying the field
+ // should be available.
+ const char* bodyContent = "<input type='password' id='password'></input>";
+ setBodyContent(bodyContent);
+
+ HTMLInputElement& element =
+ toHTMLInputElement(*document().getElementById("password"));
+
+ const String kPasswordValue = "secret";
+ element.focus();
+ element.setValue(kPasswordValue);
+ element.setSelectionRange(0, kPasswordValue.length());
+
+ Editor& editor = document().frame()->editor();
+ EXPECT_FALSE(editor.canCopy());
+
+ element.setShouldRevealPassword(true);
+ EXPECT_TRUE(editor.canCopy());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/editing/Editor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698