| 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/FrameView.h" | 5 #include "core/frame/FrameView.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/html/HTMLElement.h" | 9 #include "core/html/HTMLElement.h" |
| 10 #include "core/layout/LayoutObject.h" | 10 #include "core/layout/LayoutObject.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 MOCK_METHOD1(didPaint, void(const PaintArtifact&)); | 42 MOCK_METHOD1(didPaint, void(const PaintArtifact&)); |
| 43 MOCK_METHOD2(attachRootGraphicsLayer, void(GraphicsLayer*, LocalFrame* local
Root)); | 43 MOCK_METHOD2(attachRootGraphicsLayer, void(GraphicsLayer*, LocalFrame* local
Root)); |
| 44 | 44 |
| 45 void scheduleAnimation(Widget*) override { m_hasScheduledAnimation = true; } | 45 void scheduleAnimation(Widget*) override { m_hasScheduledAnimation = true; } |
| 46 bool m_hasScheduledAnimation; | 46 bool m_hasScheduledAnimation; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 class FrameViewTestBase : public testing::Test { | 49 class FrameViewTestBase : public testing::Test { |
| 50 protected: | 50 protected: |
| 51 FrameViewTestBase() | 51 FrameViewTestBase() |
| 52 : m_chromeClient(adoptPtrWillBeNoop(new MockChromeClient)) | 52 : m_chromeClient((new MockChromeClient)) |
| 53 { } | 53 { } |
| 54 | 54 |
| 55 void SetUp() override | 55 void SetUp() override |
| 56 { | 56 { |
| 57 Page::PageClients clients; | 57 Page::PageClients clients; |
| 58 fillWithEmptyClients(clients); | 58 fillWithEmptyClients(clients); |
| 59 clients.chromeClient = m_chromeClient.get(); | 59 clients.chromeClient = m_chromeClient.get(); |
| 60 m_pageHolder = DummyPageHolder::create(IntSize(800, 600), &clients); | 60 m_pageHolder = DummyPageHolder::create(IntSize(800, 600), &clients); |
| 61 m_pageHolder->page().settings().setAcceleratedCompositingEnabled(true); | 61 m_pageHolder->page().settings().setAcceleratedCompositingEnabled(true); |
| 62 } | 62 } |
| 63 | 63 |
| 64 Document& document() { return m_pageHolder->document(); } | 64 Document& document() { return m_pageHolder->document(); } |
| 65 MockChromeClient& chromeClient() { return *m_chromeClient; } | 65 MockChromeClient& chromeClient() { return *m_chromeClient; } |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 OwnPtrWillBePersistent<MockChromeClient> m_chromeClient; | 68 Persistent<MockChromeClient> m_chromeClient; |
| 69 OwnPtr<DummyPageHolder> m_pageHolder; | 69 OwnPtr<DummyPageHolder> m_pageHolder; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 class FrameViewTest : public FrameViewTestBase { | 72 class FrameViewTest : public FrameViewTestBase { |
| 73 protected: | 73 protected: |
| 74 FrameViewTest() | 74 FrameViewTest() |
| 75 { | 75 { |
| 76 EXPECT_CALL(chromeClient(), attachRootGraphicsLayer(_, _)).Times(AnyNumb
er()); | 76 EXPECT_CALL(chromeClient(), attachRootGraphicsLayer(_, _)).Times(AnyNumb
er()); |
| 77 } | 77 } |
| 78 }; | 78 }; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 chromeClient().m_hasScheduledAnimation = false; | 139 chromeClient().m_hasScheduledAnimation = false; |
| 140 document().getElementById("a")->layoutObject()->setShouldDoFullPaintInvalida
tion(); | 140 document().getElementById("a")->layoutObject()->setShouldDoFullPaintInvalida
tion(); |
| 141 EXPECT_TRUE(chromeClient().m_hasScheduledAnimation); | 141 EXPECT_TRUE(chromeClient().m_hasScheduledAnimation); |
| 142 chromeClient().m_hasScheduledAnimation = false; | 142 chromeClient().m_hasScheduledAnimation = false; |
| 143 document().view()->updateAllLifecyclePhases(); | 143 document().view()->updateAllLifecyclePhases(); |
| 144 EXPECT_FALSE(chromeClient().m_hasScheduledAnimation); | 144 EXPECT_FALSE(chromeClient().m_hasScheduledAnimation); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace | 147 } // namespace |
| 148 } // namespace blink | 148 } // namespace blink |
| OLD | NEW |