Index: Source/web/tests/WebFrameTest.cpp |
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp |
index 2ea914dcf633bdbefd3dd7fec1a736ce30f1fb0a..ff438801444331748fe30d90bf0a69b5b1d37855 100644 |
--- a/Source/web/tests/WebFrameTest.cpp |
+++ b/Source/web/tests/WebFrameTest.cpp |
@@ -257,6 +257,13 @@ protected: |
return frame->nodeImage(*element); |
} |
+ void removeElementById(WebLocalFrameImpl* frame, const AtomicString& id) |
+ { |
+ Element* element = frame->frame()->document()->getElementById(id); |
+ ASSERT(element); |
+ element->remove(); |
+ } |
+ |
std::string m_baseURL; |
std::string m_notBaseURL; |
std::string m_chromeURL; |
@@ -3924,7 +3931,7 @@ TEST_P(ParameterizedWebFrameTest, FindOnDetachedFrame) |
RefPtrWillBeRawPtr<LocalFrame> holdSecondFrame(secondFrame->frame()); |
// Detach the frame before finding. |
- EXPECT_TRUE(mainFrame->document().getElementById("frame").remove()); |
+ removeElementById(mainFrame, "frame"); |
EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0)); |
EXPECT_FALSE(secondFrame->find(kFindIdentifier, searchText, options, false, 0)); |
@@ -3969,7 +3976,7 @@ TEST_P(ParameterizedWebFrameTest, FindDetachFrameBeforeScopeStrings) |
EXPECT_FALSE(client.findResultsAreReady()); |
// Detach the frame between finding and scoping. |
- EXPECT_TRUE(mainFrame->document().getElementById("frame").remove()); |
+ removeElementById(mainFrame, "frame"); |
mainFrame->resetMatchCount(); |
@@ -4013,7 +4020,7 @@ TEST_P(ParameterizedWebFrameTest, FindDetachFrameWhileScopingStrings) |
frame->scopeStringMatches(kFindIdentifier, searchText, options, true); |
// The first scopeStringMatches will have reset the state. Detach before it actually scopes. |
- EXPECT_TRUE(mainFrame->document().getElementById("frame").remove()); |
+ removeElementById(mainFrame, "frame"); |
runPendingTasks(); |
EXPECT_TRUE(client.findResultsAreReady()); |