| 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 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1690 // only becomes available after the load begins. | 1690 // only becomes available after the load begins. |
| 1691 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::creat
eWebViewAndLoad(m_baseURL + "disambiguation_popup_no_container.html", true, 0, &
client)); | 1691 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::creat
eWebViewAndLoad(m_baseURL + "disambiguation_popup_no_container.html", true, 0, &
client)); |
| 1692 webViewImpl->resize(WebSize(1000, 1000)); | 1692 webViewImpl->resize(WebSize(1000, 1000)); |
| 1693 webViewImpl->layout(); | 1693 webViewImpl->layout(); |
| 1694 | 1694 |
| 1695 client.resetTriggered(); | 1695 client.resetTriggered(); |
| 1696 webViewImpl->handleInputEvent(fatTap(50, 50)); | 1696 webViewImpl->handleInputEvent(fatTap(50, 50)); |
| 1697 EXPECT_FALSE(client.triggered()); | 1697 EXPECT_FALSE(client.triggered()); |
| 1698 } | 1698 } |
| 1699 | 1699 |
| 1700 TEST_F(WebFrameTest, DisambiguationPopupMobileSite) |
| 1701 { |
| 1702 registerMockedHttpURLLoad("disambiguation_popup_mobile_site.html"); |
| 1703 |
| 1704 DisambiguationPopupTestWebViewClient client; |
| 1705 |
| 1706 // Make sure we initialize to minimum scale, even if the window size |
| 1707 // only becomes available after the load begins. |
| 1708 WebViewImpl* webViewImpl = static_cast<WebViewImpl*>(FrameTestHelpers::creat
eWebViewAndLoad(m_baseURL + "disambiguation_popup.html", true, 0, &client)); |
| 1709 webViewImpl->resize(WebSize(1000, 1000)); |
| 1710 webViewImpl->layout(); |
| 1711 |
| 1712 client.resetTriggered(); |
| 1713 webViewImpl->handleInputEvent(fatTap(0, 0)); |
| 1714 EXPECT_FALSE(client.triggered()); |
| 1715 |
| 1716 client.resetTriggered(); |
| 1717 webViewImpl->handleInputEvent(fatTap(200, 115)); |
| 1718 EXPECT_FALSE(client.triggered()); |
| 1719 |
| 1720 for (int i = 0; i <= 46; i++) { |
| 1721 client.resetTriggered(); |
| 1722 webViewImpl->handleInputEvent(fatTap(120, 230 + i * 5)); |
| 1723 EXPECT_FALSE(client.triggered()); |
| 1724 } |
| 1725 |
| 1726 for (int i = 0; i <= 46; i++) { |
| 1727 client.resetTriggered(); |
| 1728 webViewImpl->handleInputEvent(fatTap(10 + i * 5, 590)); |
| 1729 EXPECT_FALSE(client.triggered()); |
| 1730 } |
| 1731 } |
| 1732 |
| 1700 class TestSubstituteDataWebFrameClient : public WebFrameClient { | 1733 class TestSubstituteDataWebFrameClient : public WebFrameClient { |
| 1701 public: | 1734 public: |
| 1702 TestSubstituteDataWebFrameClient() | 1735 TestSubstituteDataWebFrameClient() |
| 1703 : m_commitCalled(false) | 1736 : m_commitCalled(false) |
| 1704 { | 1737 { |
| 1705 } | 1738 } |
| 1706 | 1739 |
| 1707 virtual void didFailProvisionalLoad(WebFrame* frame, const WebURLError& erro
r) | 1740 virtual void didFailProvisionalLoad(WebFrame* frame, const WebURLError& erro
r) |
| 1708 { | 1741 { |
| 1709 frame->loadHTMLString("This should appear", toKURL("data:text/html,chrom
ewebdata"), error.unreachableURL, true); | 1742 frame->loadHTMLString("This should appear", toKURL("data:text/html,chrom
ewebdata"), error.unreachableURL, true); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1750 webkit_support::RegisterMockedErrorURL(URLTestHelpers::toKURL(errorURL), res
ponse, error); | 1783 webkit_support::RegisterMockedErrorURL(URLTestHelpers::toKURL(errorURL), res
ponse, error); |
| 1751 frame->loadHistoryItem(errorHistoryItem); | 1784 frame->loadHistoryItem(errorHistoryItem); |
| 1752 webkit_support::ServeAsynchronousMockedRequests(); | 1785 webkit_support::ServeAsynchronousMockedRequests(); |
| 1753 | 1786 |
| 1754 WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); | 1787 WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); |
| 1755 EXPECT_EQ("This should appear", std::string(text.utf8().data())); | 1788 EXPECT_EQ("This should appear", std::string(text.utf8().data())); |
| 1756 EXPECT_TRUE(webFrameClient.commitCalled()); | 1789 EXPECT_TRUE(webFrameClient.commitCalled()); |
| 1757 } | 1790 } |
| 1758 | 1791 |
| 1759 } // namespace | 1792 } // namespace |
| OLD | NEW |