OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 { | 351 { |
352 std::string url = m_baseURL + "specify_size.html?" + "50px" + ":" + "50px"; | 352 std::string url = m_baseURL + "specify_size.html?" + "50px" + ":" + "50px"; |
353 URLTestHelpers::registerMockedURLLoad(toKURL(url), "specify_size.html"); | 353 URLTestHelpers::registerMockedURLLoad(toKURL(url), "specify_size.html"); |
354 WebView* webView = m_webViewHelper.initializeAndLoad(url, true, 0); | 354 WebView* webView = m_webViewHelper.initializeAndLoad(url, true, 0); |
355 webView->resize(WebSize(100, 100)); | 355 webView->resize(WebSize(100, 100)); |
356 WebPoint hitPoint(75, 75); | 356 WebPoint hitPoint(75, 75); |
357 | 357 |
358 // Image is at top left quandrant, so should not hit it. | 358 // Image is at top left quandrant, so should not hit it. |
359 WebHitTestResult negativeResult = webView->hitTestResultAt(hitPoint); | 359 WebHitTestResult negativeResult = webView->hitTestResultAt(hitPoint); |
360 ASSERT_EQ(WebNode::ElementNode, negativeResult.node().nodeType()); | 360 ASSERT_EQ(WebNode::ElementNode, negativeResult.node().nodeType()); |
361 EXPECT_FALSE(negativeResult.node().to<WebElement>().hasHTMLTagName("img")); | 361 EXPECT_FALSE(negativeResult.node().to<WebElement>().hasTagName("img")); |
362 negativeResult.reset(); | 362 negativeResult.reset(); |
363 | 363 |
364 // Scale page up 2x so image should occupy the whole viewport. | 364 // Scale page up 2x so image should occupy the whole viewport. |
365 webView->setPageScaleFactor(2.0f); | 365 webView->setPageScaleFactor(2.0f); |
366 WebHitTestResult positiveResult = webView->hitTestResultAt(hitPoint); | 366 WebHitTestResult positiveResult = webView->hitTestResultAt(hitPoint); |
367 ASSERT_EQ(WebNode::ElementNode, positiveResult.node().nodeType()); | 367 ASSERT_EQ(WebNode::ElementNode, positiveResult.node().nodeType()); |
368 EXPECT_TRUE(positiveResult.node().to<WebElement>().hasHTMLTagName("img")); | 368 EXPECT_TRUE(positiveResult.node().to<WebElement>().hasTagName("img")); |
369 positiveResult.reset(); | 369 positiveResult.reset(); |
370 } | 370 } |
371 | 371 |
372 void WebViewTest::testAutoResize(const WebSize& minAutoResize, const WebSize& ma
xAutoResize, | 372 void WebViewTest::testAutoResize(const WebSize& minAutoResize, const WebSize& ma
xAutoResize, |
373 const std::string& pageWidth, const std::string
& pageHeight, | 373 const std::string& pageWidth, const std::string
& pageHeight, |
374 int expectedWidth, int expectedHeight, | 374 int expectedWidth, int expectedHeight, |
375 HorizontalScrollbarState expectedHorizontalStat
e, VerticalScrollbarState expectedVerticalState) | 375 HorizontalScrollbarState expectedHorizontalStat
e, VerticalScrollbarState expectedVerticalState) |
376 { | 376 { |
377 AutoResizeWebViewClient client; | 377 AutoResizeWebViewClient client; |
378 std::string url = m_baseURL + "specify_size.html?" + pageWidth + ":" + pageH
eight; | 378 std::string url = m_baseURL + "specify_size.html?" + pageWidth + ":" + pageH
eight; |
(...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2030 | 2030 |
2031 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); | 2031 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); |
2032 | 2032 |
2033 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr
omUTF8("target"))); | 2033 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr
omUTF8("target"))); |
2034 | 2034 |
2035 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); | 2035 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); |
2036 webView->setAutofillClient(0); | 2036 webView->setAutofillClient(0); |
2037 } | 2037 } |
2038 | 2038 |
2039 } // namespace | 2039 } // namespace |
OLD | NEW |