| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/frame/LocalFrameView.h" | 5 #include "core/frame/LocalFrameView.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
| 10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
| 11 #include "core/html/HTMLElement.h" | 11 #include "core/html/HTMLElement.h" |
| 12 #include "core/layout/LayoutBoxModelObject.h" | 12 #include "core/layout/LayoutBoxModelObject.h" |
| 13 #include "core/layout/LayoutObject.h" | 13 #include "core/layout/LayoutObject.h" |
| 14 #include "core/loader/EmptyClients.h" | 14 #include "core/loader/EmptyClients.h" |
| 15 #include "core/page/Page.h" | 15 #include "core/page/Page.h" |
| 16 #include "core/paint/PaintLayer.h" | 16 #include "core/paint/PaintLayer.h" |
| 17 #include "core/testing/DummyPageHolder.h" | 17 #include "core/testing/DummyPageHolder.h" |
| 18 #include "platform/RuntimeEnabledFeatures.h" | 18 #include "platform/RuntimeEnabledFeatures.h" |
| 19 #include "platform/geometry/IntSize.h" | 19 #include "platform/geometry/IntSize.h" |
| 20 #include "platform/graphics/paint/PaintArtifact.h" | 20 #include "platform/graphics/paint/PaintArtifact.h" |
| 21 #include "platform/heap/Handle.h" | 21 #include "platform/heap/Handle.h" |
| 22 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 22 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
| 23 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 25 |
| 26 using testing::_; | 26 using ::testing::_; |
| 27 using testing::AnyNumber; | 27 using ::testing::AnyNumber; |
| 28 | 28 |
| 29 namespace blink { | 29 namespace blink { |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 class MockChromeClient : public EmptyChromeClient { | 32 class MockChromeClient : public EmptyChromeClient { |
| 33 public: | 33 public: |
| 34 MockChromeClient() : has_scheduled_animation_(false) {} | 34 MockChromeClient() : has_scheduled_animation_(false) {} |
| 35 | 35 |
| 36 // ChromeClient | 36 // ChromeClient |
| 37 MOCK_METHOD2(AttachRootGraphicsLayer, | 37 MOCK_METHOD2(AttachRootGraphicsLayer, |
| 38 void(GraphicsLayer*, LocalFrame* localRoot)); | 38 void(GraphicsLayer*, LocalFrame* localRoot)); |
| 39 MOCK_METHOD3(MockSetToolTip, void(LocalFrame*, const String&, TextDirection)); | 39 MOCK_METHOD3(MockSetToolTip, void(LocalFrame*, const String&, TextDirection)); |
| 40 void SetToolTip(LocalFrame& frame, | 40 void SetToolTip(LocalFrame& frame, |
| 41 const String& tooltip_text, | 41 const String& tooltip_text, |
| 42 TextDirection dir) override { | 42 TextDirection dir) override { |
| 43 MockSetToolTip(&frame, tooltip_text, dir); | 43 MockSetToolTip(&frame, tooltip_text, dir); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void ScheduleAnimation(const PlatformFrameView*) override { | 46 void ScheduleAnimation(const PlatformFrameView*) override { |
| 47 has_scheduled_animation_ = true; | 47 has_scheduled_animation_ = true; |
| 48 } | 48 } |
| 49 bool has_scheduled_animation_; | 49 bool has_scheduled_animation_; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 typedef bool TestParamRootLayerScrolling; | 52 typedef bool TestParamRootLayerScrolling; |
| 53 class LocalFrameViewTest | 53 class LocalFrameViewTest |
| 54 : public testing::WithParamInterface<TestParamRootLayerScrolling>, | 54 : public ::testing::WithParamInterface<TestParamRootLayerScrolling>, |
| 55 private ScopedRootLayerScrollingForTest, | 55 private ScopedRootLayerScrollingForTest, |
| 56 public testing::Test { | 56 public ::testing::Test { |
| 57 protected: | 57 protected: |
| 58 LocalFrameViewTest() | 58 LocalFrameViewTest() |
| 59 : ScopedRootLayerScrollingForTest(GetParam()), | 59 : ScopedRootLayerScrollingForTest(GetParam()), |
| 60 chrome_client_(new MockChromeClient) { | 60 chrome_client_(new MockChromeClient) { |
| 61 EXPECT_CALL(ChromeClient(), AttachRootGraphicsLayer(_, _)) | 61 EXPECT_CALL(ChromeClient(), AttachRootGraphicsLayer(_, _)) |
| 62 .Times(AnyNumber()); | 62 .Times(AnyNumber()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 ~LocalFrameViewTest() { | 65 ~LocalFrameViewTest() { |
| 66 testing::Mock::VerifyAndClearExpectations(&ChromeClient()); | 66 ::testing::Mock::VerifyAndClearExpectations(&ChromeClient()); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void SetUp() override { | 69 void SetUp() override { |
| 70 Page::PageClients clients; | 70 Page::PageClients clients; |
| 71 FillWithEmptyClients(clients); | 71 FillWithEmptyClients(clients); |
| 72 clients.chrome_client = chrome_client_.Get(); | 72 clients.chrome_client = chrome_client_.Get(); |
| 73 page_holder_ = DummyPageHolder::Create(IntSize(800, 600), &clients); | 73 page_holder_ = DummyPageHolder::Create(IntSize(800, 600), &clients); |
| 74 page_holder_->GetPage().GetSettings().SetAcceleratedCompositingEnabled( | 74 page_holder_->GetPage().GetSettings().SetAcceleratedCompositingEnabled( |
| 75 true); | 75 true); |
| 76 } | 76 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 GetDocument().getElementById("sticky2")->setAttribute(HTMLNames::styleAttr, | 229 GetDocument().getElementById("sticky2")->setAttribute(HTMLNames::styleAttr, |
| 230 ""); | 230 ""); |
| 231 GetDocument().View()->UpdateAllLifecyclePhases(); | 231 GetDocument().View()->UpdateAllLifecyclePhases(); |
| 232 | 232 |
| 233 EXPECT_FALSE( | 233 EXPECT_FALSE( |
| 234 GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky2)); | 234 GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky2)); |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace | 237 } // namespace |
| 238 } // namespace blink | 238 } // namespace blink |
| OLD | NEW |