TEST_F(WebNodeTest, QuerySelectorDoesNotMatch) { setInnerHTML("<div id=x><span class=a></span></div>"); WebExceptionCode ec; WebElement element = root().querySelector("section", ec); EXPECT_EQ(0, ec); EXPECT_TRUE(element.isNull()); }
TEST_F(WebNodeTest, QuerySelectorError) { setInnerHTML("<div></div>"); WebExceptionCode ec; WebElement element = root().querySelector("@invalid-selector", ec); EXPECT_NE(0, ec); EXPECT_TRUE(element.isNull()); }
static string dumpDocumentText(WebFrame* frame) { // We use the document element's text instead of the body text here because // not all documents have a body, such as XML documents. WebElement documentElement = frame->document().documentElement(); if (documentElement.isNull()) return string(); return documentElement.innerText().utf8(); }
TEST_F(WebNodeTest, QuerySelectorMatches) { setInnerHTML("<div id=x><span class=a></span></div>"); WebExceptionCode ec; WebElement element = root().querySelector(".a", ec); EXPECT_EQ(0, ec); EXPECT_FALSE(element.isNull()); EXPECT_TRUE(element.hasHTMLTagName("span")); }
bool TestRunner::elementDoesAutoCompleteForElementWithId(const WebString& elementId) { WebFrame* webFrame = m_webView->mainFrame(); if (!webFrame) return false; WebElement element = webFrame->document().getElementById(elementId); if (element.isNull() || !element.hasTagName("input")) return false; WebInputElement inputElement = element.to<WebInputElement>(); return inputElement.autoComplete(); }
bool TestRunner::pauseTransitionAtTimeOnElementWithId(const WebString& propertyName, double time, const WebString& elementId) { WebFrame* webFrame = m_webView->mainFrame(); if (!webFrame) return false; WebAnimationController* controller = webFrame->animationController(); if (!controller) return false; WebElement element = webFrame->document().getElementById(elementId); if (element.isNull()) return false; return controller->pauseTransitionAtTime(element, propertyName, time); }
bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(const WebString& animationName, double time, const WebString& elementId) { WebFrame* webFrame = m_shell->webView()->mainFrame(); if (!webFrame) return false; WebAnimationController* controller = webFrame->animationController(); if (!controller) return false; WebElement element = webFrame->document().getElementById(elementId); if (element.isNull()) return false; return controller->pauseAnimationAtTime(element, animationName, time); }
void WebLocalFrameImpl::requestTextChecking(const WebElement& webElement) { if (webElement.isNull()) return; frame()->spellChecker().requestTextChecking(*webElement.constUnwrap<Element>()); }