| 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/ElementVisibilityObserver.h" | 5 #include "core/dom/ElementVisibilityObserver.h" |
| 6 | 6 |
| 7 #include "core/dom/DOMImplementation.h" | 7 #include "core/dom/DOMImplementation.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/frame/RemoteFrame.h" | 9 #include "core/frame/RemoteFrame.h" |
| 10 #include "core/html/HTMLDivElement.h" | 10 #include "core/html/HTMLDivElement.h" |
| 11 #include "core/html/HTMLDocument.h" | 11 #include "core/html/HTMLDocument.h" |
| 12 #include "core/loader/EmptyClients.h" | 12 #include "core/loader/EmptyClients.h" |
| 13 #include "core/testing/DummyPageHolder.h" | 13 #include "core/testing/DummyPageHolder.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // Stub implementation of FrameLoaderClient for the purpose of testing. It will | 20 // Stub implementation of LocalFrameClient for the purpose of testing. It will |
| 21 // alow callers to set the parent/top frames by calling |setParent|. It is used | 21 // alow callers to set the parent/top frames by calling |setParent|. It is used |
| 22 // in ElementVisibilityObserverTest in order to mock a RemoteFrame parent of a | 22 // in ElementVisibilityObserverTest in order to mock a RemoteFrame parent of a |
| 23 // LocalFrame. | 23 // LocalFrame. |
| 24 class StubLocalFrameClient final : public EmptyLocalFrameClient { | 24 class StubLocalFrameClient final : public EmptyLocalFrameClient { |
| 25 public: | 25 public: |
| 26 Frame* parent() const override { return m_parent; } | 26 Frame* parent() const override { return m_parent; } |
| 27 Frame* top() const override { return m_parent; } | 27 Frame* top() const override { return m_parent; } |
| 28 | 28 |
| 29 void setParent(Frame* frame) { m_parent = frame; } | 29 void setParent(Frame* frame) { m_parent = frame; } |
| 30 | 30 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 new ElementVisibilityObserver(element, WTF::bind([](bool) {})); | 78 new ElementVisibilityObserver(element, WTF::bind([](bool) {})); |
| 79 observer->start(); | 79 observer->start(); |
| 80 observer->deliverObservationsForTesting(); | 80 observer->deliverObservationsForTesting(); |
| 81 observer->stop(); | 81 observer->stop(); |
| 82 // It should not crash. | 82 // It should not crash. |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // anonymous namespace | 85 } // anonymous namespace |
| 86 | 86 |
| 87 } // blink namespace | 87 } // blink namespace |
| OLD | NEW |