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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/ElementVisibilityObserverTest.cpp
diff --git a/third_party/WebKit/Source/core/dom/ElementVisibilityObserverTest.cpp b/third_party/WebKit/Source/core/dom/ElementVisibilityObserverTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..26452595b29e8760b338983cb4f04d4bb9e57a37
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/ElementVisibilityObserverTest.cpp
@@ -0,0 +1,40 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/dom/ElementVisibilityObserver.h"
+
+#include "core/dom/DOMImplementation.h"
+#include "core/dom/Document.h"
+#include "core/html/HTMLDivElement.h"
+#include "core/html/HTMLDocument.h"
+#include "core/testing/DummyPageHolder.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+
+namespace {
+
+class ElementVisibilityObserverTest : public ::testing::Test {
+ protected:
+ void SetUp() override { m_dummyPageHolder = DummyPageHolder::create(); }
+
+ Document& document() { return m_dummyPageHolder->document(); }
+
+ private:
+ std::unique_ptr<DummyPageHolder> m_dummyPageHolder;
+};
+
+TEST_F(ElementVisibilityObserverTest, ObserveElementWithoutDocumentFrame) {
+ HTMLElement* element = HTMLDivElement::create(
+ *DOMImplementation::create(document())->createHTMLDocument("test"));
+ ElementVisibilityObserver* observer =
+ new ElementVisibilityObserver(element, nullptr);
+ observer->start();
+ observer->stop();
+ // It should not crash.
+}
+
+} // anonymous namespace
+
+} // blink namespace
« 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