Title: [275091] trunk
Revision
275091
Author
[email protected]
Date
2021-03-26 04:07:44 -0700 (Fri, 26 Mar 2021)

Log Message

Fix NowPlayingInfoArtwork operator== logic.
https://bugs.webkit.org/show_bug.cgi?id=223730
<rdar://problem/75822687>

Patch by Jean-Yves Avenard <[email protected]> on 2021-03-26
Reviewed by Youenn Fablet.

Source/WebCore:

Gtest NowPlayingInfoArtworkTest added .

* platform/audio/NowPlayingInfo.h:
(WebCore::NowPlayingInfoArtwork::operator== const):
(WebCore::NowPlayingInfoArtwork::operator!= const):

Tools:

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/NowPlayingInfoTests.cpp: Added.
(TestWebKitAPI::testEmptyArtwork):
(TestWebKitAPI::TEST):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (275090 => 275091)


--- trunk/Source/WebCore/ChangeLog	2021-03-26 10:50:12 UTC (rev 275090)
+++ trunk/Source/WebCore/ChangeLog	2021-03-26 11:07:44 UTC (rev 275091)
@@ -1,3 +1,17 @@
+2021-03-26  Jean-Yves Avenard  <[email protected]>
+
+        Fix NowPlayingInfoArtwork operator== logic.
+        https://bugs.webkit.org/show_bug.cgi?id=223730
+        <rdar://problem/75822687>
+
+        Reviewed by Youenn Fablet.
+
+        Gtest NowPlayingInfoArtworkTest added .
+
+        * platform/audio/NowPlayingInfo.h:
+        (WebCore::NowPlayingInfoArtwork::operator== const):
+        (WebCore::NowPlayingInfoArtwork::operator!= const):
+
 2021-03-26  Rob Buis  <[email protected]>
 
         Remove ASSERT in RenderListItem::computeMarkerStyle

Modified: trunk/Source/WebCore/platform/audio/NowPlayingInfo.h (275090 => 275091)


--- trunk/Source/WebCore/platform/audio/NowPlayingInfo.h	2021-03-26 10:50:12 UTC (rev 275090)
+++ trunk/Source/WebCore/platform/audio/NowPlayingInfo.h	2021-03-26 11:07:44 UTC (rev 275091)
@@ -41,12 +41,12 @@
 
     bool operator==(const NowPlayingInfoArtwork& other) const
     {
-        return *this != other;
+        return src == other.src && mimeType == other.mimeType;
     }
 
     bool operator!=(const NowPlayingInfoArtwork& other) const
     {
-        return src != other.src || mimeType != other.mimeType;
+        return !(*this == other);
     }
 
     template<class Encoder> void encode(Encoder&) const;

Modified: trunk/Tools/ChangeLog (275090 => 275091)


--- trunk/Tools/ChangeLog	2021-03-26 10:50:12 UTC (rev 275090)
+++ trunk/Tools/ChangeLog	2021-03-26 11:07:44 UTC (rev 275091)
@@ -1,3 +1,17 @@
+2021-03-26  Jean-Yves Avenard  <[email protected]>
+
+        Fix NowPlayingInfoArtwork operator== logic.
+        https://bugs.webkit.org/show_bug.cgi?id=223730
+        <rdar://problem/75822687>
+
+        Reviewed by Youenn Fablet.
+
+        * TestWebKitAPI/CMakeLists.txt:
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebCore/NowPlayingInfoTests.cpp: Added.
+        (TestWebKitAPI::testEmptyArtwork):
+        (TestWebKitAPI::TEST):
+
 2021-03-25  Cameron McCormack  <[email protected]>
 
         Avoid calling `xcodebuild -showsdks` where possible.

Modified: trunk/Tools/TestWebKitAPI/CMakeLists.txt (275090 => 275091)


--- trunk/Tools/TestWebKitAPI/CMakeLists.txt	2021-03-26 10:50:12 UTC (rev 275090)
+++ trunk/Tools/TestWebKitAPI/CMakeLists.txt	2021-03-26 11:07:44 UTC (rev 275091)
@@ -183,6 +183,7 @@
         Tests/WebCore/KeyedCoding.cpp
         Tests/WebCore/LayoutUnitTests.cpp
         Tests/WebCore/MIMETypeRegistry.cpp
+        Tests/WebCore/NowPlayingInfoTests.cpp
         Tests/WebCore/ParsedContentRange.cpp
         Tests/WebCore/PublicSuffix.cpp
         Tests/WebCore/SecurityOrigin.cpp

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (275090 => 275091)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2021-03-26 10:50:12 UTC (rev 275090)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2021-03-26 11:07:44 UTC (rev 275091)
@@ -318,6 +318,7 @@
 		51396E1A222E516000A42FCE /* LoadFileURL.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51396E19222E4E8600A42FCE /* LoadFileURL.mm */; };
 		5142B2731517C8C800C32B19 /* ContextMenuCanCopyURL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */; };
 		514958BE1F7427AC00E87BAD /* WKWebViewAutofillTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514958BD1F7427AC00E87BAD /* WKWebViewAutofillTests.mm */; };
