コード例 #1
0
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());
}
コード例 #2
0
TEST_F(WebNodeTest, QuerySelectorError)
{
    setInnerHTML("<div></div>");
    WebExceptionCode ec;
    WebElement element = root().querySelector("@invalid-selector", ec);
    EXPECT_NE(0, ec);
    EXPECT_TRUE(element.isNull());
}
コード例 #3
0
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();
}
コード例 #4
0
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"));
}
コード例 #5
0
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();
}
コード例 #6
0
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);
}
コード例 #7
0
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);
}
コード例 #8
0
void WebLocalFrameImpl::requestTextChecking(const WebElement& webElement)
{
    if (webElement.isNull())
        return;
    frame()->spellChecker().requestTextChecking(*webElement.constUnwrap<Element>());
}