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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutTestHelper.h

Issue 2504573002: Don't call isURLAllowed() from layout. (Closed)
Patch Set: Fix bad formatting that caused clang-format-diff to get confused. Created 4 years, 1 month 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
Index: third_party/WebKit/Source/core/layout/LayoutTestHelper.h
diff --git a/third_party/WebKit/Source/core/layout/LayoutTestHelper.h b/third_party/WebKit/Source/core/layout/LayoutTestHelper.h
index fc6845cd305407e45370f903e25df9e939f45569..0750fad785e495fc57726e685740ddc2805773ed 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTestHelper.h
+++ b/third_party/WebKit/Source/core/layout/LayoutTestHelper.h
@@ -20,6 +20,52 @@
namespace blink {
+class SingleChildFrameLoaderClient final : public EmptyFrameLoaderClient {
+ public:
+ static SingleChildFrameLoaderClient* create() {
+ return new SingleChildFrameLoaderClient();
+ }
+
+ DEFINE_INLINE_VIRTUAL_TRACE() {
+ visitor->trace(m_child);
+ EmptyFrameLoaderClient::trace(visitor);
+ }
+
+ // FrameLoaderClient overrides:
+ LocalFrame* firstChild() const override { return m_child.get(); }
+ LocalFrame* createFrame(const FrameLoadRequest&,
+ const AtomicString& name,
+ HTMLFrameOwnerElement*) override;
+
+ void didDetachChild() { m_child = nullptr; }
+
+ private:
+ explicit SingleChildFrameLoaderClient() {}
+
+ Member<LocalFrame> m_child;
+};
+
+class FrameLoaderClientWithParent final : public EmptyFrameLoaderClient {
+ public:
+ static FrameLoaderClientWithParent* create(LocalFrame* parent) {
+ return new FrameLoaderClientWithParent(parent);
+ }
+
+ DEFINE_INLINE_VIRTUAL_TRACE() {
+ visitor->trace(m_parent);
+ EmptyFrameLoaderClient::trace(visitor);
+ }
+
+ // FrameClient overrides:
+ void detached(FrameDetachType) override;
+ LocalFrame* parent() const override { return m_parent.get(); }
+
+ private:
+ explicit FrameLoaderClientWithParent(LocalFrame* parent) : m_parent(parent) {}
+
+ Member<LocalFrame> m_parent;
+};
+
class RenderingTest : public testing::Test {
USING_FAST_MALLOC(RenderingTest);
@@ -46,9 +92,11 @@ class RenderingTest : public testing::Test {
document().view()->updateAllLifecyclePhases();
}
- // Returns the Document for the iframe.
- Document& setupChildIframe(const AtomicString& iframeElementId,
- const String& htmlContentOfIframe);
+ Document& childDocument() {
+ return *toLocalFrame(m_pageHolder->frame().tree().firstChild())->document();
+ }
+
+ void setChildFrameHTML(const String&);
// Both enables compositing and runs the document lifecycle.
void enableCompositing() {
@@ -64,52 +112,10 @@ class RenderingTest : public testing::Test {
}
private:
- Persistent<LocalFrame> m_subframe;
Persistent<FrameLoaderClient> m_frameLoaderClient;
- Persistent<FrameLoaderClient> m_childFrameLoaderClient;
std::unique_ptr<DummyPageHolder> m_pageHolder;
};
-class SingleChildFrameLoaderClient final : public EmptyFrameLoaderClient {
- public:
- static SingleChildFrameLoaderClient* create() {
- return new SingleChildFrameLoaderClient;
- }
-
- DEFINE_INLINE_VIRTUAL_TRACE() {
- visitor->trace(m_child);
- EmptyFrameLoaderClient::trace(visitor);
- }
-
- Frame* firstChild() const override { return m_child.get(); }
-
- void setChild(Frame* child) { m_child = child; }
-
- private:
- SingleChildFrameLoaderClient() : m_child(nullptr) {}
-
- Member<Frame> m_child;
-};
-
-class FrameLoaderClientWithParent final : public EmptyFrameLoaderClient {
- public:
- static FrameLoaderClientWithParent* create(Frame* parent) {
- return new FrameLoaderClientWithParent(parent);
- }
-
- DEFINE_INLINE_VIRTUAL_TRACE() {
- visitor->trace(m_parent);
- EmptyFrameLoaderClient::trace(visitor);
- }
-
- Frame* parent() const override { return m_parent.get(); }
-
- private:
- explicit FrameLoaderClientWithParent(Frame* parent) : m_parent(parent) {}
-
- Member<Frame> m_parent;
-};
-
} // namespace blink
#endif // LayoutTestHelper_h
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTestHelper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698