| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/editing/EditingTestBase.h" | 5 #include "core/editing/EditingTestBase.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/Range.h" | 8 #include "core/dom/Range.h" |
| 9 #include "core/dom/Text.h" | 9 #include "core/dom/Text.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 FrameSelection& EditingTestBase::selection() const { | 28 FrameSelection& EditingTestBase::selection() const { |
| 29 return frame().selection(); | 29 return frame().selection(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void EditingTestBase::SetUp() { | 32 void EditingTestBase::SetUp() { |
| 33 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); | 33 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void EditingTestBase::setupPageWithClients(Page::PageClients* clients) { |
| 37 DCHECK(!m_dummyPageHolder) << "Page should be set up only once"; |
| 38 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), clients); |
| 39 } |
| 40 |
| 36 ShadowRoot* EditingTestBase::createShadowRootForElementWithIDAndSetInnerHTML( | 41 ShadowRoot* EditingTestBase::createShadowRootForElementWithIDAndSetInnerHTML( |
| 37 TreeScope& scope, | 42 TreeScope& scope, |
| 38 const char* hostElementID, | 43 const char* hostElementID, |
| 39 const char* shadowRootContent) { | 44 const char* shadowRootContent) { |
| 40 ShadowRoot* shadowRoot = | 45 ShadowRoot* shadowRoot = |
| 41 scope.getElementById(AtomicString::fromUTF8(hostElementID)) | 46 scope.getElementById(AtomicString::fromUTF8(hostElementID)) |
| 42 ->createShadowRootInternal(ShadowRootType::V0, ASSERT_NO_EXCEPTION); | 47 ->createShadowRootInternal(ShadowRootType::V0, ASSERT_NO_EXCEPTION); |
| 43 shadowRoot->setInnerHTML(String::fromUTF8(shadowRootContent), | 48 shadowRoot->setInnerHTML(String::fromUTF8(shadowRootContent), |
| 44 ASSERT_NO_EXCEPTION); | 49 ASSERT_NO_EXCEPTION); |
| 45 scope.document().view()->updateAllLifecyclePhases(); | 50 scope.document().view()->updateAllLifecyclePhases(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 57 ShadowRoot* shadowRoot = createShadowRootForElementWithIDAndSetInnerHTML( | 62 ShadowRoot* shadowRoot = createShadowRootForElementWithIDAndSetInnerHTML( |
| 58 document(), host, shadowContent); | 63 document(), host, shadowContent); |
| 59 return shadowRoot; | 64 return shadowRoot; |
| 60 } | 65 } |
| 61 | 66 |
| 62 void EditingTestBase::updateAllLifecyclePhases() { | 67 void EditingTestBase::updateAllLifecyclePhases() { |
| 63 document().view()->updateAllLifecyclePhases(); | 68 document().view()->updateAllLifecyclePhases(); |
| 64 } | 69 } |
| 65 | 70 |
| 66 } // namespace blink | 71 } // namespace blink |
| OLD | NEW |