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

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

Issue 2401303002: ElementVisibilityObserver: use ExecutionContext's document. (Closed)
Patch Set: review comments Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "core/dom/ElementVisibilityObserver.h"
6
7 #include "core/dom/DOMImplementation.h"
8 #include "core/dom/Document.h"
9 #include "core/html/HTMLDivElement.h"
10 #include "core/html/HTMLDocument.h"
11 #include "core/testing/DummyPageHolder.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace blink {
15
16 namespace {
17
18 class ElementVisibilityObserverTest : public ::testing::Test {
19 protected:
20 void SetUp() override { m_dummyPageHolder = DummyPageHolder::create(); }
21
22 Document& document() { return m_dummyPageHolder->document(); }
23
24 private:
25 std::unique_ptr<DummyPageHolder> m_dummyPageHolder;
26 };
27
28 TEST_F(ElementVisibilityObserverTest, ObserveElementWithoutDocumentFrame) {
29 HTMLElement* element = HTMLDivElement::create(
30 *DOMImplementation::create(document())->createHTMLDocument("test"));
31 ElementVisibilityObserver* observer =
32 new ElementVisibilityObserver(element, nullptr);
33 observer->start();
34 observer->stop();
35 // It should not crash.
36 }
37
38 } // anonymous namespace
39
40 } // blink namespace
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698