Commit 0b586147 authored by Christian Biesinger's avatar Christian Biesinger Committed by Commit Bot

Also accept LayoutNG objects in Layout{Block,Object}Test

R=ikilpatrick@chromium.org

Change-Id: I8671ab92cb0c043dc9a3dc3509d92586ee78779c
Reviewed-on: https://chromium-review.googlesource.com/c/1330829Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607067}
parent d64c807d
...@@ -5,11 +5,14 @@ ...@@ -5,11 +5,14 @@
#include "third_party/blink/renderer/core/dom/element_traversal.h" #include "third_party/blink/renderer/core/dom/element_traversal.h"
#include "third_party/blink/renderer/core/layout/layout_block.h" #include "third_party/blink/renderer/core/layout/layout_block.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/layout/layout_block_flow.h" #include "third_party/blink/renderer/core/layout/layout_block_flow.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h" #include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" #include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
using ::testing::MatchesRegex;
namespace blink { namespace blink {
class LayoutBlockTest : public RenderingTest {}; class LayoutBlockTest : public RenderingTest {};
...@@ -19,8 +22,8 @@ TEST_F(LayoutBlockTest, LayoutNameCalledWithNullStyle) { ...@@ -19,8 +22,8 @@ TEST_F(LayoutBlockTest, LayoutNameCalledWithNullStyle) {
LayoutObject* obj = LayoutBlockFlow::CreateAnonymous(&GetDocument(), style); LayoutObject* obj = LayoutBlockFlow::CreateAnonymous(&GetDocument(), style);
obj->SetStyleInternal(nullptr); obj->SetStyleInternal(nullptr);
EXPECT_FALSE(obj->Style()); EXPECT_FALSE(obj->Style());
EXPECT_STREQ("LayoutBlockFlow (anonymous)", EXPECT_THAT(obj->DecoratedName().Ascii().data(),
obj->DecoratedName().Ascii().data()); MatchesRegex("LayoutN?G?BlockFlow \\(anonymous\\)"));
obj->Destroy(); obj->Destroy();
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "third_party/blink/renderer/core/layout/layout_object.h" #include "third_party/blink/renderer/core/layout/layout_object.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
...@@ -22,6 +23,7 @@ ...@@ -22,6 +23,7 @@
namespace blink { namespace blink {
using testing::Return; using testing::Return;
using testing::MatchesRegex;
class LayoutObjectTest : public RenderingTest { class LayoutObjectTest : public RenderingTest {
public: public:
...@@ -54,8 +56,8 @@ TEST_F(LayoutObjectTest, LayoutDecoratedNameCalledWithPositionedObject) { ...@@ -54,8 +56,8 @@ TEST_F(LayoutObjectTest, LayoutDecoratedNameCalledWithPositionedObject) {
DCHECK(div); DCHECK(div);
LayoutObject* obj = div->GetLayoutObject(); LayoutObject* obj = div->GetLayoutObject();
DCHECK(obj); DCHECK(obj);
EXPECT_STREQ("LayoutBlockFlow (positioned)", EXPECT_THAT(obj->DecoratedName().Ascii().data(),
obj->DecoratedName().Ascii().data()); MatchesRegex("LayoutN?G?BlockFlow \\(positioned\\)"));
} }
// Some display checks. // Some display checks.
...@@ -719,9 +721,9 @@ lime'> ...@@ -719,9 +721,9 @@ lime'>
StringBuilder result; StringBuilder result;
block->DumpLayoutObject(result, false, 0); block->DumpLayoutObject(result, false, 0);
EXPECT_EQ( EXPECT_THAT(result.ToString().Utf8().data(),
result.ToString(), MatchesRegex("LayoutN?G?BlockFlow\tDIV id=\"block\" "
String("LayoutBlockFlow\tDIV id=\"block\" style=\"background:\\nlime\"")); "style=\"background:\\\\nlime\""));
result.Clear(); result.Clear();
text->DumpLayoutObject(result, false, 0); text->DumpLayoutObject(result, false, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment