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

Side by Side Diff: Source/web/tests/WebViewTest.cpp

Issue 391373009: [oilpan]: Fix webkit unit tests for oilpan. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: use collectAllGarbage Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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();
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. We do a precise GC (collectAllGarbage does not scan the s tack)
1824 // to ensure the div element dies. This is also why the Document is in a Per sistent
1825 // since we want that to stay around.
1826 Heap::collectAllGarbage();
1827 #endif
1821 EXPECT_FALSE(registry.hasEventHandlers(WebCore::EventHandlerRegistry::Scroll Event)); 1828 EXPECT_FALSE(registry.hasEventHandlers(WebCore::EventHandlerRegistry::Scroll Event));
1822 } 1829 }
1823 1830
1824 static WebRect ExpectedRootBounds(WebCore::Document* document, float scaleFactor ) 1831 static WebRect ExpectedRootBounds(WebCore::Document* document, float scaleFactor )
1825 { 1832 {
1826 WebCore::Element* element = document->getElementById("root"); 1833 WebCore::Element* element = document->getElementById("root");
1827 if (!element) 1834 if (!element)
1828 element = document->getElementById("target"); 1835 element = document->getElementById("target");
1829 if (element->hasTagName(WebCore::HTMLNames::iframeTag)) 1836 if (element->hasTagName(WebCore::HTMLNames::iframeTag))
1830 return ExpectedRootBounds(toHTMLIFrameElement(element)->contentDocument( ), scaleFactor); 1837 return ExpectedRootBounds(toHTMLIFrameElement(element)->contentDocument( ), scaleFactor);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 2106
2100 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); 2107 EXPECT_EQ(0, client.getUserGestureNotificationsCount());
2101 2108
2102 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target"))); 2109 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target")));
2103 2110
2104 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); 2111 EXPECT_EQ(1, client.getUserGestureNotificationsCount());
2105 webView->setAutofillClient(0); 2112 webView->setAutofillClient(0);
2106 } 2113 }
2107 2114
2108 } // namespace 2115 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698