Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Commit

Permalink
[#1123] Popcorn Media Wrappers: YouTube, Vimeo, SoundCloud, Audio, Vi…
Browse files Browse the repository at this point in the history
…deo, and Null Video, with tests.
  • Loading branch information
humphd committed Aug 7, 2012
1 parent f4b273c commit a1b7db6
Show file tree
Hide file tree
Showing 21 changed files with 3,460 additions and 12 deletions.
37 changes: 33 additions & 4 deletions Makefile
@@ -1,4 +1,3 @@

PREFIX = .
BUILD_DIR = ${PREFIX}/build
DIST_DIR = ${PREFIX}/dist
Expand All @@ -7,6 +6,7 @@ PARSERS_DIR = ${PREFIX}/parsers
PLAYERS_DIR = ${PREFIX}/players
EFFECTS_DIR = $(PREFIX)/effects
MODULES_DIR = $(PREFIX)/modules
WRAPPERS_DIR = $(PREFIX)/wrappers
IE8_DIR = $(PREFIX)/ie8

# Version number used in naming release files. Defaults to git commit sha.
Expand All @@ -33,6 +33,10 @@ POPCORN_MIN = ${DIST_DIR}/popcorn.min.js
MODULES_DIST = ${DIST_DIR}/popcorn.modules.js
MODULES_MIN = ${DIST_DIR}/popcorn.modules.min.js

# wrappers
WRAPPERS_DIST = ${DIST_DIR}/popcorn.wrappers.js
WRAPPERS_MIN = ${DIST_DIR}/popcorn.wrappers.min.js

# plugins
PLUGINS_DIST = ${DIST_DIR}/popcorn.plugins.js
PLUGINS_MIN = ${DIST_DIR}/popcorn.plugins.min.js
Expand Down Expand Up @@ -64,6 +68,9 @@ EFFECTS_SRC := $(filter-out %unit.js, $(shell find $(EFFECTS_DIR) -name 'popcorn
# Grab all popcorn.<Module-name>.js files from modules dir
MODULES_SRC := $(filter-out %unit.js, $(shell find $(MODULES_DIR) -name 'popcorn.*.js' -print))

# Grab all popcorn.<wrapper-name>.js files from modules dir
WRAPPERS_SRC := $(filter-out %unit.js, $(shell find $(WRAPPERS_DIR) -name 'popcorn.*.js' -print))

# Grab all popcorn.<plugin-name>.unit.js files from plugins dir
PLUGINS_UNIT := $(shell find ${PLUGINS_DIR} -name 'popcorn.*.unit.js' -print)

Expand All @@ -79,9 +86,13 @@ EFFECTS_UNIT := $(shell find $(EFFECTS_DIR) -name 'popcorn.*.unit.js' -print)
# Grab all popcorn.<module-name>.unit.js files from modules dir
MODULES_UNIT := $(shell find $(MODULES_DIR) -name 'popcorn.*.unit.js' -print)

# Grab all popcorn.<wrapper-name>.unit.js files from modules dir
WRAPPERS_UNIT := $(shell find $(WRAPPERS_DIR) -name 'popcorn.*.unit.js' -print)

# popcorn + plugins
POPCORN_COMPLETE_LIST := --js ${POPCORN_SRC} \
$(shell for js in ${MODULES_SRC} ; do echo --js $$js ; done) \
$(shell for js in $(WRAPPERS_SRC) ; do echo --js $$js ; done) \
$(shell for js in ${EFFECTS_SRC} ; do echo --js $$js ; done) \
$(shell for js in ${PLUGINS_SRC} ; do echo --js $$js ; done) \
$(shell for js in ${PARSERS_SRC} ; do echo --js $$js ; done) \
Expand Down Expand Up @@ -114,7 +125,7 @@ run_lint = @@$(RHINO) build/jslint-check.js $(1)
all: setup popcorn plugins parsers players effects complete min ie8
@@echo "Popcorn build complete. To create a testing mirror, run: make testing."

check: lint lint-plugins lint-parsers lint-players lint-effects lint-modules
check: lint lint-plugins lint-parsers lint-players lint-effects lint-modules lint-wrappers

${DIST_DIR}:
@@mkdir -p ${DIST_DIR}
Expand All @@ -127,7 +138,7 @@ ${POPCORN_DIST}: $(POPCORN_SRC) | $(DIST_DIR)
@@$(call add_license, $(POPCORN_DIST))
@@$(call add_version, $(POPCORN_DIST))

min: setup ${POPCORN_MIN} ${MODULES_MIN} ${PLUGINS_MIN} ${PARSERS_MIN} ${PLAYERS_MIN} $(EFFECTS_MIN) ${POPCORN_COMPLETE_MIN}
min: setup ${POPCORN_MIN} ${MODULES_MIN} $(WRAPPERS_MIN) ${PLUGINS_MIN} ${PARSERS_MIN} ${PLAYERS_MIN} $(EFFECTS_MIN) ${POPCORN_COMPLETE_MIN}

${POPCORN_MIN}: ${POPCORN_DIST}
@@echo "Building" ${POPCORN_MIN}
Expand All @@ -151,6 +162,16 @@ ${MODULES_DIST}: ${MODULES_SRC} ${DIST_DIR}
@@echo "Building ${MODULES_DIST}"
@@cat ${MODULES_SRC} > ${MODULES_DIST}

wrappers: setup $(WRAPPERS_DIST)

$(WRAPPERS_MIN): $(WRAPPERS_DIST)
@@echo "Building" $(WRAPPERS_MIN)
@@$(call compile, $(shell for js in $(WRAPPERS_SRC) ; do echo --js $$js ; done), $(WRAPPERS_MIN))

$(WRAPPERS_DIST): $(WRAPPERS_SRC) $(DIST_DIR)
@@echo "Building $(WRAPPERS_DIST)"
@@cat $(WRAPPERS_SRC) > $(WRAPPERS_DIST)

plugins: ${PLUGINS_DIST}

${PLUGINS_MIN}: ${PLUGINS_DIST}
Expand Down Expand Up @@ -223,6 +244,10 @@ lint-modules:
@@echo "Checking all modules against JSLint..."
@@$(call run_lint,$(MODULES_SRC))

lint-wrappers:
@@echo "Checking all wrappers against JSLint..."
@@$(call run_lint,$(WRAPPERS_SRC))

lint-plugins:
@@echo "Checking all plugins against JSLint..."
@@$(call run_lint,$(PLUGINS_SRC))
Expand All @@ -243,6 +268,10 @@ lint-modules-tests:
@@echo "Checking modules unit tests against JSLint..."
@@$(call run_lint,$(MODULES_UNIT))

lint-wrappers-tests:
@@echo "Checking wrappers unit tests against JSLint..."
@@$(call run_lint,$(WRAPPERS_UNIT))

lint-plugin-tests:
@@echo "Checking plugin unit tests against JSLint..."
@@$(call run_lint,$(PLUGINS_UNIT))
Expand All @@ -259,7 +288,7 @@ lint-player-tests:
@@echo "Checking player unit tests against JSLint..."
@@$(call run_lint,$(PLAYERS_UNIT))

lint-unit-tests: lint-modules-tests lint-plugin-tests lint-parser-tests lint-player-tests lint-effects-tests
lint-unit-tests: lint-modules-tests lint-wrappers-tests lint-plugin-tests lint-parser-tests lint-player-tests lint-effects-tests
@@echo "completed"

# Create a mirror copy of the tree in dist/ using popcorn-complete.js
Expand Down
13 changes: 7 additions & 6 deletions test/index.html
Expand Up @@ -11,11 +11,12 @@
<h1 id="qunit-header">
Popcorn.js Test Suite
<span style="" id="test-links">
<label for="core-tests">Core Tests</label><input id="core-tests" type="checkbox" value="core" checked="true" tabindex="1"/> |
<label for="plugin-tests">Plugin Tests</label><input id="plugin-tests" type="checkbox" value="plugins" checked tabindex="2"/> |
<label for="player-tests">Player Tests</label><input id="player-tests" type="checkbox" value="players" checked tabindex="3"/> |
<label for="parser-tests">Parser Tests</label><input id="parser-tests" type="checkbox" value="parsers" checked tabindex="4"/> |
<label for="module-tests">Module Tests</label><input id="module-tests" type="checkbox" value="modules" checked tabindex="5"/> |
<label for="core-tests">Core</label><input id="core-tests" type="checkbox" value="core" checked="true" tabindex="1"/> |
<label for="plugin-tests">Plugins</label><input id="plugin-tests" type="checkbox" value="plugins" checked tabindex="2"/> |
<label for="player-tests">Players</label><input id="player-tests" type="checkbox" value="players" checked tabindex="3"/> |
<label for="parser-tests">Parsers</label><input id="parser-tests" type="checkbox" value="parsers" checked tabindex="4"/> |
<label for="module-tests">Modules</label><input id="module-tests" type="checkbox" value="modules" checked tabindex="5"/> |
<label for="wrapper-tests">Wrappers</label><input id="wrapper-tests" type="checkbox" value="wrappers" checked tabindex="5"/> |
<input id="run-selected" type="button" value="Run Selected" checked tabindex="6" />
</span>
</h1>
Expand All @@ -25,4 +26,4 @@ <h2 id="qunit-userAgent"></h2>
<iframe id="test-frame" style="height: 600px; width: 100%; overflow: scroll;"></iframe>

</body>
</html>
</html>
5 changes: 3 additions & 2 deletions test/popcorn.testrunner.js
Expand Up @@ -17,7 +17,7 @@
results_arr = [],
userAgent = id( "qunit-userAgent" ),
checkboxes = [],
testTypes = [ "core-tests", "plugin-tests", "player-tests", "parser-tests", "module-tests" ],
testTypes = [ "core-tests", "plugin-tests", "player-tests", "parser-tests", "module-tests", "wrapper-tests" ],
queryString = "",
runSelected = document.getElementById( "run-selected" );

Expand Down Expand Up @@ -51,6 +51,7 @@
"player-tests": "1",
"parser-tests": "1",
"module-tests": "1",
"wrapper-tests": "1"
};
}
return queryVars;
Expand Down Expand Up @@ -219,7 +220,7 @@
loadedCallback && typeof loadedCallback === "function" && loadedCallback();
}
});
}
};

this.runTests = function() {
if ( testList.length ) {
Expand Down
7 changes: 7 additions & 0 deletions tests.conf
Expand Up @@ -42,5 +42,12 @@
"webpage": "plugins/webpage/popcorn.webpage.unit.html",
"wikipedia": "plugins/wikipedia/popcorn.wikipedia.unit.html",
"wordriver": "plugins/wordriver/popcorn.wordriver.unit.html"
},
"wrappers": {
"HTMLYouTubeVideoElement": "wrappers/youtube/popcorn.HTMLYouTubeVideoElement.unit.html",
"HTMLSoundCloudAudioElement": "wrappers/soundcloud/popcorn.HTMLSoundCloudAudioElement.unit.html",
"HTMLVimeoVideoElement": "wrappers/vimeo/popcorn.HTMLVimeoVideoElement.unit.html",
"HTMLNullVideoElement": "wrappers/null/popcorn.HTMLNullVideoElement.unit.html",
"HTMLVideoElement": "wrappers/html5/popcorn.HTMLVideoElement.unit.html"
}
}

0 comments on commit a1b7db6

Please sign in to comment.