OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 event.type = WebInputEvent::GestureTap; | 1631 event.type = WebInputEvent::GestureTap; |
1632 event.x = x; | 1632 event.x = x; |
1633 event.y = y; | 1633 event.y = y; |
1634 event.data.tap.width = 50; | 1634 event.data.tap.width = 50; |
1635 event.data.tap.height = 50; | 1635 event.data.tap.height = 50; |
1636 return event; | 1636 return event; |
1637 } | 1637 } |
1638 | 1638 |
1639 TEST_F(WebFrameTest, DisambiguationPopup) | 1639 TEST_F(WebFrameTest, DisambiguationPopup) |
1640 { | 1640 { |
1641 registerMockedHttpURLLoad("disambiguation_popup.html"); | 1641 const std::string htmlFile = "disambiguation_popup.html"; |
| 1642 registerMockedHttpURLLoad(htmlFile); |
1642 | 1643 |
1643 DisambiguationPopupTestWebViewClient client; | 1644 DisambiguationPopupTestWebViewClient client; |
1644 | 1645 |
1645 // Make sure we initialize to minimum scale, even if the window size | 1646 // Make sure we initialize to minimum scale, even if the window size |
1646 // only becomes available after the load begins. | 1647 // only becomes available after the load begins. |
1647 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::creat
eWebViewAndLoad(m_baseURL + "disambiguation_popup.html", true, 0, &client)); | 1648 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::creat
eWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client)); |
1648 webViewImpl->resize(WebSize(1000, 1000)); | 1649 webViewImpl->resize(WebSize(1000, 1000)); |
1649 webViewImpl->layout(); | 1650 webViewImpl->layout(); |
1650 | 1651 |
1651 client.resetTriggered(); | 1652 client.resetTriggered(); |
1652 webViewImpl->handleInputEvent(fatTap(0, 0)); | 1653 webViewImpl->handleInputEvent(fatTap(0, 0)); |
1653 EXPECT_FALSE(client.triggered()); | 1654 EXPECT_FALSE(client.triggered()); |
1654 | 1655 |
1655 client.resetTriggered(); | 1656 client.resetTriggered(); |
1656 webViewImpl->handleInputEvent(fatTap(200, 115)); | 1657 webViewImpl->handleInputEvent(fatTap(200, 115)); |
1657 EXPECT_FALSE(client.triggered()); | 1658 EXPECT_FALSE(client.triggered()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 webViewImpl->resize(WebSize(1000, 1000)); | 1693 webViewImpl->resize(WebSize(1000, 1000)); |
1693 webViewImpl->layout(); | 1694 webViewImpl->layout(); |
1694 | 1695 |
1695 client.resetTriggered(); | 1696 client.resetTriggered(); |
1696 webViewImpl->handleInputEvent(fatTap(50, 50)); | 1697 webViewImpl->handleInputEvent(fatTap(50, 50)); |
1697 EXPECT_FALSE(client.triggered()); | 1698 EXPECT_FALSE(client.triggered()); |
1698 } | 1699 } |
1699 | 1700 |
1700 TEST_F(WebFrameTest, DisambiguationPopupMobileSite) | 1701 TEST_F(WebFrameTest, DisambiguationPopupMobileSite) |
1701 { | 1702 { |
1702 registerMockedHttpURLLoad("disambiguation_popup_mobile_site.html"); | 1703 const std::string htmlFile = "disambiguation_popup_mobile_site.html"; |
| 1704 registerMockedHttpURLLoad(htmlFile); |
1703 | 1705 |
1704 DisambiguationPopupTestWebViewClient client; | 1706 DisambiguationPopupTestWebViewClient client; |
1705 | 1707 |
1706 // Make sure we initialize to minimum scale, even if the window size | 1708 // Make sure we initialize to minimum scale, even if the window size |
1707 // only becomes available after the load begins. | 1709 // only becomes available after the load begins. |
1708 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::creat
eWebViewAndLoad(m_baseURL + "disambiguation_popup.html", true, 0, &client)); | 1710 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::creat
eWebViewAndLoad(m_baseURL + htmlFile, true, 0, &client)); |
1709 webViewImpl->resize(WebSize(1000, 1000)); | 1711 webViewImpl->resize(WebSize(1000, 1000)); |
1710 webViewImpl->layout(); | 1712 webViewImpl->layout(); |
1711 | 1713 |
1712 client.resetTriggered(); | 1714 client.resetTriggered(); |
1713 webViewImpl->handleInputEvent(fatTap(0, 0)); | 1715 webViewImpl->handleInputEvent(fatTap(0, 0)); |
1714 EXPECT_FALSE(client.triggered()); | 1716 EXPECT_FALSE(client.triggered()); |
1715 | 1717 |
1716 client.resetTriggered(); | 1718 client.resetTriggered(); |
1717 webViewImpl->handleInputEvent(fatTap(200, 115)); | 1719 webViewImpl->handleInputEvent(fatTap(200, 115)); |
1718 EXPECT_FALSE(client.triggered()); | 1720 EXPECT_FALSE(client.triggered()); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1783 webkit_support::RegisterMockedErrorURL(URLTestHelpers::toKURL(errorURL), res
ponse, error); | 1785 webkit_support::RegisterMockedErrorURL(URLTestHelpers::toKURL(errorURL), res
ponse, error); |
1784 frame->loadHistoryItem(errorHistoryItem); | 1786 frame->loadHistoryItem(errorHistoryItem); |
1785 webkit_support::ServeAsynchronousMockedRequests(); | 1787 webkit_support::ServeAsynchronousMockedRequests(); |
1786 | 1788 |
1787 WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); | 1789 WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); |
1788 EXPECT_EQ("This should appear", std::string(text.utf8().data())); | 1790 EXPECT_EQ("This should appear", std::string(text.utf8().data())); |
1789 EXPECT_TRUE(webFrameClient.commitCalled()); | 1791 EXPECT_TRUE(webFrameClient.commitCalled()); |
1790 } | 1792 } |
1791 | 1793 |
1792 } // namespace | 1794 } // namespace |
OLD | NEW |