| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/page/FocusController.h" |
| 6 |
| 7 #include "core/html/HTMLElement.h" |
| 8 #include "core/testing/DummyPageHolder.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 class FocusControllerTest : public testing::Test { |
| 14 public: |
| 15 Document& document() const { return m_pageHolder->document(); } |
| 16 FocusController& focusController() const { return document().page()->focusCo
ntroller(); } |
| 17 |
| 18 private: |
| 19 void SetUp() override { m_pageHolder = DummyPageHolder::create(); } |
| 20 |
| 21 OwnPtr<DummyPageHolder> m_pageHolder; |
| 22 }; |
| 23 |
| 24 TEST_F(FocusControllerTest, SetInitialFocus) |
| 25 { |
| 26 document().body()->setInnerHTML("<input><textarea>", ASSERT_NO_EXCEPTION); |
| 27 Element* input = toElement(document().body()->firstChild()); |
| 28 // Set sequential focus navigation point before the initial focus. |
| 29 input->focus(); |
| 30 input->blur(); |
| 31 focusController().setInitialFocus(WebFocusTypeForward); |
| 32 EXPECT_EQ(input, document().focusedElement()) << "We should ignore sequentia
l focus navigation starting point in setInitialFocus()."; |
| 33 } |
| 34 |
| 35 } // namespace blink |
| OLD | NEW |