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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_block_node_test.cc

Issue 2725773002: Remove NGBlockNode constructor, SetFirstChild, SetNextSibling methods (Closed)
Patch Set: git cl web Created 3 years, 9 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/layout/ng/ng_block_node.h" 5 #include "core/layout/ng/ng_block_node.h"
6 6
7 #include "core/layout/ng/ng_box_fragment.h" 7 #include "core/layout/LayoutTestHelper.h"
8 #include "core/style/ComputedStyle.h"
9 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
10 9
11 namespace blink { 10 namespace blink {
12 namespace { 11 namespace {
13 class NGBlockNodeForTest : public ::testing::Test { 12 class NGBlockNodeForTest : public RenderingTest {
14 protected: 13 public:
15 void SetUp() override { style_ = ComputedStyle::create(); } 14 NGBlockNodeForTest() { RuntimeEnabledFeatures::setLayoutNGEnabled(true); }
16 15 ~NGBlockNodeForTest() { RuntimeEnabledFeatures::setLayoutNGEnabled(false); };
17 RefPtr<ComputedStyle> style_;
18 }; 16 };
19 17
20 TEST_F(NGBlockNodeForTest, MinAndMaxContent) { 18 TEST_F(NGBlockNodeForTest, MinAndMaxContent) {
19 setBodyInnerHTML(R"HTML(
20 <div id="box" >
21 <div id="first_child" style="width:30px">
22 </div>
23 </div>
24 )HTML");
21 const int kWidth = 30; 25 const int kWidth = 30;
22 26
23 RefPtr<ComputedStyle> first_style = ComputedStyle::create(); 27 NGBlockNode* box = new NGBlockNode(getLayoutObjectByElementId("box"));
24 first_style->setWidth(Length(kWidth, Fixed));
25 NGBlockNode* first_child = new NGBlockNode(first_style.get());
26
27 NGBlockNode* box = new NGBlockNode(style_.get());
28 box->SetFirstChild(first_child);
29
30 MinAndMaxContentSizes sizes = box->ComputeMinAndMaxContentSizes(); 28 MinAndMaxContentSizes sizes = box->ComputeMinAndMaxContentSizes();
31 EXPECT_EQ(LayoutUnit(kWidth), sizes.min_content); 29 EXPECT_EQ(LayoutUnit(kWidth), sizes.min_content);
32 EXPECT_EQ(LayoutUnit(kWidth), sizes.max_content); 30 EXPECT_EQ(LayoutUnit(kWidth), sizes.max_content);
33 } 31 }
34 } // namespace 32 } // namespace
35 } // namespace blink 33 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698