| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/dom/IntersectionObserver.h" | 5 #include "core/dom/IntersectionObserver.h" |
| 6 | 6 |
| 7 #include "core/dom/IntersectionObserverCallback.h" | 7 #include "core/dom/IntersectionObserverCallback.h" |
| 8 #include "core/dom/IntersectionObserverInit.h" | 8 #include "core/dom/IntersectionObserverInit.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "platform/testing/UnitTestHelpers.h" | 10 #include "platform/testing/UnitTestHelpers.h" |
| 11 #include "platform/wtf/CurrentTime.h" |
| 11 #include "web/WebViewImpl.h" | 12 #include "web/WebViewImpl.h" |
| 12 #include "web/tests/sim/SimCompositor.h" | 13 #include "web/tests/sim/SimCompositor.h" |
| 13 #include "web/tests/sim/SimDisplayItemList.h" | 14 #include "web/tests/sim/SimDisplayItemList.h" |
| 14 #include "web/tests/sim/SimRequest.h" | 15 #include "web/tests/sim/SimRequest.h" |
| 15 #include "web/tests/sim/SimTest.h" | 16 #include "web/tests/sim/SimTest.h" |
| 16 #include "wtf/CurrentTime.h" | |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 class TestIntersectionObserverCallback : public IntersectionObserverCallback { | 22 class TestIntersectionObserverCallback : public IntersectionObserverCallback { |
| 23 public: | 23 public: |
| 24 TestIntersectionObserverCallback(Document& document) | 24 TestIntersectionObserverCallback(Document& document) |
| 25 : m_document(document), m_callCount(0) {} | 25 : m_document(document), m_callCount(0) {} |
| 26 void handleEvent(const HeapVector<Member<IntersectionObserverEntry>>&, | 26 void handleEvent(const HeapVector<Member<IntersectionObserverEntry>>&, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // those notifications should be discarded. | 156 // those notifications should be discarded. |
| 157 document().view()->layoutViewportScrollableArea()->setScrollOffset( | 157 document().view()->layoutViewportScrollableArea()->setScrollOffset( |
| 158 ScrollOffset(0, 300), ProgrammaticScroll); | 158 ScrollOffset(0, 300), ProgrammaticScroll); |
| 159 compositor().beginFrame(); | 159 compositor().beginFrame(); |
| 160 observer->disconnect(); | 160 observer->disconnect(); |
| 161 testing::runPendingTasks(); | 161 testing::runPendingTasks(); |
| 162 EXPECT_EQ(observerCallback->callCount(), 1); | 162 EXPECT_EQ(observerCallback->callCount(), 1); |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace blink | 165 } // namespace blink |
| OLD | NEW |