<!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>[210552] 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/210552">210552</a></dd>
<dt>Author</dt> <dd>jer.noble@apple.com</dd>
<dt>Date</dt> <dd>2017-01-10 10:41:31 -0800 (Tue, 10 Jan 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add support for MediaKeys.createSession().
https://bugs.webkit.org/show_bug.cgi?id=166796
Reviewed by Eric Carlson.
Source/WebCore:
Test: media/encrypted-media/mock-MediaKeys-createSession.html
Implement MediaKeys::createSession(). This requires some additions to
CDM, CDMPrivate, and CDMInstance to support platform adoption and to
implement mock support for testing. Because the CDMInstance will now
be shared between MediaKeys and MediaKeySession, it cannot be a unique_ptr.
Make CDMInterface ref-counted and store it as a Ref.
* Modules/encryptedmedia/CDM.cpp:
(WebCore::CDM::createInstance):
(WebCore::CDM::supportsSessions):
* Modules/encryptedmedia/CDM.h:
* Modules/encryptedmedia/CDMInstance.h:
* Modules/encryptedmedia/CDMPrivate.h:
* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::create):
(WebCore::MediaKeySession::MediaKeySession):
(WebCore::MediaKeySession::sessionId):
(WebCore::MediaKeySession::expiration):
(WebCore::MediaKeySession::keyStatuses):
* Modules/encryptedmedia/MediaKeySession.h:
* Modules/encryptedmedia/MediaKeySessionType.idl:
* Modules/encryptedmedia/MediaKeySystemAccess.cpp:
(WebCore::MediaKeySystemAccess::createMediaKeys):
* Modules/encryptedmedia/MediaKeys.cpp:
(WebCore::MediaKeys::MediaKeys):
(WebCore::MediaKeys::createSession):
* Modules/encryptedmedia/MediaKeys.h:
(WebCore::MediaKeys::create):
* Modules/encryptedmedia/MediaKeys.idl:
LayoutTests:
* media/encrypted-media/mock-MediaKeys-createSession-expected.txt: Added.
* media/encrypted-media/mock-MediaKeys-createSession.html: Added.
* platform/mac/TestExpectations:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaCDMcpp">trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaCDMh">trunk/Source/WebCore/Modules/encryptedmedia/CDM.h</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaCDMInstanceh">trunk/Source/WebCore/Modules/encryptedmedia/CDMInstance.h</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaCDMPrivateh">trunk/Source/WebCore/Modules/encryptedmedia/CDMPrivate.h</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaMediaKeySessioncpp">trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaMediaKeySessionh">trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaMediaKeySessionTypeidl">trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySessionType.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaMediaKeySystemAccesscpp">trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaMediaKeyscpp">trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaMediaKeysh">trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.h</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaMediaKeysidl">trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.idl</a></li>
<li><a href="#trunkSourceWebCoretestingMockCDMFactorycpp">trunk/Source/WebCore/testing/MockCDMFactory.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingMockCDMFactoryh">trunk/Source/WebCore/testing/MockCDMFactory.h</a></li>
<li><a href="#trunkSourceWebCoretestingMockCDMFactoryidl">trunk/Source/WebCore/testing/MockCDMFactory.idl</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmediaencryptedmediamockMediaKeyscreateSessionexpectedtxt">trunk/LayoutTests/media/encrypted-media/mock-MediaKeys-createSession-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediaencryptedmediamockMediaKeyscreateSessionhtml">trunk/LayoutTests/media/encrypted-media/mock-MediaKeys-createSession.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/LayoutTests/ChangeLog        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -1,5 +1,16 @@
</span><span class="cx"> 2017-01-10 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><ins>+ Add support for MediaKeys.createSession().
+ https://bugs.webkit.org/show_bug.cgi?id=166796
+
+ Reviewed by Eric Carlson.
+
+ * media/encrypted-media/mock-MediaKeys-createSession-expected.txt: Added.
+ * media/encrypted-media/mock-MediaKeys-createSession.html: Added.
+ * platform/mac/TestExpectations:
+
+2017-01-10 Jer Noble <jer.noble@apple.com>
+
</ins><span class="cx"> Add support for MediaKeys.setServerCertificate()
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=166772
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsmediaencryptedmediamockMediaKeyscreateSessionexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/encrypted-media/mock-MediaKeys-createSession-expected.txt (0 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/encrypted-media/mock-MediaKeys-createSession-expected.txt         (rev 0)
+++ trunk/LayoutTests/media/encrypted-media/mock-MediaKeys-createSession-expected.txt        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+RUN(internals.initializeMockMediaSource())
+RUN(mock = internals.registerMockCDM())
+RUN(mock.supportedDataTypes = ["mock"])
+RUN(capabilities.initDataTypes = ["mock"])
+RUN(capabilities.videoCapabilities = [{ contentType: 'video/mock; codecs="mock"' }] )
+RUN(promise = navigator.requestMediaKeySystemAccess("org.webkit.mock", [capabilities]))
+Promise resolved OK
+
+RUN(promise = mediaKeySystemAccess.createMediaKeys())
+Promise resolved OK
+
+RUN(mediaKeySession = mediaKeys.createSession("temporary"))
+EXPECTED (typeof mediaKeySession == 'object') OK
+
+RUN(mock.supportedSessionTypes = ["temporary"])
+TEST(mediaKeySession = mediaKeys.createSession("persistent-license")) THROWS(DOMException.NOT_SUPPORTED_ERR) OK
+
+RUN(mock.supportsSessions = false)
+TEST(mediaKeySession = mediaKeys.createSession("temporary")) THROWS(DOMException.INVALID_STATE_ERR) OK
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediaencryptedmediamockMediaKeyscreateSessionhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/encrypted-media/mock-MediaKeys-createSession.html (0 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/encrypted-media/mock-MediaKeys-createSession.html         (rev 0)
+++ trunk/LayoutTests/media/encrypted-media/mock-MediaKeys-createSession.html        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -0,0 +1,109 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src=../video-test.js></script>
+ <script type="text/javascript">
+ var mock;
+ var promise;
+ var mediaKeySystemAccess;
+ var mediaKeys;
+ var mediaKeySession;
+ var capabilities = {};
+
+ function doTest()
+ {
+ if (!window.internals) {
+ failTest("Internals is required for this test.")
+ return;
+ }
+
+ run('internals.initializeMockMediaSource()');
+ run('mock = internals.registerMockCDM()');
+ run('mock.supportedDataTypes = ["mock"]');
+ run('capabilities.initDataTypes = ["mock"]');
+ run(`capabilities.videoCapabilities = [{ contentType: 'video/mock; codecs="mock"' }] `);
+ run('promise = navigator.requestMediaKeySystemAccess("org.webkit.mock", [capabilities])');
+ promise.then(gotMediaKeySystemAccess).catch(failTest);
+ }
+
+ function next() {
+ if (!tests.length) {
+ mock.unregister();
+ endTest()
+ return;
+ }
+
+ var nextTest = tests.shift();
+ consoleWrite('');
+ nextTest();
+ }
+
+ function shouldResolve(promise) {
+ promise.then(mediaKeySystemAccess => {
+ logResult(Success, 'Promise resolved');
+ next();
+ }, () => {
+ logResult(Failed, 'Promise rejected');
+ next();
+ });
+ }
+
+ function shouldReject(promise) {
+ promise.then(() => {
+ logResult(Failed, 'Promise resolved incorrectly');
+ next();
+ }, exceptionCode => {
+ logResult(Success, 'Promise rejected correctly');
+ next();
+ });
+ }
+
+ function gotMediaKeySystemAccess(result) {
+ logResult(Success, 'Promise resolved');
+ mediaKeySystemAccess = result;
+ next();
+ }
+
+ function gotMediaKeys(result) {
+ logResult(Success, 'Promise resolved');
+ mediaKeys = result;
+ next();
+ }
+
+ function stringToUInt8Array(str)
+ {
+ var array = new Uint8Array(str.length);
+ for (var i=0; i<str.length; i++)
+ array[i] = str.charCodeAt(i);
+ return array;
+ }
+
+ tests = [
+ function() {
+ run('promise = mediaKeySystemAccess.createMediaKeys()');
+ promise.then(gotMediaKeys).catch(failTest);
+ },
+
+ function() {
+ run('mediaKeySession = mediaKeys.createSession("temporary")');
+ testExpected('typeof mediaKeySession', 'object')
+ next();
+ },
+
+ function() {
+ run('mock.supportedSessionTypes = ["temporary"]');
+ testDOMException('mediaKeySession = mediaKeys.createSession("persistent-license")', 'DOMException.NOT_SUPPORTED_ERR');
+ next();
+ },
+
+ function() {
+ run('mock.supportsSessions = false');
+ testDOMException('mediaKeySession = mediaKeys.createSession("temporary")', 'DOMException.INVALID_STATE_ERR');
+ next();
+ }
+ ];
+ </script>
+</head>
+<body onload="doTest()">
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/LayoutTests/platform/mac/TestExpectations        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -1468,6 +1468,7 @@
</span><span class="cx"> media/encrypted-media/mock-navigator-requestMediaKeySystemAccess.html [ Skip ]
</span><span class="cx"> media/encrypted-media/mock-MediaKeySystemAccess.html [ Skip ]
</span><span class="cx"> media/encrypted-media/mock-MediaKeys-setServerCertificate.html [ Skip ]
</span><ins>+media/encrypted-media/mock-MediaKeys-createSession.html [ Skip ]
</ins><span class="cx">
</span><span class="cx"> webkit.org/b/166025 http/tests/fetch/fetching-same-resource-with-diffferent-options.html [ Pass Failure ]
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/Source/WebCore/ChangeLog        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -1,5 +1,43 @@
</span><span class="cx"> 2017-01-10 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><ins>+ Add support for MediaKeys.createSession().
+ https://bugs.webkit.org/show_bug.cgi?id=166796
+
+ Reviewed by Eric Carlson.
+
+ Test: media/encrypted-media/mock-MediaKeys-createSession.html
+
+ Implement MediaKeys::createSession(). This requires some additions to
+ CDM, CDMPrivate, and CDMInstance to support platform adoption and to
+ implement mock support for testing. Because the CDMInstance will now
+ be shared between MediaKeys and MediaKeySession, it cannot be a unique_ptr.
+ Make CDMInterface ref-counted and store it as a Ref.
+
+ * Modules/encryptedmedia/CDM.cpp:
+ (WebCore::CDM::createInstance):
+ (WebCore::CDM::supportsSessions):
+ * Modules/encryptedmedia/CDM.h:
+ * Modules/encryptedmedia/CDMInstance.h:
+ * Modules/encryptedmedia/CDMPrivate.h:
+ * Modules/encryptedmedia/MediaKeySession.cpp:
+ (WebCore::MediaKeySession::create):
+ (WebCore::MediaKeySession::MediaKeySession):
+ (WebCore::MediaKeySession::sessionId):
+ (WebCore::MediaKeySession::expiration):
+ (WebCore::MediaKeySession::keyStatuses):
+ * Modules/encryptedmedia/MediaKeySession.h:
+ * Modules/encryptedmedia/MediaKeySessionType.idl:
+ * Modules/encryptedmedia/MediaKeySystemAccess.cpp:
+ (WebCore::MediaKeySystemAccess::createMediaKeys):
+ * Modules/encryptedmedia/MediaKeys.cpp:
+ (WebCore::MediaKeys::MediaKeys):
+ (WebCore::MediaKeys::createSession):
+ * Modules/encryptedmedia/MediaKeys.h:
+ (WebCore::MediaKeys::create):
+ * Modules/encryptedmedia/MediaKeys.idl:
+
+2017-01-10 Jer Noble <jer.noble@apple.com>
+
</ins><span class="cx"> Add support for MediaKeys.setServerCertificate()
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=166772
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaCDMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -617,7 +617,7 @@
</span><span class="cx"> m_private->loadAndInitialize();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-std::unique_ptr<CDMInstance> CDM::createInstance()
</del><ins>+RefPtr<CDMInstance> CDM::createInstance()
</ins><span class="cx"> {
</span><span class="cx"> if (!m_private)
</span><span class="cx"> return nullptr;
</span><span class="lines">@@ -629,6 +629,11 @@
</span><span class="cx"> return m_private && m_private->supportsServerCertificates();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool CDM::supportsSessions() const
+{
+ return m_private && m_private->supportsSessions();
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaCDMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDM.h (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/CDM.h        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDM.h        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -70,8 +70,9 @@
</span><span class="cx"> const String& keySystem() const { return m_keySystem; }
</span><span class="cx">
</span><span class="cx"> void loadAndInitialize();
</span><del>- std::unique_ptr<CDMInstance> createInstance();
</del><ins>+ RefPtr<CDMInstance> createInstance();
</ins><span class="cx"> bool supportsServerCertificates() const;
</span><ins>+ bool supportsSessions() const;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> CDM(Document&, const String& keySystem);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaCDMInstanceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDMInstance.h (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/CDMInstance.h        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDMInstance.h        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #if ENABLE(ENCRYPTED_MEDIA)
</span><span class="cx">
</span><span class="cx"> #include <wtf/Forward.h>
</span><ins>+#include <wtf/RefCounted.h>
</ins><span class="cx">
</span><span class="cx"> namespace JSC {
</span><span class="cx"> class ArrayBuffer;
</span><span class="lines">@@ -37,7 +38,7 @@
</span><span class="cx">
</span><span class="cx"> struct MediaKeySystemConfiguration;
</span><span class="cx">
</span><del>-class CDMInstance {
</del><ins>+class CDMInstance : public RefCounted<CDMInstance> {
</ins><span class="cx"> public:
</span><span class="cx"> virtual ~CDMInstance() { }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaCDMPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDMPrivate.h (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/CDMPrivate.h        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDMPrivate.h        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -49,9 +49,10 @@
</span><span class="cx"> virtual MediaKeysRequirement distinctiveIdentifiersRequirement(const MediaKeySystemConfiguration&, const MediaKeysRestrictions&) = 0;
</span><span class="cx"> virtual MediaKeysRequirement persistentStateRequirement(const MediaKeySystemConfiguration&, const MediaKeysRestrictions&) = 0;
</span><span class="cx"> virtual bool distinctiveIdentifiersAreUniquePerOriginAndClearable(const MediaKeySystemConfiguration&) = 0;
</span><del>- virtual std::unique_ptr<CDMInstance> createInstance() = 0;
</del><ins>+ virtual RefPtr<CDMInstance> createInstance() = 0;
</ins><span class="cx"> virtual void loadAndInitialize() = 0;
</span><span class="cx"> virtual bool supportsServerCertificates() const = 0;
</span><ins>+ virtual bool supportsSessions() const = 0;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaMediaKeySessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -31,21 +31,50 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(ENCRYPTED_MEDIA)
</span><span class="cx">
</span><ins>+#include "CDM.h"
+#include "CDMInstance.h"
</ins><span class="cx"> #include "MediaKeyStatusMap.h"
</span><span class="cx"> #include "NotImplemented.h"
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-Ref<MediaKeySession> MediaKeySession::create(ScriptExecutionContext& context)
</del><ins>+Ref<MediaKeySession> MediaKeySession::create(ScriptExecutionContext& context, MediaKeySessionType sessionType, bool useDistinctiveIdentifier, Ref<CDM>&& implementation, Ref<CDMInstance>&& instance)
</ins><span class="cx"> {
</span><del>- auto session = adoptRef(*new MediaKeySession(context));
</del><ins>+ auto session = adoptRef(*new MediaKeySession(context, sessionType, useDistinctiveIdentifier, WTFMove(implementation), WTFMove(instance)));
</ins><span class="cx"> session->suspendIfNeeded();
</span><span class="cx"> return session;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-MediaKeySession::MediaKeySession(ScriptExecutionContext& context)
</del><ins>+MediaKeySession::MediaKeySession(ScriptExecutionContext& context, MediaKeySessionType sessionType, bool useDistinctiveIdentifier, Ref<CDM>&& implementation, Ref<CDMInstance>&& instance)
</ins><span class="cx"> : ActiveDOMObject(&context)
</span><ins>+ , m_expiration(std::numeric_limits<double>::quiet_NaN())
+ , m_keyStatuses(MediaKeyStatusMap::create())
+ , m_useDistinctiveIdentifier(useDistinctiveIdentifier)
+ , m_sessionType(sessionType)
+ , m_implementation(WTFMove(implementation))
+ , m_instance(WTFMove(instance))
</ins><span class="cx"> {
</span><ins>+ // https://w3c.github.io/encrypted-media/#dom-mediakeys-setservercertificate
+ // W3C Editor's Draft 09 November 2016
+ // createSession(), ctd.
+
+ // 3.1. Let the sessionId attribute be the empty string.
+ // 3.2. Let the expiration attribute be NaN.
+ // 3.3. Let the closed attribute be a new promise.
+ // 3.4. Let key status be a new empty MediaKeyStatusMap object, and initialize it as follows:
+ // 3.4.1. Let the size attribute be 0.
+ // 3.5. Let the session type value be sessionType.
+ // 3.6. Let the uninitialized value be true.
+ // 3.7. Let the callable value be false.
+ // 3.8. Let the use distinctive identifier value be this object's use distinctive identifier value.
+ // 3.9. Let the cdm implementation value be this object's cdm implementation.
+ // 3.10. Let the cdm instance value be this object's cdm instance.
+
+ UNUSED_PARAM(m_callable);
+ UNUSED_PARAM(m_sessionType);
+ UNUSED_PARAM(m_useDistinctiveIdentifier);
+ UNUSED_PARAM(m_closed);
+ UNUSED_PARAM(m_uninitialized);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> MediaKeySession::~MediaKeySession() = default;
</span><span class="lines">@@ -52,20 +81,17 @@
</span><span class="cx">
</span><span class="cx"> const String& MediaKeySession::sessionId() const
</span><span class="cx"> {
</span><del>- notImplemented();
- return emptyString();
</del><ins>+ return m_sessionId;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double MediaKeySession::expiration() const
</span><span class="cx"> {
</span><del>- notImplemented();
- return 0;
</del><ins>+ return m_expiration;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<MediaKeyStatusMap> MediaKeySession::keyStatuses() const
</del><ins>+Ref<MediaKeyStatusMap> MediaKeySession::keyStatuses() const
</ins><span class="cx"> {
</span><del>- notImplemented();
- return nullptr;
</del><ins>+ return m_keyStatuses.copyRef();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MediaKeySession::generateRequest(const String&, const BufferSource&, Ref<DeferredPromise>&&)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaMediaKeySessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -41,12 +41,14 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class BufferSource;
</span><ins>+class CDM;
+class CDMInstance;
</ins><span class="cx"> class MediaKeyStatusMap;
</span><span class="cx"> class MediaKeys;
</span><span class="cx">
</span><span class="cx"> class MediaKeySession final : public RefCounted<MediaKeySession>, public EventTargetWithInlineData, public ActiveDOMObject {
</span><span class="cx"> public:
</span><del>- static Ref<MediaKeySession> create(ScriptExecutionContext&);
</del><ins>+ static Ref<MediaKeySession> create(ScriptExecutionContext&, MediaKeySessionType, bool useDistinctiveIdentifier, Ref<CDM>&&, Ref<CDMInstance>&&);
</ins><span class="cx"> virtual ~MediaKeySession();
</span><span class="cx">
</span><span class="cx"> using RefCounted<MediaKeySession>::ref;
</span><span class="lines">@@ -54,7 +56,7 @@
</span><span class="cx">
</span><span class="cx"> const String& sessionId() const;
</span><span class="cx"> double expiration() const;
</span><del>- RefPtr<MediaKeyStatusMap> keyStatuses() const;
</del><ins>+ Ref<MediaKeyStatusMap> keyStatuses() const;
</ins><span class="cx">
</span><span class="cx"> void generateRequest(const String&, const BufferSource&, Ref<DeferredPromise>&&);
</span><span class="cx"> void load(const String&, Ref<DeferredPromise>&&);
</span><span class="lines">@@ -63,7 +65,7 @@
</span><span class="cx"> void remove(Ref<DeferredPromise>&&);
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- MediaKeySession(ScriptExecutionContext&);
</del><ins>+ MediaKeySession(ScriptExecutionContext&, MediaKeySessionType, bool useDistinctiveIdentifier, Ref<CDM>&&, Ref<CDMInstance>&&);
</ins><span class="cx">
</span><span class="cx"> // EventTarget
</span><span class="cx"> EventTargetInterface eventTargetInterface() const override { return MediaKeySessionEventTargetInterfaceType; }
</span><span class="lines">@@ -76,6 +78,17 @@
</span><span class="cx"> const char* activeDOMObjectName() const override;
</span><span class="cx"> bool canSuspendForDocumentSuspension() const override;
</span><span class="cx"> void stop() override;
</span><ins>+
+ String m_sessionId;
+ double m_expiration;
+ Ref<MediaKeyStatusMap> m_keyStatuses;
+ bool m_closed { false };
+ bool m_uninitialized { true };
+ bool m_callable { false };
+ bool m_useDistinctiveIdentifier;
+ MediaKeySessionType m_sessionType;
+ Ref<CDM> m_implementation;
+ Ref<CDMInstance> m_instance;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaMediaKeySessionTypeidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySessionType.idl (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySessionType.idl        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySessionType.idl        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -25,7 +25,8 @@
</span><span class="cx">
</span><span class="cx"> [
</span><span class="cx"> Conditional=ENCRYPTED_MEDIA,
</span><del>- ImplementedAs=MediaKeySessionType
</del><ins>+ ImplementedAs=MediaKeySessionType,
+ ExportMacro=WEBCORE_TESTSUPPORT_EXPORT
</ins><span class="cx"> ]
</span><span class="cx"> enum MediaKeySessionType {
</span><span class="cx"> "temporary",
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaMediaKeySystemAccesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.cpp (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.cpp        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.cpp        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -105,7 +105,7 @@
</span><span class="cx"> // 2.10.3. Let the supported session types value be be the value of configuration's sessionTypes member.
</span><span class="cx"> // 2.10.4. Let the cdm implementation value be this object's cdm implementation value.
</span><span class="cx"> // 2.10.5. Let the cdm instance value be instance.
</span><del>- auto mediaKeys = MediaKeys::create(useDistinctiveIdentifier, persistentStateAllowed, m_configuration->sessionTypes, m_implementation.copyRef(), WTFMove(instance));
</del><ins>+ auto mediaKeys = MediaKeys::create(useDistinctiveIdentifier, persistentStateAllowed, m_configuration->sessionTypes, m_implementation.copyRef(), instance.releaseNonNull());
</ins><span class="cx">
</span><span class="cx"> // 2.11. Resolve promise with media keys.
</span><span class="cx"> promise->resolveWithNewlyCreated<IDLInterface<MediaKeys>>(WTFMove(mediaKeys));
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaMediaKeyscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-MediaKeys::MediaKeys(bool useDistinctiveIdentifier, bool persistentStateAllowed, const Vector<MediaKeySessionType>& supportedSessionTypes, Ref<CDM>&& implementation, std::unique_ptr<CDMInstance>&& instance)
</del><ins>+MediaKeys::MediaKeys(bool useDistinctiveIdentifier, bool persistentStateAllowed, const Vector<MediaKeySessionType>& supportedSessionTypes, Ref<CDM>&& implementation, Ref<CDMInstance>&& instance)
</ins><span class="cx"> : m_useDistinctiveIdentifier(useDistinctiveIdentifier)
</span><span class="cx"> , m_persistentStateAllowed(persistentStateAllowed)
</span><span class="cx"> , m_supportedSessionTypes(supportedSessionTypes)
</span><span class="lines">@@ -50,10 +50,24 @@
</span><span class="cx">
</span><span class="cx"> MediaKeys::~MediaKeys() = default;
</span><span class="cx">
</span><del>-ExceptionOr<Ref<MediaKeySession>> MediaKeys::createSession(MediaKeySessionType)
</del><ins>+ExceptionOr<Ref<MediaKeySession>> MediaKeys::createSession(ScriptExecutionContext& context, MediaKeySessionType sessionType)
</ins><span class="cx"> {
</span><del>- notImplemented();
- return Exception { NOT_SUPPORTED_ERR };
</del><ins>+ // https://w3c.github.io/encrypted-media/#dom-mediakeys-setservercertificate
+ // W3C Editor's Draft 09 November 2016
+
+ // When this method is invoked, the user agent must run the following steps:
+ // 1. If this object's supported session types value does not contain sessionType, throw [WebIDL] a NotSupportedError.
+ if (!m_supportedSessionTypes.contains(sessionType))
+ return Exception(NOT_SUPPORTED_ERR);
+
+ // 2. If the implementation does not support MediaKeySession operations in the current state, throw [WebIDL] an InvalidStateError.
+ if (!m_implementation->supportsSessions())
+ return Exception(INVALID_STATE_ERR);
+
+ // 3. Let session be a new MediaKeySession object, and initialize it as follows:
+ // NOTE: Continued in MediaKeySession.
+ // 4. Return session.
+ return MediaKeySession::create(context, sessionType, m_useDistinctiveIdentifier, m_implementation.copyRef(), m_instance.copyRef());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MediaKeys::setServerCertificate(const BufferSource& serverCertificate, Ref<DeferredPromise>&& promise)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaMediaKeysh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.h (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.h        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.h        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx"> public:
</span><span class="cx"> using KeySessionType = MediaKeySessionType;
</span><span class="cx">
</span><del>- static Ref<MediaKeys> create(bool useDistinctiveIdentifier, bool persistentStateAllowed, const Vector<MediaKeySessionType>& supportedSessionTypes, Ref<CDM>&& implementation, std::unique_ptr<CDMInstance>&& instance)
</del><ins>+ static Ref<MediaKeys> create(bool useDistinctiveIdentifier, bool persistentStateAllowed, const Vector<MediaKeySessionType>& supportedSessionTypes, Ref<CDM>&& implementation, Ref<CDMInstance>&& instance)
</ins><span class="cx"> {
</span><span class="cx"> return adoptRef(*new MediaKeys(useDistinctiveIdentifier, persistentStateAllowed, supportedSessionTypes, WTFMove(implementation), WTFMove(instance)));
</span><span class="cx"> }
</span><span class="lines">@@ -55,18 +55,18 @@
</span><span class="cx">
</span><span class="cx"> ~MediaKeys();
</span><span class="cx">
</span><del>- ExceptionOr<Ref<MediaKeySession>> createSession(MediaKeySessionType);
</del><ins>+ ExceptionOr<Ref<MediaKeySession>> createSession(ScriptExecutionContext&, MediaKeySessionType);
</ins><span class="cx">
</span><span class="cx"> void setServerCertificate(const BufferSource&, Ref<DeferredPromise>&&);
</span><span class="cx">
</span><span class="cx"> protected:
</span><del>- MediaKeys(bool useDistinctiveIdentifier, bool persistentStateAllowed, const Vector<MediaKeySessionType>&, Ref<CDM>&&, std::unique_ptr<CDMInstance>&&);
</del><ins>+ MediaKeys(bool useDistinctiveIdentifier, bool persistentStateAllowed, const Vector<MediaKeySessionType>&, Ref<CDM>&&, Ref<CDMInstance>&&);
</ins><span class="cx">
</span><span class="cx"> bool m_useDistinctiveIdentifier;
</span><span class="cx"> bool m_persistentStateAllowed;
</span><span class="cx"> Vector<MediaKeySessionType> m_supportedSessionTypes;
</span><span class="cx"> Ref<CDM> m_implementation;
</span><del>- std::unique_ptr<CDMInstance> m_instance;
</del><ins>+ Ref<CDMInstance> m_instance;
</ins><span class="cx"> GenericTaskQueue<Timer> m_taskQueue;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaMediaKeysidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.idl (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.idl        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.idl        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -31,6 +31,6 @@
</span><span class="cx"> EnabledAtRuntime=EncryptedMediaAPI,
</span><span class="cx"> ImplementationLacksVTable,
</span><span class="cx"> ] interface MediaKeys {
</span><del>- [MayThrowException] MediaKeySession createSession(optional MediaKeySessionType sessionType = "temporary");
</del><ins>+ [CallWith=ScriptExecutionContext, MayThrowException] MediaKeySession createSession(optional MediaKeySessionType sessionType = "temporary");
</ins><span class="cx"> Promise<bool> setServerCertificate(BufferSource serverCertificate);
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockCDMFactorycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockCDMFactory.cpp (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockCDMFactory.cpp        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/Source/WebCore/testing/MockCDMFactory.cpp        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -34,7 +34,8 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> MockCDMFactory::MockCDMFactory()
</span><del>- : m_weakPtrFactory(this)
</del><ins>+ : m_supportedSessionTypes({ MediaKeySessionType::Temporary, MediaKeySessionType::PersistentUsageRecord, MediaKeySessionType::PersistentLicense })
+ , m_weakPtrFactory(this)
</ins><span class="cx"> {
</span><span class="cx"> CDM::registerCDMFactory(*this);
</span><span class="cx"> }
</span><span class="lines">@@ -88,9 +89,12 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool MockCDM::supportsSessionTypeWithConfiguration(MediaKeySessionType&, const MediaKeySystemConfiguration&)
</del><ins>+bool MockCDM::supportsSessionTypeWithConfiguration(MediaKeySessionType& sessionType, const MediaKeySystemConfiguration&)
</ins><span class="cx"> {
</span><del>- // NOTE: Implement;
</del><ins>+ if (!m_factory || !m_factory->supportedSessionTypes().contains(sessionType))
+ return false;
+
+ // NOTE: Implement configuration checking;
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -121,11 +125,11 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-std::unique_ptr<CDMInstance> MockCDM::createInstance()
</del><ins>+RefPtr<CDMInstance> MockCDM::createInstance()
</ins><span class="cx"> {
</span><span class="cx"> if (m_factory && !m_factory->canCreateInstances())
</span><span class="cx"> return nullptr;
</span><del>- return std::unique_ptr<CDMInstance>(new MockCDMInstance(m_weakPtrFactory.createWeakPtr()));
</del><ins>+ return adoptRef(new MockCDMInstance(m_weakPtrFactory.createWeakPtr()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MockCDM::loadAndInitialize()
</span><span class="lines">@@ -138,6 +142,11 @@
</span><span class="cx"> return m_factory && m_factory->supportsServerCertificates();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool MockCDM::supportsSessions() const
+{
+ return m_factory && m_factory->supportsSessions();
+}
+
</ins><span class="cx"> MockCDMInstance::MockCDMInstance(WeakPtr<MockCDM> cdm)
</span><span class="cx"> : m_cdm(cdm)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockCDMFactoryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockCDMFactory.h (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockCDMFactory.h        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/Source/WebCore/testing/MockCDMFactory.h        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -45,6 +45,9 @@
</span><span class="cx"> const Vector<String>& supportedDataTypes() const { return m_supportedDataTypes; }
</span><span class="cx"> void setSupportedDataTypes(Vector<String>&& types) { m_supportedDataTypes = WTFMove(types); }
</span><span class="cx">
</span><ins>+ const Vector<MediaKeySessionType>& supportedSessionTypes() const { return m_supportedSessionTypes; }
+ void setSupportedSessionTypes(Vector<MediaKeySessionType>&& types) { m_supportedSessionTypes = WTFMove(types); }
+
</ins><span class="cx"> const Vector<String>& supportedRobustness() const { return m_supportedRobustness; }
</span><span class="cx"> void setSupportedRobustness(Vector<String>&& robustness) { m_supportedRobustness = WTFMove(robustness); }
</span><span class="cx">
</span><span class="lines">@@ -60,6 +63,9 @@
</span><span class="cx"> bool supportsServerCertificates() const { return m_supportsServerCertificates; }
</span><span class="cx"> void setSupportsServerCertificates(bool flag) { m_supportsServerCertificates = flag; }
</span><span class="cx">
</span><ins>+ bool supportsSessions() const { return m_supportsSessions; }
+ void setSupportsSessions(bool flag) { m_supportsSessions = flag; }
+
</ins><span class="cx"> void unregister();
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="lines">@@ -70,10 +76,12 @@
</span><span class="cx"> MediaKeysRequirement m_distinctiveIdentifiersRequirement { MediaKeysRequirement::Optional };
</span><span class="cx"> MediaKeysRequirement m_persistentStateRequirement { MediaKeysRequirement::Optional };
</span><span class="cx"> Vector<String> m_supportedDataTypes;
</span><ins>+ Vector<MediaKeySessionType> m_supportedSessionTypes;
</ins><span class="cx"> Vector<String> m_supportedRobustness;
</span><span class="cx"> bool m_registered { true };
</span><span class="cx"> bool m_canCreateInstances { true };
</span><span class="cx"> bool m_supportsServerCertificates { true };
</span><ins>+ bool m_supportsSessions { true };
</ins><span class="cx"> WeakPtrFactory<MockCDMFactory> m_weakPtrFactory;
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -94,9 +102,10 @@
</span><span class="cx"> MediaKeysRequirement distinctiveIdentifiersRequirement(const MediaKeySystemConfiguration&, const MediaKeysRestrictions&) final;
</span><span class="cx"> MediaKeysRequirement persistentStateRequirement(const MediaKeySystemConfiguration&, const MediaKeysRestrictions&) final;
</span><span class="cx"> bool distinctiveIdentifiersAreUniquePerOriginAndClearable(const MediaKeySystemConfiguration&) final;
</span><del>- std::unique_ptr<CDMInstance> createInstance() final;
</del><ins>+ RefPtr<CDMInstance> createInstance() final;
</ins><span class="cx"> void loadAndInitialize() final;
</span><span class="cx"> bool supportsServerCertificates() const final;
</span><ins>+ bool supportsSessions() const final;
</ins><span class="cx">
</span><span class="cx"> WeakPtr<MockCDMFactory> m_factory;
</span><span class="cx"> WeakPtrFactory<MockCDM> m_weakPtrFactory;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingMockCDMFactoryidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/MockCDMFactory.idl (210551 => 210552)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/MockCDMFactory.idl        2017-01-10 18:05:07 UTC (rev 210551)
+++ trunk/Source/WebCore/testing/MockCDMFactory.idl        2017-01-10 18:41:31 UTC (rev 210552)
</span><span class="lines">@@ -30,10 +30,12 @@
</span><span class="cx"> ] interface MockCDMFactory {
</span><span class="cx"> attribute sequence<DOMString> supportedDataTypes;
</span><span class="cx"> attribute sequence<DOMString> supportedRobustness;
</span><ins>+ attribute sequence<MediaKeySessionType> supportedSessionTypes;
</ins><span class="cx"> attribute MediaKeysRequirement distinctiveIdentifiersRequirement;
</span><span class="cx"> attribute MediaKeysRequirement persistentStateRequirement;
</span><span class="cx"> attribute boolean canCreateInstances;
</span><span class="cx"> attribute boolean supportsServerCertificates;
</span><ins>+ attribute boolean supportsSessions;
</ins><span class="cx">
</span><span class="cx"> void unregister();
</span><span class="cx"> };
</span></span></pre>
</div>
</div>
</body>
</html>