| OLD | NEW |
| 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 <memory> | 7 #include <memory> |
| 8 #include "bindings/core/v8/V8BindingForCore.h" | 8 #include "bindings/core/v8/V8BindingForCore.h" |
| 9 #include "core/dom/ShadowRootInit.h" | 9 #include "core/dom/ShadowRootInit.h" |
| 10 #include "core/html/HTMLElement.h" | 10 #include "core/html/HTMLElement.h" |
| 11 #include "core/testing/DummyPageHolder.h" | 11 #include "core/testing/DummyPageHolder.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class FocusControllerTest : public testing::Test { | 16 class FocusControllerTest : public ::testing::Test { |
| 17 public: | 17 public: |
| 18 Document& GetDocument() const { return page_holder_->GetDocument(); } | 18 Document& GetDocument() const { return page_holder_->GetDocument(); } |
| 19 FocusController& GetFocusController() const { | 19 FocusController& GetFocusController() const { |
| 20 return GetDocument().GetPage()->GetFocusController(); | 20 return GetDocument().GetPage()->GetFocusController(); |
| 21 } | 21 } |
| 22 DummyPageHolder* PageHolder() const { return page_holder_.get(); } | 22 DummyPageHolder* PageHolder() const { return page_holder_.get(); } |
| 23 | 23 |
| 24 private: | 24 private: |
| 25 void SetUp() override { page_holder_ = DummyPageHolder::Create(); } | 25 void SetUp() override { page_holder_ = DummyPageHolder::Create(); } |
| 26 | 26 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 TEST_F(FocusControllerTest, SetActiveOnInactiveDocument) { | 88 TEST_F(FocusControllerTest, SetActiveOnInactiveDocument) { |
| 89 // Test for crbug.com/700334 | 89 // Test for crbug.com/700334 |
| 90 GetDocument().Shutdown(); | 90 GetDocument().Shutdown(); |
| 91 // Document::shutdown() detaches document from its frame, and thus | 91 // Document::shutdown() detaches document from its frame, and thus |
| 92 // document().page() becomes nullptr. | 92 // document().page() becomes nullptr. |
| 93 // Use DummyPageHolder's page to retrieve FocusController. | 93 // Use DummyPageHolder's page to retrieve FocusController. |
| 94 PageHolder()->GetPage().GetFocusController().SetActive(true); | 94 PageHolder()->GetPage().GetFocusController().SetActive(true); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace blink | 97 } // namespace blink |
| OLD | NEW |