2009-07-19 Eric Carlson <eric.carlson@apple.com>
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 19 Jul 2009 18:16:00 +0000 (18:16 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 19 Jul 2009 18:16:00 +0000 (18:16 +0000)
        Reviewed by Dan Bernstein.

        HTMLAudioElement: constructor should set "autobuffer" attribute
        https://bugs.webkit.org/show_bug.cgi?id=27422

        Test: media/audio-constructor-autobuffer.html

        * bindings/js/JSAudioConstructor.cpp:
        (WebCore::constructAudio):
            Set 'autobuffer' attribute.

2009-07-19  Eric Carlson  <eric.carlson@apple.com>

        Reviewed by Dan Bernstein.

        HTMLAudioElement: constructor should set "autobuffer" attribute
        https://bugs.webkit.org/show_bug.cgi?id=27422

        * media/audio-constructor-autobuffer-expected.txt: Added.
        * media/audio-constructor-autobuffer.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/media/audio-constructor-autobuffer-expected.txt [new file with mode: 0644]
LayoutTests/media/audio-constructor-autobuffer.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/bindings/js/JSAudioConstructor.cpp

index de95957..76d3484 100644 (file)
@@ -1,3 +1,13 @@
+2009-07-19  Eric Carlson  <eric.carlson@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        HTMLAudioElement: constructor should set "autobuffer" attribute
+        https://bugs.webkit.org/show_bug.cgi?id=27422
+
+        * media/audio-constructor-autobuffer-expected.txt: Added.
+        * media/audio-constructor-autobuffer.html: Added.
+
 2009-07-18  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Anders Carlsson.
diff --git a/LayoutTests/media/audio-constructor-autobuffer-expected.txt b/LayoutTests/media/audio-constructor-autobuffer-expected.txt
new file mode 100644 (file)
index 0000000..5902e81
--- /dev/null
@@ -0,0 +1,16 @@
+Test that Audio() sets 'autobuffer' attribute.
+
+RUN(media = new Audio())
+
+++ Test initial attribute value
+EXPECTED (media.getAttribute('autobuffer') != 'null') OK
+EXPECTED (media.autobuffer == 'true') OK
+
+RUN(media.src = 'content/test.wav')
+RUN(media.load())
+
+++ Test after 'load' event
+EXPECTED (media.getAttribute('autobuffer') != 'null') OK
+EXPECTED (media.autobuffer == 'true') OK
+END OF TEST
+
diff --git a/LayoutTests/media/audio-constructor-autobuffer.html b/LayoutTests/media/audio-constructor-autobuffer.html
new file mode 100644 (file)
index 0000000..c9bd9cd
--- /dev/null
@@ -0,0 +1,38 @@
+<html>
+    <head>
+        <script src=video-test.js></script>
+
+        <script>
+
+            function loaded()
+            {
+                consoleWrite("++ Test after 'load' event");
+                testExpected("media.getAttribute('autobuffer')", null, "!=");
+                testExpected("media.autobuffer", true);
+                endTest();
+            }
+
+            function start()
+            {
+                run("media = new Audio()");
+                consoleWrite("");
+
+                consoleWrite("++ Test initial attribute value");
+                testExpected("media.getAttribute('autobuffer')", null, "!=");
+                testExpected("media.autobuffer", true);
+                consoleWrite("");
+
+                media.onload = loaded;
+                run("media.src = 'content/test.wav'");
+                run("media.load()");
+
+                consoleWrite("");
+            }
+
+        </script>
+    </head>
+
+    <body onload="start()">
+        <p>Test that Audio() sets 'autobuffer' attribute.</p>
+    </body>
+</html>
index 1d44d49..263e670 100644 (file)
@@ -1,3 +1,16 @@
+2009-07-19  Eric Carlson  <eric.carlson@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        HTMLAudioElement: constructor should set "autobuffer" attribute
+        https://bugs.webkit.org/show_bug.cgi?id=27422
+
+        Test: media/audio-constructor-autobuffer.html
+
+        * bindings/js/JSAudioConstructor.cpp:
+        (WebCore::constructAudio):
+            Set 'autobuffer' attribute.
+
 2009-07-19  Thierry Bastian <thierry.bastian@nokia.com>
 
         Reviewed by Simon Hausmann.
index 038e908..da35bb1 100644 (file)
@@ -66,6 +66,7 @@ static JSObject* constructAudio(ExecState* exec, JSObject* constructor, const Ar
         return throwError(exec, ReferenceError, "Audio constructor associated document is unavailable");
 
     RefPtr<HTMLAudioElement> audio = new HTMLAudioElement(HTMLNames::audioTag, document);
+    audio->setAutobuffer(true);
     if (args.size() > 0) {
         audio->setSrc(args.at(0).toString(exec));
         audio->scheduleLoad();