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

Unified Diff: third_party/WebKit/Source/core/page/FocusControllerTest.cpp

Issue 1759413002: FocusController::setInitialFocus should ignore sequential focus navigation starting point. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/page/FocusController.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/page/FocusControllerTest.cpp
diff --git a/third_party/WebKit/Source/core/page/FocusControllerTest.cpp b/third_party/WebKit/Source/core/page/FocusControllerTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..39e34485d462796eee492f7782014b7bf46ca9b0
--- /dev/null
+++ b/third_party/WebKit/Source/core/page/FocusControllerTest.cpp
@@ -0,0 +1,35 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/page/FocusController.h"
+
+#include "core/html/HTMLElement.h"
+#include "core/testing/DummyPageHolder.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+
+class FocusControllerTest : public testing::Test {
+public:
+ Document& document() const { return m_pageHolder->document(); }
+ FocusController& focusController() const { return document().page()->focusController(); }
+
+private:
+ void SetUp() override { m_pageHolder = DummyPageHolder::create(); }
+
+ OwnPtr<DummyPageHolder> m_pageHolder;
+};
+
+TEST_F(FocusControllerTest, SetInitialFocus)
+{
+ document().body()->setInnerHTML("<input><textarea>", ASSERT_NO_EXCEPTION);
+ Element* input = toElement(document().body()->firstChild());
+ // Set sequential focus navigation point before the initial focus.
+ input->focus();
+ input->blur();
+ focusController().setInitialFocus(WebFocusTypeForward);
+ EXPECT_EQ(input, document().focusedElement()) << "We should ignore sequential focus navigation starting point in setInitialFocus().";
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/page/FocusController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698