| 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 "platform/testing/UnitTestHelpers.h" | 9 #include "platform/testing/UnitTestHelpers.h" |
| 10 #include "web/WebViewImpl.h" | 10 #include "web/WebViewImpl.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 mainResource.complete("<div id='target'></div>"); | 46 mainResource.complete("<div id='target'></div>"); |
| 47 | 47 |
| 48 IntersectionObserverInit observerInit; | 48 IntersectionObserverInit observerInit; |
| 49 TrackExceptionState exceptionState; | 49 TrackExceptionState exceptionState; |
| 50 TestIntersectionObserverCallback* observerCallback = new TestIntersectionObs
erverCallback(document()); | 50 TestIntersectionObserverCallback* observerCallback = new TestIntersectionObs
erverCallback(document()); |
| 51 IntersectionObserver* observer = IntersectionObserver::create(observerInit,
*observerCallback, exceptionState); | 51 IntersectionObserver* observer = IntersectionObserver::create(observerInit,
*observerCallback, exceptionState); |
| 52 ASSERT_FALSE(exceptionState.hadException()); | 52 ASSERT_FALSE(exceptionState.hadException()); |
| 53 | 53 |
| 54 compositor().beginFrame(); | 54 compositor().beginFrame(); |
| 55 ASSERT_FALSE(compositor().needsAnimate()); | 55 ASSERT_FALSE(compositor().needsAnimate()); |
| 56 EXPECT_TRUE(observer->takeRecords().isEmpty()); | 56 EXPECT_TRUE(observer->takeRecords(exceptionState).isEmpty()); |
| 57 EXPECT_EQ(observerCallback->callCount(), 0); | 57 EXPECT_EQ(observerCallback->callCount(), 0); |
| 58 | 58 |
| 59 Element* target = document().getElementById("target"); | 59 Element* target = document().getElementById("target"); |
| 60 ASSERT_TRUE(target); | 60 ASSERT_TRUE(target); |
| 61 observer->observe(target); | 61 observer->observe(target, exceptionState); |
| 62 EXPECT_TRUE(compositor().needsAnimate()); | 62 EXPECT_TRUE(compositor().needsAnimate()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace blink | 65 } // namespace blink |
| OLD | NEW |