This source file includes following definitions.
- TEST
- TEST
#include "config.h"
#include "core/dom/Element.h"
#include "core/frame/FrameView.h"
#include "core/html/HTMLDocument.h"
#include "core/html/HTMLElement.h"
#include "core/testing/DummyPageHolder.h"
#include <gtest/gtest.h>
using namespace WebCore;
namespace {
TEST(DragUpdateTest, AffectedByDragUpdate)
{
OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
HTMLDocument* document = toHTMLDocument(&dummyPageHolder->document());
document->documentElement()->setInnerHTML("<style>div {width:100px;height:100px} div:-webkit-drag { background-color: green }</style>"
"<div>"
"<span></span>"
"<span></span>"
"<span></span>"
"<span></span>"
"</div>", ASSERT_NO_EXCEPTION);
document->view()->updateLayoutAndStyleIfNeededRecursive();
unsigned startCount = document->styleEngine()->resolverAccessCount();
document->documentElement()->renderer()->updateDragState(true);
document->view()->updateLayoutAndStyleIfNeededRecursive();
unsigned accessCount = document->styleEngine()->resolverAccessCount() - startCount;
ASSERT_EQ(1U, accessCount);
}
TEST(DragUpdateTest, ChildrenAffectedByDragUpdate)
{
OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
HTMLDocument* document = toHTMLDocument(&dummyPageHolder->document());
document->documentElement()->setInnerHTML("<style>div {width:100px;height:100px} div:-webkit-drag span { background-color: green }</style>"
"<div>"
"<span></span>"
"<span></span>"
"<span></span>"
"<span></span>"
"</div>", ASSERT_NO_EXCEPTION);
document->updateLayout();
unsigned startCount = document->styleEngine()->resolverAccessCount();
document->documentElement()->renderer()->updateDragState(true);
document->updateLayout();
unsigned accessCount = document->styleEngine()->resolverAccessCount() - startCount;
ASSERT_EQ(5U, accessCount);
}
}