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

Side by Side Diff: third_party/WebKit/Source/core/page/FocusControllerTest.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/page/FocusController.h" 5 #include "core/page/FocusController.h"
6 6
7 #include "core/dom/shadow/ShadowRootInit.h" 7 #include "core/dom/shadow/ShadowRootInit.h"
8 #include "core/html/HTMLElement.h" 8 #include "core/html/HTMLElement.h"
9 #include "core/testing/DummyPageHolder.h" 9 #include "core/testing/DummyPageHolder.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include <memory>
12 11
13 namespace blink { 12 namespace blink {
14 13
15 class FocusControllerTest : public testing::Test { 14 class FocusControllerTest : public testing::Test {
16 public: 15 public:
17 Document& document() const { return m_pageHolder->document(); } 16 Document& document() const { return m_pageHolder->document(); }
18 FocusController& focusController() const { return document().page()->focusCo ntroller(); } 17 FocusController& focusController() const { return document().page()->focusCo ntroller(); }
19 18
20 private: 19 private:
21 void SetUp() override { m_pageHolder = DummyPageHolder::create(); } 20 void SetUp() override { m_pageHolder = DummyPageHolder::create(); }
22 21
23 std::unique_ptr<DummyPageHolder> m_pageHolder; 22 OwnPtr<DummyPageHolder> m_pageHolder;
24 }; 23 };
25 24
26 TEST_F(FocusControllerTest, SetInitialFocus) 25 TEST_F(FocusControllerTest, SetInitialFocus)
27 { 26 {
28 document().body()->setInnerHTML("<input><textarea>", ASSERT_NO_EXCEPTION); 27 document().body()->setInnerHTML("<input><textarea>", ASSERT_NO_EXCEPTION);
29 Element* input = toElement(document().body()->firstChild()); 28 Element* input = toElement(document().body()->firstChild());
30 // Set sequential focus navigation point before the initial focus. 29 // Set sequential focus navigation point before the initial focus.
31 input->focus(); 30 input->focus();
32 input->blur(); 31 input->blur();
33 focusController().setInitialFocus(WebFocusTypeForward); 32 focusController().setInitialFocus(WebFocusTypeForward);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 host->attachShadow(ScriptState::forMainWorld(document().frame()), init, ASSE RT_NO_EXCEPTION); 71 host->attachShadow(ScriptState::forMainWorld(document().frame()), init, ASSE RT_NO_EXCEPTION);
73 72
74 // Set sequential focus navigation point at text node. 73 // Set sequential focus navigation point at text node.
75 document().setSequentialFocusNavigationStartingPoint(text); 74 document().setSequentialFocusNavigationStartingPoint(text);
76 75
77 focusController().advanceFocus(WebFocusTypeBackward); 76 focusController().advanceFocus(WebFocusTypeBackward);
78 EXPECT_EQ(target, document().focusedElement()) << "This should not hit asser tion and finish properly."; 77 EXPECT_EQ(target, document().focusedElement()) << "This should not hit asser tion and finish properly.";
79 } 78 }
80 79
81 } // namespace blink 80 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/EventSourceParser.h ('k') | third_party/WebKit/Source/core/page/NetworkStateNotifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698