Index: third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..32399911203e150f7ff7b2d02834289aa092d5c7 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_base_layout_algorithm_test.cc |
@@ -0,0 +1,40 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "core/layout/ng/ng_base_layout_algorithm_test.h" |
+ |
+#include "core/layout/ng/layout_ng_block_flow.h" |
+#include "core/layout/ng/ng_block_layout_algorithm.h" |
+#include "core/layout/ng/ng_physical_fragment.h" |
+namespace blink { |
+ |
+NGBaseLayoutAlgorithmTest::NGBaseLayoutAlgorithmTest() { |
+ RuntimeEnabledFeatures::setLayoutNGEnabled(true); |
+ RuntimeEnabledFeatures::setLayoutNGInlineEnabled(true); |
+} |
+ |
+NGBaseLayoutAlgorithmTest::~NGBaseLayoutAlgorithmTest() { |
+ RuntimeEnabledFeatures::setLayoutNGEnabled(false); |
+ RuntimeEnabledFeatures::setLayoutNGInlineEnabled(false); |
+} |
+ |
+void NGBaseLayoutAlgorithmTest::SetUp() { |
+ RenderingTest::SetUp(); |
+ enableCompositing(); |
+} |
+ |
+std::pair<RefPtr<NGPhysicalBoxFragment>, RefPtr<NGConstraintSpace>> |
+NGBaseLayoutAlgorithmTest::RunBlockLayoutAlgorithmForElement(Element* element) { |
+ LayoutNGBlockFlow* block_flow = toLayoutNGBlockFlow(element->layoutObject()); |
+ NGBlockNode* node = new NGBlockNode(block_flow); |
+ RefPtr<NGConstraintSpace> space = |
+ NGConstraintSpace::CreateFromLayoutObject(*block_flow); |
+ |
+ RefPtr<NGLayoutResult> result = |
+ NGBlockLayoutAlgorithm(node, space.get()).Layout(); |
+ return std::make_pair( |
+ toNGPhysicalBoxFragment(result->PhysicalFragment().get()), space); |
+} |
+ |
+} // namespace blink |