Chromium Code Reviews| 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 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1802 // This test checks that deleting nodes which have only non-JS-registered touch | 1802 // This test checks that deleting nodes which have only non-JS-registered touch |
| 1803 // handlers also removes them from the event handler registry. Note that this | 1803 // handlers also removes them from the event handler registry. Note that this |
| 1804 // is different from detaching and re-attaching the same node, which is covered | 1804 // is different from detaching and re-attaching the same node, which is covered |
| 1805 // by layout tests under fast/events/. | 1805 // by layout tests under fast/events/. |
| 1806 TEST_F(WebViewTest, DeleteElementWithRegisteredHandler) | 1806 TEST_F(WebViewTest, DeleteElementWithRegisteredHandler) |
| 1807 { | 1807 { |
| 1808 std::string url = m_baseURL + "simple_div.html"; | 1808 std::string url = m_baseURL + "simple_div.html"; |
| 1809 URLTestHelpers::registerMockedURLLoad(toKURL(url), "simple_div.html"); | 1809 URLTestHelpers::registerMockedURLLoad(toKURL(url), "simple_div.html"); |
| 1810 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true); | 1810 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true); |
| 1811 | 1811 |
| 1812 WebCore::Document* document = webViewImpl->mainFrameImpl()->frame()->documen t(); | 1812 RefPtrWillBePersistent<WebCore::Document> document = webViewImpl->mainFrameI mpl()->frame()->document(); |
|
jochen (gone - plz use gerrit)
2014/07/17 14:17:24
why this change?
wibling-chromium
2014/07/17 14:18:51
Because I am doing a GC with no pointers on stack
| |
| 1813 WebCore::Element* div = document->getElementById("div"); | 1813 WebCore::Element* div = document->getElementById("div"); |
| 1814 WebCore::EventHandlerRegistry& registry = document->frameHost()->eventHandle rRegistry(); | 1814 WebCore::EventHandlerRegistry& registry = document->frameHost()->eventHandle rRegistry(); |
| 1815 | 1815 |
| 1816 registry.didAddEventHandler(*div, WebCore::EventHandlerRegistry::ScrollEvent ); | 1816 registry.didAddEventHandler(*div, WebCore::EventHandlerRegistry::ScrollEvent ); |
| 1817 EXPECT_TRUE(registry.hasEventHandlers(WebCore::EventHandlerRegistry::ScrollE vent)); | 1817 EXPECT_TRUE(registry.hasEventHandlers(WebCore::EventHandlerRegistry::ScrollE vent)); |
| 1818 | 1818 |
| 1819 WebCore::TrackExceptionState exceptionState; | 1819 WebCore::TrackExceptionState exceptionState; |
| 1820 div->remove(exceptionState); | 1820 div->remove(exceptionState); |
| 1821 #if ENABLE(OILPAN) | |
| 1822 // For oilpan we have to force a GC to ensure the event handlers have been r emoved when | |
| 1823 // checking below. | |
| 1824 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | |
|
haraken
2014/07/17 14:32:28
We prefer using Heap::collectAllGarbage() in tests
wibling-chromium
2014/07/17 14:37:53
Done.
| |
| 1825 #endif | |
| 1821 EXPECT_FALSE(registry.hasEventHandlers(WebCore::EventHandlerRegistry::Scroll Event)); | 1826 EXPECT_FALSE(registry.hasEventHandlers(WebCore::EventHandlerRegistry::Scroll Event)); |
| 1822 } | 1827 } |
| 1823 | 1828 |
| 1824 static WebRect ExpectedRootBounds(WebCore::Document* document, float scaleFactor ) | 1829 static WebRect ExpectedRootBounds(WebCore::Document* document, float scaleFactor ) |
| 1825 { | 1830 { |
| 1826 WebCore::Element* element = document->getElementById("root"); | 1831 WebCore::Element* element = document->getElementById("root"); |
| 1827 if (!element) | 1832 if (!element) |
| 1828 element = document->getElementById("target"); | 1833 element = document->getElementById("target"); |
| 1829 if (element->hasTagName(WebCore::HTMLNames::iframeTag)) | 1834 if (element->hasTagName(WebCore::HTMLNames::iframeTag)) |
| 1830 return ExpectedRootBounds(toHTMLIFrameElement(element)->contentDocument( ), scaleFactor); | 1835 return ExpectedRootBounds(toHTMLIFrameElement(element)->contentDocument( ), scaleFactor); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2099 | 2104 |
| 2100 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); | 2105 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); |
| 2101 | 2106 |
| 2102 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target"))); | 2107 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target"))); |
| 2103 | 2108 |
| 2104 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); | 2109 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); |
| 2105 webView->setAutofillClient(0); | 2110 webView->setAutofillClient(0); |
| 2106 } | 2111 } |
| 2107 | 2112 |
| 2108 } // namespace | 2113 } // namespace |
| OLD | NEW |