Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: third_party/WebKit/Source/core/dom/ElementVisibilityObserverTest.cpp

Issue 2721503002: Rename all uses of EmptyFrameLoaderClient with EmptyLocalFrameClient. (Closed)
Patch Set: Change V8 headers to user includes and introduce a space between system and user headers. Headers w… Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 FrameLoaderClient 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 StubFrameLoaderClient final : public EmptyFrameLoaderClient { 24 class StubFrameLoaderClient 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
31 DEFINE_INLINE_VIRTUAL_TRACE() { 31 DEFINE_INLINE_VIRTUAL_TRACE() {
32 visitor->trace(m_parent); 32 visitor->trace(m_parent);
33 EmptyFrameLoaderClient::trace(visitor); 33 EmptyLocalFrameClient::trace(visitor);
34 } 34 }
35 35
36 private: 36 private:
37 WeakMember<Frame> m_parent = nullptr; 37 WeakMember<Frame> m_parent = nullptr;
38 }; 38 };
39 39
40 class ElementVisibilityObserverTest : public ::testing::Test { 40 class ElementVisibilityObserverTest : public ::testing::Test {
41 protected: 41 protected:
42 void SetUp() override { 42 void SetUp() override {
43 m_frameLoaderClient = new StubFrameLoaderClient(); 43 m_frameLoaderClient = new StubFrameLoaderClient();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 new ElementVisibilityObserver(element, WTF::bind([](bool) {})); 80 new ElementVisibilityObserver(element, WTF::bind([](bool) {}));
81 observer->start(); 81 observer->start();
82 observer->deliverObservationsForTesting(); 82 observer->deliverObservationsForTesting();
83 observer->stop(); 83 observer->stop();
84 // It should not crash. 84 // It should not crash.
85 } 85 }
86 86
87 } // anonymous namespace 87 } // anonymous namespace
88 88
89 } // blink namespace 89 } // blink namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698