Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "core/layout/LayoutIFrame.h" | |
| 6 #include "core/layout/LayoutTestHelper.h" | |
| 7 #include "core/layout/LayoutView.h" | |
| 8 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | |
| 9 #include "testing/gtest/include/gtest/gtest.h" | |
| 10 | |
| 11 namespace blink { | |
| 12 | |
| 13 class LayoutIFrameTest : public RenderingTest { | |
| 14 public: | |
| 15 LayoutIFrameTest() : RenderingTest(SingleChildLocalFrameClient::Create()) {} | |
| 16 }; | |
| 17 | |
| 18 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.
| |
| 19 GetDocument().SetBaseURLOverride(KURL(kParsedURLString, "http://test.com")); | |
| 20 SetBodyInnerHTML( | |
| 21 "<style>body { margin: 0; } iframe { display: block; } </style>" | |
| 22 "<iframe id='owner' src='http://test.com' width='500' height='500' " | |
| 23 "style='touch-action: none'>" | |
| 24 "</iframe>"); | |
| 25 SetChildFrameHTML( | |
| 26 "<style>body { margin: 0; } #target { width: 200px; height: 200px; } " | |
| 27 "</style>" | |
| 28 "<div id='target' style='touch-action: pinch-zoom'></div>"); | |
| 29 GetDocument().View()->UpdateAllLifecyclePhases(); | |
| 30 | |
| 31 Element* target = ChildDocument().getElementById("target"); | |
| 32 ASSERT_TRUE(target && target->GetComputedStyle()); | |
| 33 EXPECT_EQ(TouchAction::kTouchActionNone, | |
| 34 target->GetComputedStyle()->GetEffectiveTouchAction()); | |
| 35 | |
| 36 Element* owner = GetDocument().getElementById("owner"); | |
| 37 ASSERT_TRUE(owner); | |
| 38 owner->setAttribute(HTMLNames::styleAttr, "touch-action: auto"); | |
| 39 GetDocument().View()->UpdateAllLifecyclePhases(); | |
| 40 EXPECT_EQ(TouchAction::kTouchActionPinchZoom, | |
| 41 target->GetComputedStyle()->GetEffectiveTouchAction()); | |
| 42 } | |
| 43 | |
| 44 } // namespace blink | |
| OLD | NEW |