summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/layout/layout_media_test.cc
blob: 6b281f9728a47d97c654a1f30049006bfec7622a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// 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 "third_party/blink/renderer/core/layout/layout_video.h"

#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"

namespace blink {

using LayoutMediaTest = RenderingTest;

TEST_F(LayoutMediaTest, DisallowInlineChild) {
  SetBodyInnerHTML(R"HTML(
    <style>
      ::-webkit-media-controls { display: inline; }
    </style>
    <video id='video'></video>
  )HTML");

  EXPECT_FALSE(GetLayoutObjectByElementId("video")->SlowFirstChild());
}

TEST_F(LayoutMediaTest, DisallowBlockChild) {
  SetBodyInnerHTML(R"HTML(
    <style>
      ::-webkit-media-controls { display: block; }
    </style>
    <video id='video'></video>
  )HTML");

  EXPECT_FALSE(GetLayoutObjectByElementId("video")->SlowFirstChild());
}

TEST_F(LayoutMediaTest, DisallowOutOfFlowPositionedChild) {
  SetBodyInnerHTML(R"HTML(
    <style>
      ::-webkit-media-controls { position: absolute; }
    </style>
    <video id='video'></video>
  )HTML");

  EXPECT_FALSE(GetLayoutObjectByElementId("video")->SlowFirstChild());
}

TEST_F(LayoutMediaTest, DisallowFloatingChild) {
  SetBodyInnerHTML(R"HTML(
    <style>
      ::-webkit-media-controls { float: left; }
    </style>
    <video id='video'></video>
  )HTML");

  EXPECT_FALSE(GetLayoutObjectByElementId("video")->SlowFirstChild());
}

}  // namespace blink