+		5159F267260D43E300B2DA3C /* NowPlayingInfoTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5159F266260D43E300B2DA3C /* NowPlayingInfoTests.cpp */; };
 		515BE16F1D428BB100DD7C68 /* StoreBlobToBeDeleted.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 515BE16E1D4288FF00DD7C68 /* StoreBlobToBeDeleted.html */; };
 		515BE1711D428E4B00DD7C68 /* StoreBlobThenDelete.mm in Sources */ = {isa = PBXBuildFile; fileRef = 515BE1701D428BD100DD7C68 /* StoreBlobThenDelete.mm */; };
 		516281252325C18000BB7E42 /* TestPDFDocument.mm in Sources */ = {isa = PBXBuildFile; fileRef = 516281242325C17B00BB7E42 /* TestPDFDocument.mm */; };
@@ -2096,6 +2097,7 @@
 		5142B2701517C88B00C32B19 /* ContextMenuCanCopyURL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextMenuCanCopyURL.mm; sourceTree = "<group>"; };
 		5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = ContextMenuCanCopyURL.html; sourceTree = "<group>"; };
 		514958BD1F7427AC00E87BAD /* WKWebViewAutofillTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewAutofillTests.mm; sourceTree = "<group>"; };
+		5159F266260D43E300B2DA3C /* NowPlayingInfoTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NowPlayingInfoTests.cpp; sourceTree = "<group>"; };
 		515BE16E1D4288FF00DD7C68 /* StoreBlobToBeDeleted.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = StoreBlobToBeDeleted.html; sourceTree = "<group>"; };
 		515BE1701D428BD100DD7C68 /* StoreBlobThenDelete.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StoreBlobThenDelete.mm; sourceTree = "<group>"; };
 		516281232325C17A00BB7E42 /* TestPDFDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestPDFDocument.h; path = cocoa/TestPDFDocument.h; sourceTree = "<group>"; };
@@ -3626,6 +3628,7 @@
 				076E507E1F45031E006E9F5A /* Logging.cpp */,
 				CE1866471F72E8F100A0CAB6 /* MarkedText.cpp */,
 				A5B149DD1F5A19DC00C6DAFF /* MIMETypeRegistry.cpp */,
+				5159F266260D43E300B2DA3C /* NowPlayingInfoTests.cpp */,
 				CD225C071C45A69200140761 /* ParsedContentRange.cpp */,
 				AA96CAB421C7DB4200FD2F97 /* ParsedContentType.cpp */,
 				6B0A07F621FA9C2B00D57391 /* PrivateClickMeasurement.cpp */,
@@ -5474,6 +5477,7 @@
 				83F22C6420B355F80034277E /* NoPolicyDelegateResponse.mm in Sources */,
 				CD2D0D1A213465560018C784 /* NowPlaying.mm in Sources */,
 				2ECFF5551D9B12F800B55394 /* NowPlayingControlsTests.mm in Sources */,
+				5159F267260D43E300B2DA3C /* NowPlayingInfoTests.cpp in Sources */,
 				A10F047E1E3AD29C00C95E19 /* NSFileManagerExtras.mm in Sources */,
 				F442851D2140DF2900CCDA22 /* NSFontPanelTesting.mm in Sources */,
 				F4EB4E912328AC3000574DAB /* NSItemProviderAdditions.mm in Sources */,

Added: trunk/Tools/TestWebKitAPI/Tests/WebCore/NowPlayingInfoTests.cpp (0 => 275091)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/NowPlayingInfoTests.cpp	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/NowPlayingInfoTests.cpp	2021-03-26 11:07:44 UTC (rev 275091)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2021 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 "config.h"
+
+#include <WebCore/NowPlayingInfo.h>
+
+namespace TestWebKitAPI {
+
+static void testEmptyArtwork(const WebCore::NowPlayingInfoArtwork& artwork)
+{
+    EXPECT_TRUE(artwork.src.isEmpty());
+    EXPECT_TRUE(artwork.mimeType.isEmpty());
+    EXPECT_EQ(nullptr, artwork.imageData.get());
+}
+
+TEST(NowPlayingInfoArtwork, DefaultConstruction)
+{
+    WebCore::NowPlayingInfoArtwork test;
+
+    testEmptyArtwork(test);
+}
+
+TEST(NowPlayingInfoArtwork, ValueConstruction)
+{
+    WebCore::NowPlayingInfoArtwork test { "http://artwork.com/how_so_pretty.jpeg", "image/jpeg", nullptr };
+
+    EXPECT_EQ("http://artwork.com/how_so_pretty.jpeg", test.src);
+    EXPECT_EQ("image/jpeg", test.mimeType);
+}
+
+TEST(NowPlayingInfoArtwork, OperatorEqual)
+{
+    WebCore::NowPlayingInfoArtwork test1 { "http://artwork.com/how_so_pretty.jpeg", "image/jpeg", nullptr };
+    WebCore::NowPlayingInfoArtwork test2 { "http://artwork.com/how_so_pretty.jpeg", "image/jpeg", nullptr };
+
+    EXPECT_TRUE(test1 == test2);
+    EXPECT_FALSE(test1 != test2);
+}
+
+TEST(NowPlayingInfoArtwork, OperatorDifferent)
+{
+    WebCore::NowPlayingInfoArtwork test1 { "http://artwork.com/how_so_pretty.jpeg", "image/jpeg", nullptr };
+    WebCore::NowPlayingInfoArtwork test2 { "http://artwork.com/how_so_visually_challenging.png", "image/png", nullptr };
+
+    EXPECT_FALSE(test1 == test2);
+    EXPECT_TRUE(test1 != test2);
+}
+
+}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to