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

Unified Diff: third_party/WebKit/Source/core/html/forms/PasswordInputTypeTest.cpp

Issue 2515373003: Post tasks for sensitive input visibility notifications (Closed)
Patch Set: dcheng, haraken comments round 2 Created 4 years, 1 month 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/html/forms/PasswordInputType.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/html/forms/PasswordInputTypeTest.cpp
diff --git a/third_party/WebKit/Source/core/html/forms/PasswordInputTypeTest.cpp b/third_party/WebKit/Source/core/html/forms/PasswordInputTypeTest.cpp
index 2c66de2afc1c266ad53fa9119afc28bf0030a9ad..f57c5041bc5c7de8d73bbcbf6655ea086074c9a6 100644
--- a/third_party/WebKit/Source/core/html/forms/PasswordInputTypeTest.cpp
+++ b/third_party/WebKit/Source/core/html/forms/PasswordInputTypeTest.cpp
@@ -296,4 +296,24 @@ TEST(PasswordInputTypeTest, PasswordFieldsBecomeNonPasswordFields) {
EXPECT_EQ(1u, interfaceProvider.numPasswordFieldsInvisibleCalls());
}
+// Tests that only one Mojo message is sent for multiple password
+// visibility events within the same task.
+TEST(PasswordInputTypeTest, MultipleEventsInSameTask) {
+ MockInterfaceProvider interfaceProvider;
+ std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create(
+ IntSize(2000, 2000), nullptr, nullptr, nullptr, &interfaceProvider);
+ pageHolder->document().body()->setInnerHTML("<input type='password'>");
+ pageHolder->document().view()->updateAllLifecyclePhases();
+ // Make the password field invisible in the same task.
+ HTMLInputElement* input =
+ toHTMLInputElement(pageHolder->document().body()->firstChild());
+ input->setType("text");
+ pageHolder->document().view()->updateAllLifecyclePhases();
+ blink::testing::runPendingTasks();
+ // Only a single Mojo message should have been sent, with the latest state of
+ // the page (which is that no password fields are visible).
+ EXPECT_EQ(1u, interfaceProvider.numPasswordFieldsInvisibleCalls());
+ EXPECT_FALSE(interfaceProvider.passwordFieldVisibleCalled());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/html/forms/PasswordInputType.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698