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

Unified Diff: third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp

Issue 2745103008: INPUT element: Fix a DCHECK failure in RadioInputType::findNextFocusableRadioButtonInGroup. (Closed)
Patch Set: Add C++ unit test 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
Index: third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp
index e6e8ffdb9a19fa9c3c05441d37403da56be4aeb1..3926038cc0fd5d1c0de8b0695d4c1172fbd685d1 100644
--- a/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp
@@ -4,7 +4,10 @@
#include "core/html/HTMLInputElement.h"
+#include <memory>
#include "core/dom/Document.h"
+#include "core/events/KeyboardEvent.h"
+#include "core/events/KeyboardEventInit.h"
#include "core/frame/FrameHost.h"
#include "core/frame/FrameView.h"
#include "core/frame/VisualViewport.h"
@@ -15,7 +18,6 @@
#include "core/html/forms/DateTimeChooser.h"
#include "core/testing/DummyPageHolder.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include <memory>
namespace blink {
@@ -148,6 +150,22 @@ TEST_F(HTMLInputElementTest, ImageTypeCrash) {
input->setAttribute(HTMLNames::valueAttr, "aaa");
}
+TEST_F(HTMLInputElementTest, RadioKeyDownDCHECKFailure) {
+ // crbug.com/697286
+ document().body()->setInnerHTML(
+ "<input type=radio name=g><input type=radio name=g>");
+ HTMLInputElement& radio1 =
+ toHTMLInputElement(*document().body()->firstChild());
+ HTMLInputElement& radio2 = toHTMLInputElement(*radio1.nextSibling());
+ radio1.focus();
+ // Make layout-dirty.
+ radio2.setAttribute(HTMLNames::styleAttr, "position:fixed");
+ KeyboardEventInit init;
+ init.setKey("ArrowRight");
+ radio1.defaultEventHandler(new KeyboardEvent("keydown", init));
+ EXPECT_EQ(document().activeElement(), &radio2);
+}
+
TEST_F(HTMLInputElementTest, DateTimeChooserSizeParamRespectsScale) {
document().view()->frame().page()->visualViewport().setScale(2.f);
document().body()->setInnerHTML(
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLInputElement.h ('k') | third_party/WebKit/Source/core/html/forms/RadioInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698