Chromium Code Reviews| 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..30d7da449c7ee2b415eaec366230fc2ce01ab1d0 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,27 @@ 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); |
| + |
| + Node* node = document().body()->firstChild(); |
|
yosin_UTC9
2017/03/13 07:35:41
L70 to L71 should be
HTMLInputElement& element =
kolos1
2017/03/13 08:15:54
Done.
|
| + ASSERT_TRUE(isHTMLInputElement(node)); |
| + HTMLInputElement& element = toHTMLInputElement(*node); |
| + |
| + String passwordValue = "secret"; |
|
yosin_UTC9
2017/03/13 07:35:41
nit: s/String passwordValue/const String kPassword
kolos1
2017/03/13 08:15:54
Done.
|
| + element.focus(); |
| + element.setValue(passwordValue); |
| + element.setSelectionRange(0, passwordValue.length()); |
| + |
| + Editor& editor = document().frame()->editor(); |
| + EXPECT_FALSE(editor.canCopy()); |
| + |
| + element.setShouldRevealPassword(true); |
| + EXPECT_TRUE(editor.canCopy()); |
| +} |
| + |
| } // namespace blink |