Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutIFrameTest.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutIFrameTest.cpp b/third_party/WebKit/Source/core/layout/LayoutIFrameTest.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9700e1a411e6ae184dc25bdf2b2d30f3f2cfea81 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/layout/LayoutIFrameTest.cpp |
| @@ -0,0 +1,44 @@ |
| +// 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/LayoutIFrame.h" |
| +#include "core/layout/LayoutTestHelper.h" |
| +#include "core/layout/LayoutView.h" |
| +#include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace blink { |
| + |
| +class LayoutIFrameTest : public RenderingTest { |
| + public: |
| + LayoutIFrameTest() : RenderingTest(SingleChildLocalFrameClient::Create()) {} |
| +}; |
| + |
| +TEST_F(LayoutIFrameTest, TouchActionPropagatedAcrossIframes) { |
|
flackr
2017/06/21 15:24:34
Can you make this part of StyleAdjusterTest to kee
sunxd
2017/06/22 17:22:55
Done.
|
| + GetDocument().SetBaseURLOverride(KURL(kParsedURLString, "http://test.com")); |
| + SetBodyInnerHTML( |
| + "<style>body { margin: 0; } iframe { display: block; } </style>" |
| + "<iframe id='owner' src='http://test.com' width='500' height='500' " |
| + "style='touch-action: none'>" |
| + "</iframe>"); |
| + SetChildFrameHTML( |
| + "<style>body { margin: 0; } #target { width: 200px; height: 200px; } " |
| + "</style>" |
| + "<div id='target' style='touch-action: pinch-zoom'></div>"); |
| + GetDocument().View()->UpdateAllLifecyclePhases(); |
| + |
| + Element* target = ChildDocument().getElementById("target"); |
| + ASSERT_TRUE(target && target->GetComputedStyle()); |
| + EXPECT_EQ(TouchAction::kTouchActionNone, |
| + target->GetComputedStyle()->GetEffectiveTouchAction()); |
| + |
| + Element* owner = GetDocument().getElementById("owner"); |
| + ASSERT_TRUE(owner); |
| + owner->setAttribute(HTMLNames::styleAttr, "touch-action: auto"); |
| + GetDocument().View()->UpdateAllLifecyclePhases(); |
| + EXPECT_EQ(TouchAction::kTouchActionPinchZoom, |
| + target->GetComputedStyle()->GetEffectiveTouchAction()); |
| +} |
| + |
| +} // namespace blink |