<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[181249] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/181249">181249</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2015-03-08 16:55:10 -0700 (Sun, 08 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add some WorkQueue tests to TestWebKitAPI
https://bugs.webkit.org/show_bug.cgi?id=142447

Reviewed by Sam Weinig.

* TestWebKitAPI/TestWebKitAPI.vcxproj/TestWebKitAPI.vcxproj:
* TestWebKitAPI/TestWebKitAPI.vcxproj/TestWebKitAPI.vcxproj.filters:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/WorkQueue.cpp: Added.
(TestWebKitAPI::simpleTest):
(TestWebKitAPI::longTest):
(TestWebKitAPI::thirdTest):
(TestWebKitAPI::finishedTests):
(TestWebKitAPI::TEST):
(TestWebKitAPI::longTest2):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIvcxprojTestWebKitAPIvcxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.vcxproj/TestWebKitAPI.vcxproj</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIvcxprojTestWebKitAPIvcxprojfilters">trunk/Tools/TestWebKitAPI/TestWebKitAPI.vcxproj/TestWebKitAPI.vcxproj.filters</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWTFWorkQueuecpp">trunk/Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (181248 => 181249)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-03-08 23:47:25 UTC (rev 181248)
+++ trunk/Tools/ChangeLog        2015-03-08 23:55:10 UTC (rev 181249)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-03-08  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        Add some WorkQueue tests to TestWebKitAPI
+        https://bugs.webkit.org/show_bug.cgi?id=142447
+
+        Reviewed by Sam Weinig.
+
+        * TestWebKitAPI/TestWebKitAPI.vcxproj/TestWebKitAPI.vcxproj:
+        * TestWebKitAPI/TestWebKitAPI.vcxproj/TestWebKitAPI.vcxproj.filters:
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WTF/WorkQueue.cpp: Added.
+        (TestWebKitAPI::simpleTest):
+        (TestWebKitAPI::longTest):
+        (TestWebKitAPI::thirdTest):
+        (TestWebKitAPI::finishedTests):
+        (TestWebKitAPI::TEST):
+        (TestWebKitAPI::longTest2):
+
</ins><span class="cx"> 2015-03-08  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove willDestroyFrame in WKBundlePageLoaderClient
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIvcxprojTestWebKitAPIvcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.vcxproj/TestWebKitAPI.vcxproj (181248 => 181249)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.vcxproj/TestWebKitAPI.vcxproj        2015-03-08 23:47:25 UTC (rev 181248)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.vcxproj/TestWebKitAPI.vcxproj        2015-03-08 23:55:10 UTC (rev 181249)
</span><span class="lines">@@ -338,6 +338,7 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\Tests\WTF\TemporaryChange.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\Tests\WTF\Vector.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\Tests\WTF\WeakPtr.cpp&quot; /&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\Tests\WTF\WorkQueue.cpp&quot; /&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\Tests\WTF\WTFString.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\win\HostWindow.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\win\main.cpp&quot; /&gt;
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIvcxprojTestWebKitAPIvcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.vcxproj/TestWebKitAPI.vcxproj.filters (181248 => 181249)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.vcxproj/TestWebKitAPI.vcxproj.filters        2015-03-08 23:47:25 UTC (rev 181248)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.vcxproj/TestWebKitAPI.vcxproj.filters        2015-03-08 23:55:10 UTC (rev 181249)
</span><span class="lines">@@ -166,6 +166,9 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\Tests\JavaScriptCore\VMInspector.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;Tests\JavaScriptCore&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\Tests\WTF\WorkQueue.cpp&quot;&gt;
+      &lt;Filter&gt;Tests\WTF&lt;/Filter&gt;
+    &lt;/ClCompile&gt;
</ins><span class="cx">   &lt;/ItemGroup&gt;
</span><span class="cx">   &lt;ItemGroup&gt;
</span><span class="cx">     &lt;None Include=&quot;TestWebKitAPIPostBuild.cmd&quot; /&gt;
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (181248 => 181249)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2015-03-08 23:47:25 UTC (rev 181248)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2015-03-08 23:55:10 UTC (rev 181249)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx">                 7673499D1930C5BB00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7673499A1930182E00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp */; };
</span><span class="cx">                 76E182DD1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */; };
</span><span class="cx">                 76E182DF154767E600F1FADD /* auto-submitting-form.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 76E182DE15475A8300F1FADD /* auto-submitting-form.html */; };
</span><ins>+                7AA6A1521AAC0B31002B2ED3 /* WorkQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA6A1511AAC0B31002B2ED3 /* WorkQueue.cpp */; };
</ins><span class="cx">                 7C486BA11AA12567003F6F9B /* bundle-file.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 7C486BA01AA1254B003F6F9B /* bundle-file.html */; };
</span><span class="cx">                 7C54A4BE1AA11CCA00380F78 /* WKBundleFileHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C54A4BC1AA11CCA00380F78 /* WKBundleFileHandle.cpp */; };
</span><span class="cx">                 7C54A4C11AA11CE400380F78 /* WKBundleFileHandle_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C54A4BF1AA11CE400380F78 /* WKBundleFileHandle_Bundle.cpp */; };
</span><span class="lines">@@ -515,6 +516,7 @@
</span><span class="cx">                 76E182D91547550100F1FADD /* WillSendSubmitEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillSendSubmitEvent.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillSendSubmitEvent_Bundle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 76E182DE15475A8300F1FADD /* auto-submitting-form.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;auto-submitting-form.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                7AA6A1511AAC0B31002B2ED3 /* WorkQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueue.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7C486BA01AA1254B003F6F9B /* bundle-file.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = &quot;bundle-file.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C54A4BC1AA11CCA00380F78 /* WKBundleFileHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleFileHandle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C54A4BF1AA11CE400380F78 /* WKBundleFileHandle_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleFileHandle_Bundle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -1046,6 +1048,7 @@
</span><span class="cx">                                 BC55F5F814AD78EE00484BE1 /* Vector.cpp */,
</span><span class="cx">                                 265AF54F15D1E48A00B0CB4A /* WTFString.cpp */,
</span><span class="cx">                                 1CB9BC371A67482300FE5678 /* WeakPtr.cpp */,
</span><ins>+                                7AA6A1511AAC0B31002B2ED3 /* WorkQueue.cpp */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = WTF;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -1549,6 +1552,7 @@
</span><span class="cx">                         files = (
</span><span class="cx">                                 1CB9BC381A67482300FE5678 /* WeakPtr.cpp in Sources */,
</span><span class="cx">                                 2E7765CD16C4D80A00BA2BB1 /* mainIOS.mm in Sources */,
</span><ins>+                                7AA6A1521AAC0B31002B2ED3 /* WorkQueue.cpp in Sources */,
</ins><span class="cx">                                 2E7765CF16C4D81100BA2BB1 /* mainMac.mm in Sources */,
</span><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFWorkQueuecpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp (0 => 181249)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp        2015-03-08 23:55:10 UTC (rev 181249)
</span><span class="lines">@@ -0,0 +1,192 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+
+#include &quot;Test.h&quot;
+#include &lt;wtf/Vector.h&gt;
+#include &lt;wtf/WorkQueue.h&gt;
+#include &lt;string&gt;
+#include &lt;thread&gt;
+
+namespace TestWebKitAPI {
+
+static const char* simpleTestLabel = &quot;simpleTest&quot;;
+static const char* longTestLabel = &quot;longTest&quot;;
+static const char* thirdTestLabel = &quot;thirdTest&quot;;
+static const char* dispatchAfterLabel = &quot;dispatchAfter&quot;;
+    
+TEST(WTF_WorkQueue, Simple)
+{
+    Mutex m_lock;
+    ThreadCondition m_testCompleted;
+    Vector&lt;std::string&gt; m_functionCallOrder;
+
+    bool calledSimpleTest = false;
+    bool calledLongTest = false;
+    bool calledThirdTest = false;
+
+    static const char* simpleTestLabel = &quot;simpleTest&quot;;
+    static const char* longTestLabel = &quot;longTest&quot;;
+    static const char* thirdTestLabel = &quot;thirdTest&quot;;
+
+    auto queue = WorkQueue::create(&quot;com.apple.WebKit.Test.simple&quot;);
+    
+    MutexLocker locker(m_lock);
+    queue-&gt;dispatch([&amp;](void) {
+        m_functionCallOrder.append(simpleTestLabel);
+        calledSimpleTest = true;
+    });
+    
+    queue-&gt;dispatch([&amp;](void) {
+        m_functionCallOrder.append(longTestLabel);
+        std::this_thread::sleep_for(std::chrono::nanoseconds(100));
+        calledLongTest = true;
+    });
+
+    queue-&gt;dispatch([&amp;](void) {
+        MutexLocker locker(m_lock);
+        m_functionCallOrder.append(thirdTestLabel);
+        calledThirdTest = true;
+
+        EXPECT_TRUE(calledSimpleTest);
+        EXPECT_TRUE(calledLongTest);
+        EXPECT_TRUE(calledThirdTest);
+        
+        m_testCompleted.signal();
+    });
+
+    m_testCompleted.wait(m_lock);
+
+    EXPECT_TRUE(calledSimpleTest);
+    EXPECT_TRUE(calledLongTest);
+    EXPECT_TRUE(calledThirdTest);
+
+    EXPECT_EQ(m_functionCallOrder.size(), static_cast&lt;size_t&gt;(3));
+    EXPECT_STREQ(simpleTestLabel, m_functionCallOrder[0].c_str());
+    EXPECT_STREQ(longTestLabel, m_functionCallOrder[1].c_str());
+    EXPECT_STREQ(thirdTestLabel, m_functionCallOrder[2].c_str());
+}
+
+TEST(WTF_WorkQueue, TwoQueues)
+{
+    Mutex m_lock;
+    ThreadCondition m_testQueue1Completed, m_testQueue2Completed;
+    Vector&lt;std::string&gt; m_functionCallOrder;
+
+    bool calledSimpleTest = false;
+    bool calledLongTest = false;
+    bool calledThirdTest = false;
+    
+    auto queue1 = WorkQueue::create(&quot;com.apple.WebKit.Test.twoQueues1&quot;);
+    auto queue2 = WorkQueue::create(&quot;com.apple.WebKit.Test.twoQueues2&quot;);
+
+    MutexLocker locker(m_lock);
+    
+    queue1-&gt;dispatch([&amp;](void) {
+        m_functionCallOrder.append(simpleTestLabel);
+        calledSimpleTest = true;
+    });
+
+    queue2-&gt;dispatch([&amp;](void) {
+        std::this_thread::sleep_for(std::chrono::nanoseconds(500));
+
+        MutexLocker locker(m_lock);
+        m_functionCallOrder.append(longTestLabel);
+        calledLongTest = true;
+        m_testQueue2Completed.signal();
+    });
+
+    queue1-&gt;dispatch([&amp;](void) {
+        MutexLocker locker(m_lock);
+        m_functionCallOrder.append(thirdTestLabel);
+        calledThirdTest = true;
+        
+        m_testQueue1Completed.signal();
+    });
+
+    m_testQueue1Completed.wait(m_lock);
+
+    EXPECT_TRUE(calledSimpleTest);
+    EXPECT_FALSE(calledLongTest);
+    EXPECT_TRUE(calledThirdTest);
+
+    m_testQueue2Completed.wait(m_lock);
+
+    EXPECT_TRUE(calledSimpleTest);
+    EXPECT_TRUE(calledLongTest);
+    EXPECT_TRUE(calledThirdTest);
+
+    EXPECT_EQ(m_functionCallOrder.size(), static_cast&lt;size_t&gt;(3));
+    EXPECT_STREQ(simpleTestLabel, m_functionCallOrder[0].c_str());
+    EXPECT_STREQ(thirdTestLabel, m_functionCallOrder[1].c_str());
+    EXPECT_STREQ(longTestLabel, m_functionCallOrder[2].c_str());
+}
+
+TEST(WTF_WorkQueue, DispatchAfter)
+{
+    Mutex m_lock;
+    ThreadCondition m_testCompleted, m_dispatchAfterTestCompleted;
+    Vector&lt;std::string&gt; m_functionCallOrder;
+
+    bool calledSimpleTest = false;
+    bool calledDispatchAfterTest = false;
+
+    auto queue = WorkQueue::create(&quot;com.apple.WebKit.Test.dispatchAfter&quot;);
+
+    MutexLocker locker(m_lock);
+
+    queue-&gt;dispatch([&amp;](void) {
+        MutexLocker locker(m_lock);
+        m_functionCallOrder.append(simpleTestLabel);
+        calledSimpleTest = true;
+        m_testCompleted.signal();
+    });
+
+    queue-&gt;dispatchAfter(std::chrono::milliseconds(500), [&amp;](void) {
+        MutexLocker locker(m_lock);
+        m_functionCallOrder.append(dispatchAfterLabel);
+        calledDispatchAfterTest = true;
+        m_dispatchAfterTestCompleted.signal();
+    });
+
+    std::chrono::time_point&lt;std::chrono::system_clock&gt; start = std::chrono::system_clock::now();
+    m_testCompleted.wait(m_lock);
+
+    EXPECT_TRUE(calledSimpleTest);
+    EXPECT_FALSE(calledDispatchAfterTest);
+    
+    m_dispatchAfterTestCompleted.wait(m_lock);
+    std::chrono::time_point&lt;std::chrono::system_clock&gt; done = std::chrono::system_clock::now();
+
+    EXPECT_TRUE(calledSimpleTest);
+    EXPECT_TRUE(calledDispatchAfterTest);
+
+    EXPECT_EQ(m_functionCallOrder.size(), static_cast&lt;size_t&gt;(2));
+    EXPECT_STREQ(simpleTestLabel, m_functionCallOrder[0].c_str());
+    EXPECT_STREQ(dispatchAfterLabel, m_functionCallOrder[1].c_str());
+}
+
+} // namespace TestWebKitAPI
</ins></span></pre>
</div>
</div>

</body>
</html>