| 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
|
|
|