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

Unified Diff: third_party/WebKit/Source/core/dom/StaticRangeTest.cpp

Issue 2726593002: Use mayNotBeMainThread() for wrapper optimization (Closed)
Patch Set: Renaming + move decrement to destructor 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/StaticRangeTest.cpp
diff --git a/third_party/WebKit/Source/core/dom/StaticRangeTest.cpp b/third_party/WebKit/Source/core/dom/StaticRangeTest.cpp
index 885cfe740028076a18a68596ff0431dfd37c8ec0..c9c9a189cc27a588f13b8784a34314e87af6bc95 100644
--- a/third_party/WebKit/Source/core/dom/StaticRangeTest.cpp
+++ b/third_party/WebKit/Source/core/dom/StaticRangeTest.cpp
@@ -9,6 +9,7 @@
#include "core/dom/NodeList.h"
#include "core/dom/Range.h"
#include "core/dom/Text.h"
+#include "core/editing/EditingTestBase.h"
#include "core/html/HTMLBodyElement.h"
#include "core/html/HTMLDocument.h"
#include "core/html/HTMLElement.h"
@@ -21,28 +22,12 @@
namespace blink {
-class StaticRangeTest : public testing::Test {
- protected:
- void SetUp() override;
-
- HTMLDocument& document() const;
-
- private:
- Persistent<HTMLDocument> m_document;
-};
-
-void StaticRangeTest::SetUp() {
- m_document = HTMLDocument::create();
- HTMLHtmlElement* html = HTMLHtmlElement::create(*m_document);
- html->appendChild(HTMLBodyElement::create(*m_document));
- m_document->appendChild(html);
-}
-
-HTMLDocument& StaticRangeTest::document() const {
- return *m_document;
-}
+class StaticRangeTest : public EditingTestBase {};
TEST_F(StaticRangeTest, SplitTextNodeRangeWithinText) {
+ ScriptState* scriptState = ScriptState::forMainWorld(document().frame());
+ ScriptState::Scope scope(scriptState);
+
document().body()->setInnerHTML("1234");
Text* oldText = toText(document().body()->firstChild());
@@ -113,6 +98,9 @@ TEST_F(StaticRangeTest, SplitTextNodeRangeWithinText) {
}
TEST_F(StaticRangeTest, SplitTextNodeRangeOutsideText) {
+ ScriptState* scriptState = ScriptState::forMainWorld(document().frame());
+ ScriptState::Scope scope(scriptState);
+
document().body()->setInnerHTML(
"<span id=\"outer\">0<span id=\"inner-left\">1</span>SPLITME<span "
"id=\"inner-right\">2</span>3</span>");
@@ -223,6 +211,9 @@ TEST_F(StaticRangeTest, SplitTextNodeRangeOutsideText) {
}
TEST_F(StaticRangeTest, InvalidToRange) {
+ ScriptState* scriptState = ScriptState::forMainWorld(document().frame());
+ ScriptState::Scope scope(scriptState);
+
document().body()->setInnerHTML("1234");
Text* oldText = toText(document().body()->firstChild());

Powered by Google App Engine
This is Rietveld 408576698