<!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>[205212] trunk</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/205212">205212</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-08-30 17:34:39 -0700 (Tue, 30 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>YouTubePluginReplacementTest's URL transformation logic should have tests
https://bugs.webkit.org/show_bug.cgi?id=161406
&lt;rdar://problem/28050847&gt;

Patch by Ricky Mondello &lt;rmondello@apple.com&gt; on 2016-08-30
Reviewed by Eric Carlson.

Source/WebCore:

Refactor most of YouTubePluginReplacement::youTubeURL into a static method that can be used by TestWebKitAPI.

* Modules/plugins/YouTubePluginReplacement.cpp:
(WebCore::YouTubePluginReplacement::youTubeURL): Now implemented in terms of youTubeURLFromAbsoluteURL.
(WebCore::YouTubePluginReplacement::youTubeURLFromAbsoluteURL): Absorbs most of youTubeURL.
* Modules/plugins/YouTubePluginReplacement.h: Declare a public method, for the benefit of testing.
* WebCore.xcodeproj/project.pbxproj: Make some heads private for TestWebKitAPI's benefit.

Tools:

Add some very basic tests. Future patches should expand on these to find and fix bugs.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Add YouTubePluginReplacement.cpp.
* TestWebKitAPI/Tests/WebCore/YouTubePluginReplacement.cpp: Added.
(TestWebKitAPI::test): Added.
(TestWebKitAPI::TEST_F): Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulespluginsYouTubePluginReplacementcpp">trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulespluginsYouTubePluginReplacementh">trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.h</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebCoreYouTubePluginReplacementcpp">trunk/Tools/TestWebKitAPI/Tests/WebCore/YouTubePluginReplacement.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (205211 => 205212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-31 00:27:27 UTC (rev 205211)
+++ trunk/Source/WebCore/ChangeLog        2016-08-31 00:34:39 UTC (rev 205212)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-08-30  Ricky Mondello  &lt;rmondello@apple.com&gt;
+
+        YouTubePluginReplacementTest's URL transformation logic should have tests
+        https://bugs.webkit.org/show_bug.cgi?id=161406
+        &lt;rdar://problem/28050847&gt;
+
+        Reviewed by Eric Carlson.
+
+        Refactor most of YouTubePluginReplacement::youTubeURL into a static method that can be used by TestWebKitAPI.
+
+        * Modules/plugins/YouTubePluginReplacement.cpp:
+        (WebCore::YouTubePluginReplacement::youTubeURL): Now implemented in terms of youTubeURLFromAbsoluteURL.
+        (WebCore::YouTubePluginReplacement::youTubeURLFromAbsoluteURL): Absorbs most of youTubeURL.
+        * Modules/plugins/YouTubePluginReplacement.h: Declare a public method, for the benefit of testing.
+        * WebCore.xcodeproj/project.pbxproj: Make some heads private for TestWebKitAPI's benefit.
+
</ins><span class="cx"> 2016-08-30  Frederic Wang  &lt;fwang@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Move some code from MathMLElement to MathMLPresentationElement
</span></span></pre></div>
<a id="trunkSourceWebCoreModulespluginsYouTubePluginReplacementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp (205211 => 205212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp        2016-08-31 00:27:27 UTC (rev 205211)
+++ trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp        2016-08-31 00:34:39 UTC (rev 205212)
</span><span class="lines">@@ -283,7 +283,11 @@
</span><span class="cx"> String YouTubePluginReplacement::youTubeURL(const String&amp; srcString)
</span><span class="cx"> {
</span><span class="cx">     URL srcURL = m_parentElement-&gt;document().completeURL(stripLeadingAndTrailingHTMLSpaces(srcString));
</span><ins>+    return youTubeURLFromAbsoluteURL(srcURL, srcString);
+}
</ins><span class="cx"> 
</span><ins>+String YouTubePluginReplacement::youTubeURLFromAbsoluteURL(const URL&amp; srcURL, const String&amp; srcString)
+{
</ins><span class="cx">     bool isYouTubeShortenedURL = false;
</span><span class="cx">     URL youTubeURL = processAndCreateYouTubeURL(srcURL, isYouTubeShortenedURL);
</span><span class="cx">     if (srcURL.isEmpty() || youTubeURL.isEmpty())
</span></span></pre></div>
<a id="trunkSourceWebCoreModulespluginsYouTubePluginReplacementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.h (205211 => 205212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.h        2016-08-31 00:27:27 UTC (rev 205211)
+++ trunk/Source/WebCore/Modules/plugins/YouTubePluginReplacement.h        2016-08-31 00:34:39 UTC (rev 205212)
</span><span class="lines">@@ -38,6 +38,8 @@
</span><span class="cx"> 
</span><span class="cx">     typedef HashMap&lt;String, String&gt; KeyValueMap;
</span><span class="cx"> 
</span><ins>+    WEBCORE_EXPORT static String youTubeURLFromAbsoluteURL(const URL&amp; srcURL, const String&amp; srcString);
+
</ins><span class="cx"> private:
</span><span class="cx">     YouTubePluginReplacement(HTMLPlugInElement&amp;, const Vector&lt;String&gt;&amp; paramNames, const Vector&lt;String&gt;&amp; paramValues);
</span><span class="cx">     static Ref&lt;PluginReplacement&gt; create(HTMLPlugInElement&amp;, const Vector&lt;String&gt;&amp; paramNames, const Vector&lt;String&gt;&amp; paramValues);
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (205211 => 205212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-08-31 00:27:27 UTC (rev 205211)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-08-31 00:34:39 UTC (rev 205212)
</span><span class="lines">@@ -139,7 +139,7 @@
</span><span class="cx">                 07297FA71C1881C5003F0735 /* UserMediaPermissionCheck.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07297FA51C1881C5003F0735 /* UserMediaPermissionCheck.cpp */; };
</span><span class="cx">                 07297FA81C1881C5003F0735 /* UserMediaPermissionCheck.h in Headers */ = {isa = PBXBuildFile; fileRef = 07297FA61C1881C5003F0735 /* UserMediaPermissionCheck.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 072A70401D6E8F6200DF0AFC /* OverconstrainedErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 072A703E1D6E8F6200DF0AFC /* OverconstrainedErrorEvent.h */; };
</span><del>-                072AE1E5183C0741000A5988 /* PluginReplacement.h in Headers */ = {isa = PBXBuildFile; fileRef = 072AE1DF183C0741000A5988 /* PluginReplacement.h */; };
</del><ins>+                072AE1E5183C0741000A5988 /* PluginReplacement.h in Headers */ = {isa = PBXBuildFile; fileRef = 072AE1DF183C0741000A5988 /* PluginReplacement.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 072AE1E6183C0741000A5988 /* QuickTimePluginReplacement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 072AE1E0183C0741000A5988 /* QuickTimePluginReplacement.mm */; };
</span><span class="cx">                 072AE1E8183C0741000A5988 /* QuickTimePluginReplacement.h in Headers */ = {isa = PBXBuildFile; fileRef = 072AE1E2183C0741000A5988 /* QuickTimePluginReplacement.h */; };
</span><span class="cx">                 072C8B11131C518600A4FCE9 /* MediaPlayerPrivateAVFoundation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 076F0D0912B8192700C26AA4 /* MediaPlayerPrivateAVFoundation.cpp */; };
</span><span class="lines">@@ -2678,7 +2678,7 @@
</span><span class="cx">                 7A54858014E02D51006AE05A /* InspectorHistory.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A54857E14E02D51006AE05A /* InspectorHistory.h */; };
</span><span class="cx">                 7A54881714E432A1006AE05A /* DOMPatchSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A54881514E432A1006AE05A /* DOMPatchSupport.h */; };
</span><span class="cx">                 7A54881814E432A1006AE05A /* DOMPatchSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A54881614E432A1006AE05A /* DOMPatchSupport.cpp */; };
</span><del>-                7A5515F5191830A3009687D2 /* YouTubePluginReplacement.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A5515F3191830A3009687D2 /* YouTubePluginReplacement.h */; };
</del><ins>+                7A5515F5191830A3009687D2 /* YouTubePluginReplacement.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A5515F3191830A3009687D2 /* YouTubePluginReplacement.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 7A5515F6191830A3009687D2 /* YouTubePluginReplacement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A5515F4191830A3009687D2 /* YouTubePluginReplacement.cpp */; };
</span><span class="cx">                 7A674BDB0F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A674BD90F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp */; };
</span><span class="cx">                 7A674BDC0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */; };
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (205211 => 205212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-08-31 00:27:27 UTC (rev 205211)
+++ trunk/Tools/ChangeLog        2016-08-31 00:34:39 UTC (rev 205212)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-08-30  Ricky Mondello  &lt;rmondello@apple.com&gt;
+
+        YouTubePluginReplacementTest's URL transformation logic should have tests
+        https://bugs.webkit.org/show_bug.cgi?id=161406
+        &lt;rdar://problem/28050847&gt;
+
+        Reviewed by Eric Carlson.
+
+        Add some very basic tests. Future patches should expand on these to find and fix bugs.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Add YouTubePluginReplacement.cpp.
+        * TestWebKitAPI/Tests/WebCore/YouTubePluginReplacement.cpp: Added.
+        (TestWebKitAPI::test): Added.
+        (TestWebKitAPI::TEST_F): Added.
+
</ins><span class="cx"> 2016-08-30  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         GameController.framework backend for gamepad API.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (205211 => 205212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-08-31 00:27:27 UTC (rev 205211)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-08-31 00:34:39 UTC (rev 205212)
</span><span class="lines">@@ -387,6 +387,7 @@
</span><span class="cx">                 9B0786A51C5885C300D159E3 /* InjectedBundleMakeAllShadowRootOpen_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B0786A41C5885C300D159E3 /* InjectedBundleMakeAllShadowRootOpen_Bundle.cpp */; };
</span><span class="cx">                 9B26FCCA159D16DE00CC3765 /* HTMLFormCollectionNamedItem.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9B26FCB4159D15E700CC3765 /* HTMLFormCollectionNamedItem.html */; };
</span><span class="cx">                 9B4F8FA7159D52DD002D9F94 /* HTMLCollectionNamedItem.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9B4F8FA6159D52CA002D9F94 /* HTMLCollectionNamedItem.html */; };
</span><ins>+                9C64DC321D76198A004B598E /* YouTubePluginReplacement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9C64DC311D76198A004B598E /* YouTubePluginReplacement.cpp */; };
</ins><span class="cx">                 A1146A8D1D2D7115000FE710 /* ContentFiltering.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1146A8A1D2D704F000FE710 /* ContentFiltering.mm */; };
</span><span class="cx">                 A13EBBAA1B87428D00097110 /* WebProcessPlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = A13EBBA91B87428D00097110 /* WebProcessPlugIn.mm */; };
</span><span class="cx">                 A13EBBAB1B87434600097110 /* PlatformUtilitiesCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F139E721A423A2B00F590F5 /* PlatformUtilitiesCocoa.mm */; };
</span><span class="lines">@@ -954,6 +955,7 @@
</span><span class="cx">                 9B4F8FA3159D52B1002D9F94 /* HTMLCollectionNamedItem.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HTMLCollectionNamedItem.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9B4F8FA6159D52CA002D9F94 /* HTMLCollectionNamedItem.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = HTMLCollectionNamedItem.html; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9B79164F1BD89D0D00D50B8F /* FirstResponderScrollingPosition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FirstResponderScrollingPosition.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                9C64DC311D76198A004B598E /* YouTubePluginReplacement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YouTubePluginReplacement.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 A1146A8A1D2D704F000FE710 /* ContentFiltering.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContentFiltering.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A13EBB491B87339E00097110 /* TestWebKitAPI.wkbundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TestWebKitAPI.wkbundle; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="cx">                 A13EBB521B87346600097110 /* WebProcessPlugIn.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebProcessPlugIn.xcconfig; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -1347,6 +1349,7 @@
</span><span class="cx">                                 7AD3FE8D1D75FB8D00B169A4 /* TransformationMatrix.cpp */,
</span><span class="cx">                                 440A1D3814A0103A008A66F2 /* URL.cpp */,
</span><span class="cx">                                 5C6E65411D5CEF8500F7862E /* URLParser.cpp */,
</span><ins>+                                9C64DC311D76198A004B598E /* YouTubePluginReplacement.cpp */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = WebCore;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -2375,6 +2378,7 @@
</span><span class="cx">                                 2D00065F1C1F589A0088E6A7 /* WKPDFViewResizeCrash.mm in Sources */,
</span><span class="cx">                                 7CCE7F211A411AE600447C4C /* WKPreferences.cpp in Sources */,
</span><span class="cx">                                 7C83E0B51D0A649300FEBCF3 /* WKRetainPtr.cpp in Sources */,
</span><ins>+                                9C64DC321D76198A004B598E /* YouTubePluginReplacement.cpp in Sources */,
</ins><span class="cx">                                 5E4B1D2E1D404C6100053621 /* WKScrollViewDelegateCrash.mm in Sources */,
</span><span class="cx">                                 7CCE7F221A411AE600447C4C /* WKString.cpp in Sources */,
</span><span class="cx">                                 7CCE7F1E1A411AE600447C4C /* WKStringJSString.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebCoreYouTubePluginReplacementcpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebCore/YouTubePluginReplacement.cpp (0 => 205212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebCore/YouTubePluginReplacement.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/YouTubePluginReplacement.cpp        2016-08-31 00:34:39 UTC (rev 205212)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+/*
+ * Copyright (C) 2016 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 &lt;WebCore/URL.h&gt;
+#include &lt;WebCore/YouTubePluginReplacement.h&gt;
+#include &lt;wtf/MainThread.h&gt;
+
+using namespace WebCore;
+
+namespace TestWebKitAPI {
+
+class YouTubePluginReplacementTest : public testing::Test {
+public:
+    void SetUp() final {
+        WTF::initializeMainThread();
+    }
+};
+
+static bool test(const String&amp; inputURLString, const String&amp; expectedURLString)
+{
+    URL inputURL(URL(), inputURLString);
+    String actualURLString = YouTubePluginReplacement::youTubeURLFromAbsoluteURL(inputURL, inputURLString);
+    return actualURLString.utf8() == expectedURLString.utf8();
+}
+
+TEST_F(YouTubePluginReplacementTest, YouTubeURLFromAbsoluteURL)
+{
+    // YouTube non-video URL, not expected to be transformed.
+    EXPECT_TRUE(test(&quot;https://www.youtube.com&quot;, &quot;https://www.youtube.com&quot;));
+
+    // Basic YouTube video links, expected to be transformed.
+    EXPECT_TRUE(test(&quot;https://www.youtube.com/v/dQw4w9WgXcQ&quot;, &quot;https://www.youtube.com/embed/dQw4w9WgXcQ?showinfo=0&quot;));
+    EXPECT_TRUE(test(&quot;http://www.youtube.com/v/dQw4w9WgXcQ&quot;, &quot;http://www.youtube.com/embed/dQw4w9WgXcQ?showinfo=0&quot;));
+    EXPECT_TRUE(test(&quot;https://youtube.com/v/dQw4w9WgXcQ&quot;, &quot;https://youtube.com/embed/dQw4w9WgXcQ?showinfo=0&quot;));
+    EXPECT_TRUE(test(&quot;http://youtube.com/v/dQw4w9WgXcQ&quot;, &quot;http://youtube.com/embed/dQw4w9WgXcQ?showinfo=0&quot;));
+
+    // With start time, preserved.
+    EXPECT_TRUE(test(&quot;http://www.youtube.com/v/dQw4w9WgXcQ?start=4&quot;, &quot;http://www.youtube.com/embed/dQw4w9WgXcQ?start=4&amp;showinfo=0&quot;));
+    EXPECT_TRUE(test(&quot;http://www.youtube.com/v/dQw4w9WgXcQ?start=4&amp;fs=1&quot;, &quot;http://www.youtube.com/embed/dQw4w9WgXcQ?start=4&amp;fs=1&amp;showinfo=0&quot;));
+
+    // Non-Flash URL is untouched.
+    EXPECT_TRUE(test(&quot;https://www.youtube.com/embed/dQw4w9WgXcQ&quot;, &quot;https://www.youtube.com/embed/dQw4w9WgXcQ&quot;));
+    // Even with an extra parameter.
+    EXPECT_TRUE(test(&quot;http://www.youtube.com/embed/dQw4w9WgXcQ?enablejsapi=1&quot;, &quot;http://www.youtube.com/embed/dQw4w9WgXcQ?enablejsapi=1&quot;));
+
+    // Non-YouTube domain whose path looks like a Flash video shouldn't be transformed.
+    EXPECT_TRUE(test(&quot;https://www.notyoutube.com/v/dQw4w9WgXcQ&quot;, &quot;https://www.notyoutube.com/v/dQw4w9WgXcQ&quot;));
+}
+
+} // namespace TestWebKitAPI
</ins></span></pre>
</div>
</div>

</body>
</html>