Title: [210850] trunk/Tools
Revision
210850
Author
pvol...@apple.com
Date
2017-01-18 05:00:51 -0800 (Wed, 18 Jan 2017)

Log Message

[Win] Clipboard tests are flaky.
https://bugs.webkit.org/show_bug.cgi?id=167088

Reviewed by Brent Fulgham.

Tests involving the clipboard are flaky when running with multiple DRTs, since the clipboard is global. 
We can fix this by assigning each DRT a separate window station (each window station has its own clipboard).

* DumpRenderTree/win/DumpRenderTree.cpp:
(main):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (210849 => 210850)


--- trunk/Tools/ChangeLog	2017-01-18 10:24:49 UTC (rev 210849)
+++ trunk/Tools/ChangeLog	2017-01-18 13:00:51 UTC (rev 210850)
@@ -1,3 +1,16 @@
+2017-01-18  Per Arne Vollan  <pvol...@apple.com>
+
+        [Win] Clipboard tests are flaky.
+        https://bugs.webkit.org/show_bug.cgi?id=167088
+
+        Reviewed by Brent Fulgham.
+
+        Tests involving the clipboard are flaky when running with multiple DRTs, since the clipboard is global. 
+        We can fix this by assigning each DRT a separate window station (each window station has its own clipboard).
+
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (main):
+
 2017-01-18  Antoine Quint  <grao...@apple.com>
 
         [Modern Media Controls] Turn modern media controls on by default

Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (210849 => 210850)


--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2017-01-18 10:24:49 UTC (rev 210849)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2017-01-18 13:00:51 UTC (rev 210850)
@@ -1471,6 +1471,28 @@
     // Redirect stdout to stderr.
     int result = _dup2(_fileno(stderr), 1);
 
+    // Tests involving the clipboard are flaky when running with multiple DRTs, since the clipboard is global.
+    // We can fix this by assigning each DRT a separate window station (each window station has its own clipboard).
+    DWORD processId = ::GetCurrentProcessId();
+    String windowStationName = String::format("windowStation%d", processId);
+    String desktopName = String::format("desktop%d", processId);
+    HDESK desktop = nullptr;
+
+    auto windowsStation = ::CreateWindowStation(windowStationName.charactersWithNullTermination().data(), CWF_CREATE_ONLY, WINSTA_ALL_ACCESS, nullptr);
+    if (windowsStation) {
+        if (!::SetProcessWindowStation(windowsStation))
+            fprintf(stderr, "SetProcessWindowStation failed with error %d\n", ::GetLastError());
+
+        desktop = ::CreateDesktop(desktopName.charactersWithNullTermination().data(), nullptr, nullptr, 0, GENERIC_ALL, nullptr);
+        if (!desktop)
+            fprintf(stderr, "Failed to create desktop with error %d\n", ::GetLastError());
+    } else {
+        DWORD error = ::GetLastError();
+        fprintf(stderr, "Failed to create window station with error %d\n", error);
+        if (error == ERROR_ACCESS_DENIED)
+            fprintf(stderr, "DumpRenderTree should be run as Administrator!\n");
+    }
+
     initialize();
 
     setDefaultsToConsistentValuesForTesting();
@@ -1573,6 +1595,11 @@
     _CrtDumpMemoryLeaks();
 #endif
 
+    if (desktop)
+        ::CloseDesktop(desktop);
+    if (windowsStation)
+        ::CloseWindowStation(windowsStation);
+
     ::OleUninitialize();
 
     return 0;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to