Commit c7f0bd90 authored by tommyw@google.com's avatar tommyw@google.com

MediaStream API: Update MediaStreamTrack::readyState to match specification

https://bugs.webkit.org/show_bug.cgi?id=106781

Reviewed by Adam Barth.

Source/WebCore:

MediaStreamTrack::readyState now returns a string like the rest of the RTC classes.

Existing tests expanded to cover patch.

* Modules/mediastream/MediaStream.cpp:
(WebCore::processTrack):
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::readyState):
(WebCore::MediaStreamTrack::ended):
(WebCore):
* Modules/mediastream/MediaStreamTrack.h:
(MediaStreamTrack):
* Modules/mediastream/MediaStreamTrack.idl:

LayoutTests:

* fast/mediastream/MediaStreamTrack-expected.txt:
* fast/mediastream/MediaStreamTrack.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@139618 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 62428106
2013-01-14 Tommy Widenflycht <tommyw@google.com>
MediaStream API: Update MediaStreamTrack::readyState to match specification
https://bugs.webkit.org/show_bug.cgi?id=106781
Reviewed by Adam Barth.
* fast/mediastream/MediaStreamTrack-expected.txt:
* fast/mediastream/MediaStreamTrack.html:
2013-01-14 Andrey Lushnikov <lushnikov@chromium.org>
Web Inspector: add text editor formatter test
......@@ -4,9 +4,13 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS getUserMedia succeeded.
PASS track.readyState is "live"
PASS Track onmute callback succeeded.
PASS track.readyState is "muted"
PASS Track onunmute callback succeeded.
PASS track.readyState is "live"
PASS Track onended callback succeeded.
PASS track.readyState is "ended"
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -34,18 +34,24 @@ function getUserMedia(constraints, callback) {
function onTrackEnded() {
testPassed('Track onended callback succeeded.');
shouldBeEqualToString('track.readyState', 'ended');
finishJSTest();
}
function onTrackUnmute() {
testPassed('Track onunmute callback succeeded.');
shouldBeEqualToString('track.readyState', 'live');
stream.stop();
}
function onTrackMute() {
testPassed('Track onmute callback succeeded.');
shouldBeEqualToString('track.readyState', 'muted');
track.enabled = true;
}
......@@ -55,6 +61,8 @@ function gotStream(s) {
stream = s;
track = stream.getVideoTracks()[0];
shouldBeEqualToString('track.readyState', 'live');
track.onunmute = onTrackUnmute;
track.onmute = onTrackMute;
track.onended = onTrackEnded;
......
2013-01-14 Tommy Widenflycht <tommyw@google.com>
MediaStream API: Update MediaStreamTrack::readyState to match specification
https://bugs.webkit.org/show_bug.cgi?id=106781
Reviewed by Adam Barth.
MediaStreamTrack::readyState now returns a string like the rest of the RTC classes.
Existing tests expanded to cover patch.
* Modules/mediastream/MediaStream.cpp:
(WebCore::processTrack):
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::readyState):
(WebCore::MediaStreamTrack::ended):
(WebCore):
* Modules/mediastream/MediaStreamTrack.h:
(MediaStreamTrack):
* Modules/mediastream/MediaStreamTrack.idl:
2013-01-14 Vsevolod Vlasov <vsevik@chromium.org>
Web Inspector: Audit Tool's False Positive on Set-Cookie header
......@@ -48,7 +48,7 @@ static bool containsSource(MediaStreamSourceVector& sourceVector, MediaStreamSou
static void processTrack(MediaStreamTrack* track, MediaStreamSourceVector& sourceVector)
{
if (track->readyState() == MediaStreamTrack::ENDED)
if (track->ended())
return;
MediaStreamSource* source = track->component()->source();
......
......@@ -99,24 +99,30 @@ void MediaStreamTrack::setEnabled(bool enabled)
MediaStreamCenter::instance().didSetMediaStreamTrackEnabled(m_streamDescriptor.get(), m_component.get());
}
MediaStreamTrack::ReadyState MediaStreamTrack::readyState() const
String MediaStreamTrack::readyState() const
{
if (m_stopped)
return ENDED;
return ASCIILiteral("ended");
switch (m_component->source()->readyState()) {
case MediaStreamSource::ReadyStateLive:
return LIVE;
return ASCIILiteral("live");
case MediaStreamSource::ReadyStateMuted:
return MUTED;
return ASCIILiteral("muted");
case MediaStreamSource::ReadyStateEnded:
return ENDED;
return ASCIILiteral("ended");
}
ASSERT_NOT_REACHED();
return ENDED;
return String();
}
bool MediaStreamTrack::ended() const
{
return m_stopped || (m_component->source()->readyState() == MediaStreamSource::ReadyStateEnded);
}
void MediaStreamTrack::sourceChangedState()
{
if (m_stopped)
......
......@@ -43,12 +43,6 @@ class MediaStreamComponent;
class MediaStreamTrack : public RefCounted<MediaStreamTrack>, public ActiveDOMObject, public EventTarget, public MediaStreamSource::Observer {
public:
enum ReadyState {
LIVE = 0,
MUTED = 1,
ENDED = 2
};
static PassRefPtr<MediaStreamTrack> create(ScriptExecutionContext*, PassRefPtr<MediaStreamDescriptor>, MediaStreamComponent*);
virtual ~MediaStreamTrack();
......@@ -59,7 +53,7 @@ public:
bool enabled() const;
void setEnabled(bool);
ReadyState readyState() const;
String readyState() const;
DEFINE_ATTRIBUTE_EVENT_LISTENER(mute);
DEFINE_ATTRIBUTE_EVENT_LISTENER(unmute);
......@@ -67,6 +61,7 @@ public:
MediaStreamDescriptor* streamDescriptor();
MediaStreamComponent* component();
bool ended() const;
// EventTarget
virtual const AtomicString& interfaceName() const OVERRIDE;
......
......@@ -32,10 +32,7 @@
readonly attribute DOMString label;
attribute boolean enabled;
const unsigned short LIVE = 0;
const unsigned short MUTED = 1;
const unsigned short ENDED = 2;
readonly attribute unsigned short readyState;
readonly attribute DOMString readyState;
attribute EventListener onmute;
attribute EventListener onunmute;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment