Title: [127298] trunk/Tools
- Revision
- 127298
- Author
- [email protected]
- Date
- 2012-08-31 11:55:50 -0700 (Fri, 31 Aug 2012)
Log Message
[DRT] Make simulating a web click on a notification a queued task
https://bugs.webkit.org/show_bug.cgi?id=95546
<rdar://problem/12214170>
Reviewed by Alexey Proskuryakov.
Making the web click happen asynchronously better mimics user interaction with the platform.
* DumpRenderTree/TestRunner.h: Add a flag that determines whether we have a pending notification click.
(TestRunner::hasPendingWebNotificationClick): Exposed so that dump() can check that the flag is
not set.
* DumpRenderTree/mac/DumpRenderTree.mm:
(dump): Assert that the flag is not set.
* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::simulateWebNotificationClick): Set the flag, then add a task to click the
notification. In the case where the block gets executed after the flag has been unset, we avoid
performing the click.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (127297 => 127298)
--- trunk/Tools/ChangeLog 2012-08-31 18:51:39 UTC (rev 127297)
+++ trunk/Tools/ChangeLog 2012-08-31 18:55:50 UTC (rev 127298)
@@ -1,3 +1,23 @@
+2012-08-31 Jon Lee <[email protected]>
+
+ [DRT] Make simulating a web click on a notification a queued task
+ https://bugs.webkit.org/show_bug.cgi?id=95546
+ <rdar://problem/12214170>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Making the web click happen asynchronously better mimics user interaction with the platform.
+
+ * DumpRenderTree/TestRunner.h: Add a flag that determines whether we have a pending notification click.
+ (TestRunner::hasPendingWebNotificationClick): Exposed so that dump() can check that the flag is
+ not set.
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (dump): Assert that the flag is not set.
+ * DumpRenderTree/mac/TestRunnerMac.mm:
+ (TestRunner::simulateWebNotificationClick): Set the flag, then add a task to click the
+ notification. In the case where the block gets executed after the flag has been unset, we avoid
+ performing the click.
+
2012-08-31 Balazs Kelemen <[email protected]>
[Qt] ImageDiff output is not in the expected form if image dimensions differ
Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (127297 => 127298)
--- trunk/Tools/DumpRenderTree/TestRunner.cpp 2012-08-31 18:51:39 UTC (rev 127297)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp 2012-08-31 18:55:50 UTC (rev 127298)
@@ -94,6 +94,7 @@
, m_shouldStayOnPageAfterHandlingBeforeUnload(false)
, m_areLegacyWebNotificationPermissionRequestsIgnored(false)
, m_customFullScreenBehavior(false)
+ , m_hasPendingWebNotificationClick(false)
, m_testPathOrURL(testPathOrURL)
, m_expectedPixelHash(expectedPixelHash)
, m_titleTextDirection("ltr")
Modified: trunk/Tools/DumpRenderTree/TestRunner.h (127297 => 127298)
--- trunk/Tools/DumpRenderTree/TestRunner.h 2012-08-31 18:51:39 UTC (rev 127297)
+++ trunk/Tools/DumpRenderTree/TestRunner.h 2012-08-31 18:55:50 UTC (rev 127298)
@@ -368,6 +368,8 @@
void setStorageDatabaseIdleInterval(double);
+ bool hasPendingWebNotificationClick() const { return m_hasPendingWebNotificationClick; }
+
private:
TestRunner(const std::string& testPathOrURL, const std::string& expectedPixelHash);
@@ -423,6 +425,7 @@
// FIXME 81697: This variable most likely will be removed once we have migrated the tests from fast/notifications to http/tests/notifications.
bool m_areLegacyWebNotificationPermissionRequestsIgnored;
bool m_customFullScreenBehavior;
+ bool m_hasPendingWebNotificationClick;
std::string m_authenticationUsername;
std::string m_authenticationPassword;
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (127297 => 127298)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2012-08-31 18:51:39 UTC (rev 127297)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2012-08-31 18:55:50 UTC (rev 127298)
@@ -1139,6 +1139,7 @@
void dump()
{
invalidateAnyPreviousWaitToDumpWatchdog();
+ ASSERT(!gTestRunner->hasPendingWebNotificationClick());
if (dumpTree) {
NSString *resultString = nil;
Modified: trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm (127297 => 127298)
--- trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm 2012-08-31 18:51:39 UTC (rev 127297)
+++ trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm 2012-08-31 18:55:50 UTC (rev 127298)
@@ -1206,7 +1206,14 @@
void TestRunner::simulateWebNotificationClick(JSValueRef jsNotification)
{
uint64_t notificationID = [[mainFrame webView] _notificationIDForTesting:jsNotification];
- [[MockWebNotificationProvider shared] simulateWebNotificationClick:notificationID];
+ m_hasPendingWebNotificationClick = true;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (!m_hasPendingWebNotificationClick)
+ return;
+
+ [[MockWebNotificationProvider shared] simulateWebNotificationClick:notificationID];
+ m_hasPendingWebNotificationClick = false;
+ });
}
void TestRunner::simulateLegacyWebNotificationClick(JSStringRef jsTitle)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes