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

Unified Diff: third_party/WebKit/Source/web/tests/WebViewTest.cpp

Issue 1365203002: Make WebNode::to<Type>() (and toConst) casts contain type asserts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add BLINK_IMPLEMENTATION guard. Created 5 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebFrameTest.cpp ('k') | third_party/WebKit/public/web/WebDocument.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/WebViewTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
index 0a2d6b27648d487a52cf8a0e7a78fadce4e44bc1..6ffabd3e03e743d476b51771d7b2f70bf6dd500a 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -598,14 +598,12 @@ TEST_F(WebViewTest, HitTestResultAtWithPageScale)
// Image is at top left quandrant, so should not hit it.
WebHitTestResult negativeResult = webView->hitTestResultAt(hitPoint);
- ASSERT_EQ(WebNode::ElementNode, negativeResult.node().nodeType());
EXPECT_FALSE(negativeResult.node().to<WebElement>().hasHTMLTagName("img"));
negativeResult.reset();
// Scale page up 2x so image should occupy the whole viewport.
webView->setPageScaleFactor(2.0f);
WebHitTestResult positiveResult = webView->hitTestResultAt(hitPoint);
- ASSERT_EQ(WebNode::ElementNode, positiveResult.node().nodeType());
EXPECT_TRUE(positiveResult.node().to<WebElement>().hasHTMLTagName("img"));
positiveResult.reset();
}
@@ -621,21 +619,18 @@ TEST_F(WebViewTest, HitTestResultAtWithPageScaleAndPan)
// Image is at top left quandrant, so should not hit it.
WebHitTestResult negativeResult = webView->hitTestResultAt(hitPoint);
- ASSERT_EQ(WebNode::ElementNode, negativeResult.node().nodeType());
EXPECT_FALSE(negativeResult.node().to<WebElement>().hasHTMLTagName("img"));
negativeResult.reset();
// Scale page up 2x so image should occupy the whole viewport.
webView->setPageScaleFactor(2.0f);
WebHitTestResult positiveResult = webView->hitTestResultAt(hitPoint);
- ASSERT_EQ(WebNode::ElementNode, positiveResult.node().nodeType());
EXPECT_TRUE(positiveResult.node().to<WebElement>().hasHTMLTagName("img"));
positiveResult.reset();
// Pan around the zoomed in page so the image is not visible in viewport.
webView->setVisualViewportOffset(WebFloatPoint(100, 100));
WebHitTestResult negativeResult2 = webView->hitTestResultAt(hitPoint);
- ASSERT_EQ(WebNode::ElementNode, negativeResult2.node().nodeType());
EXPECT_FALSE(negativeResult2.node().to<WebElement>().hasHTMLTagName("img"));
negativeResult2.reset();
}
@@ -650,21 +645,18 @@ TEST_F(WebViewTest, HitTestResultForTapWithTapArea)
// Image is at top left quandrant, so should not hit it.
WebHitTestResult negativeResult = webView->hitTestResultAt(hitPoint);
- ASSERT_EQ(WebNode::ElementNode, negativeResult.node().nodeType());
EXPECT_FALSE(negativeResult.node().to<WebElement>().hasHTMLTagName("img"));
negativeResult.reset();
// The tap area is 20 by 20 square, centered at 55, 55.
WebSize tapArea(20, 20);
WebHitTestResult positiveResult = webView->hitTestResultForTap(hitPoint, tapArea);
- ASSERT_EQ(WebNode::ElementNode, positiveResult.node().nodeType());
EXPECT_TRUE(positiveResult.node().to<WebElement>().hasHTMLTagName("img"));
positiveResult.reset();
// Move the hit point the image is just outside the tapped area now.
hitPoint = WebPoint(61, 61);
WebHitTestResult negativeResult2 = webView->hitTestResultForTap(hitPoint, tapArea);
- ASSERT_EQ(WebNode::ElementNode, negativeResult2.node().nodeType());
EXPECT_FALSE(negativeResult2.node().to<WebElement>().hasHTMLTagName("img"));
negativeResult2.reset();
}
@@ -680,14 +672,12 @@ TEST_F(WebViewTest, HitTestResultForTapWithTapAreaPageScaleAndPan)
// Image is at top left quandrant, so should not hit it.
WebHitTestResult negativeResult = webView->hitTestResultAt(hitPoint);
- ASSERT_EQ(WebNode::ElementNode, negativeResult.node().nodeType());
EXPECT_FALSE(negativeResult.node().to<WebElement>().hasHTMLTagName("img"));
negativeResult.reset();
// The tap area is 20 by 20 square, centered at 55, 55.
WebSize tapArea(20, 20);
WebHitTestResult positiveResult = webView->hitTestResultForTap(hitPoint, tapArea);
- ASSERT_EQ(WebNode::ElementNode, positiveResult.node().nodeType());
EXPECT_TRUE(positiveResult.node().to<WebElement>().hasHTMLTagName("img"));
positiveResult.reset();
@@ -695,7 +685,6 @@ TEST_F(WebViewTest, HitTestResultForTapWithTapAreaPageScaleAndPan)
webView->setPageScaleFactor(2.0f);
webView->setVisualViewportOffset(WebFloatPoint(100, 100));
WebHitTestResult negativeResult2 = webView->hitTestResultForTap(hitPoint, tapArea);
- ASSERT_EQ(WebNode::ElementNode, negativeResult2.node().nodeType());
EXPECT_FALSE(negativeResult2.node().to<WebElement>().hasHTMLTagName("img"));
negativeResult2.reset();
}
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebFrameTest.cpp ('k') | third_party/WebKit/public/web/WebDocument.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698