Add test for fix in https://bugs.webkit.org/show_bug.cgi?id=187922
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Sep 2018 18:03:10 +0000 (18:03 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Sep 2018 18:03:10 +0000 (18:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=187925

Reviewed by Simon Fraser.

This will test that the function primaryScreenDisplayID() returns a valid display ID.

Source/WebCore:

Test: fast/misc/valid-primary-screen-displayID.html

* platform/PlatformScreen.h:
* platform/mac/PlatformScreenMac.mm:
(WebCore::primaryScreenDisplayID):
* testing/Internals.cpp:
(WebCore::Internals::primaryScreenDisplayID):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* TestExpectations:
* fast/misc/valid-primary-screen-displayID-expected.txt: Added.
* fast/misc/valid-primary-screen-displayID.html: Added.
* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235619 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/misc/valid-primary-screen-displayID-expected.txt [new file with mode: 0644]
LayoutTests/fast/misc/valid-primary-screen-displayID.html [new file with mode: 0644]
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/platform/PlatformScreen.h
Source/WebCore/platform/mac/PlatformScreenMac.mm
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl

index 78d1e12..53a30b7 100644 (file)
@@ -1,3 +1,17 @@
+2018-09-04  Per Arne Vollan  <pvollan@apple.com>
+
+        Add test for fix in https://bugs.webkit.org/show_bug.cgi?id=187922
+        https://bugs.webkit.org/show_bug.cgi?id=187925
+
+        Reviewed by Simon Fraser.
+
+        This will test that the function primaryScreenDisplayID() returns a valid display ID.
+
+        * TestExpectations:
+        * fast/misc/valid-primary-screen-displayID-expected.txt: Added.
+        * fast/misc/valid-primary-screen-displayID.html: Added.
+        * platform/mac-wk2/TestExpectations:
+
 2018-09-04  Daniel Bates  <dabates@apple.com>
 
         Remove redundant inline text boxes for empty combined text
index 94e6c88..b468d83 100644 (file)
@@ -399,6 +399,11 @@ http/wpt/cross-origin-resource-policy/ [ Skip ]
 # testRunner.terminateNetworkProcess() only works in WebKit2
 fast/files/blob-network-process-crash.html [ Skip ]
 
+# This test is currently only relevant on mac-wk2
+fast/canvas/webgl/context-update-on-display-configuration.html [ Skip ]
+
+fast/misc/valid-primary-screen-displayID.html [ Skip ]
+
 #//////////////////////////////////////////////////////////////////////////////////////////
 # End platform-specific tests.
 #//////////////////////////////////////////////////////////////////////////////////////////
@@ -2235,6 +2240,3 @@ webkit.org/b/187762 http/tests/websocket/tests/hybi/websocket-cookie-overwrite-b
 webkit.org/b/187269 [ Debug ] imported/w3c/web-platform-tests/FileAPI/reading-data-section/filereader_abort.html [ Skip ]
 
 webkit.org/b/185308 legacy-animation-engine/animations/combo-transform-translate+scale.html [ Pass Failure ]
-
-# This test is currently only relevant on mac-wk2
-fast/canvas/webgl/context-update-on-display-configuration.html [ Skip ]
diff --git a/LayoutTests/fast/misc/valid-primary-screen-displayID-expected.txt b/LayoutTests/fast/misc/valid-primary-screen-displayID-expected.txt
new file mode 100644 (file)
index 0000000..6cc5d98
--- /dev/null
@@ -0,0 +1,2 @@
+PASS: Valid primary screen display ID.
+
diff --git a/LayoutTests/fast/misc/valid-primary-screen-displayID.html b/LayoutTests/fast/misc/valid-primary-screen-displayID.html
new file mode 100644 (file)
index 0000000..7d4b602
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that the display ID of the primary screen is valid.</title>
+<script>
+function log(msg)
+{
+    document.getElementById('console').appendChild(document.createTextNode(msg + "\n"));
+}
+
+function onload()
+{
+    if (window.testRunner)
+        testRunner.dumpAsText();
+    if (window.internals.primaryScreenDisplayID())
+        log("PASS: Valid primary screen display ID.");
+    else
+        log("FAIL: Invalid primary screen display ID.");
+}
+</script>
+</head>
+<body onLoad="onload()">
+<pre id="console"></pre>
+</body>
+</html>
index d753413..53e4c9d 100644 (file)
@@ -53,6 +53,10 @@ applicationmanifest/ [ Pass ]
 
 webkit.org/b/187183 http/tests/security/pasteboard-file-url.html [ Pass ]
 
+[ Mojave+ ] fast/canvas/webgl/context-update-on-display-configuration.html [ Pass ]
+
+fast/misc/valid-primary-screen-displayID.html [ Pass ]
+
 #//////////////////////////////////////////////////////////////////////////////////////////
 # End platform-specific directories.
 #//////////////////////////////////////////////////////////////////////////////////////////
@@ -833,8 +837,6 @@ webkit.org/b/186362 [ Release ] http/tests/resourceLoadStatistics/prevalent-reso
 
 webkit.org/b/186425 [ Debug ] inspector/console/webcore-logging.html [ Pass Failure ]
 
-[ Mojave+ ] fast/canvas/webgl/context-update-on-display-configuration.html [ Pass ]
-
 # skip manual payment-request tests
 imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/complete-method-manual.https.html [ Skip ]
 imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html [ Skip ]
index f2234b9..249ec18 100644 (file)
@@ -1,3 +1,22 @@
+2018-09-04  Per Arne Vollan  <pvollan@apple.com>
+
+        Add test for fix in https://bugs.webkit.org/show_bug.cgi?id=187922
+        https://bugs.webkit.org/show_bug.cgi?id=187925
+
+        Reviewed by Simon Fraser.
+
+        This will test that the function primaryScreenDisplayID() returns a valid display ID.
+
+        Test: fast/misc/valid-primary-screen-displayID.html
+
+        * platform/PlatformScreen.h:
+        * platform/mac/PlatformScreenMac.mm:
+        (WebCore::primaryScreenDisplayID):
+        * testing/Internals.cpp:
+        (WebCore::Internals::primaryScreenDisplayID):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2018-09-04  Daniel Bates  <dabates@apple.com>
 
         Add helper function to create a potential CORS request
index 18b268d..b17c2c4 100644 (file)
@@ -99,6 +99,8 @@ NSPoint flipScreenPoint(const NSPoint&, NSScreen *);
 WEBCORE_EXPORT ScreenProperties collectScreenProperties();
 WEBCORE_EXPORT void setScreenProperties(const ScreenProperties&);
 
+WEBCORE_EXPORT PlatformDisplayID primaryScreenDisplayID();
+
 uint32_t primaryOpenGLDisplayMask();
 uint32_t displayMaskForDisplay(PlatformDisplayID);
 
index b244f6d..8e72657 100644 (file)
@@ -102,7 +102,7 @@ static ScreenProperties& screenProperties()
     return screenProperties;
 }
 
-static PlatformDisplayID& primaryScreenDisplayID()
+PlatformDisplayID primaryScreenDisplayID()
 {
     return screenProperties().primaryDisplayID;
 }
index f304a44..413291a 100644 (file)
 #include "PageOverlay.h"
 #include "PathUtilities.h"
 #include "PlatformMediaSessionManager.h"
+#include "PlatformScreen.h"
 #include "PlatformStrategies.h"
 #include "PluginData.h"
 #include "PrintContext.h"
@@ -4720,4 +4721,13 @@ void Internals::notifyResourceLoadObserver()
     ResourceLoadObserver::shared().notifyObserver();
 }
 
+unsigned long Internals::primaryScreenDisplayID()
+{
+#if PLATFORM(MAC)
+    return WebCore::primaryScreenDisplayID();
+#else
+    return 0;
+#endif
+}
+
 } // namespace WebCore
index 40cdbef..74119c5 100644 (file)
@@ -735,6 +735,8 @@ public:
 
     void notifyResourceLoadObserver();
 
+    unsigned long primaryScreenDisplayID();
+        
 private:
     explicit Internals(Document&);
     Document* contextDocument() const;
index 53e2c78..7cc1f48 100644 (file)
@@ -669,4 +669,6 @@ enum CompositingPolicy {
     unsigned long pluginCount();
 
     void notifyResourceLoadObserver();
+
+    unsigned long primaryScreenDisplayID();
 };