From 7cd09c266afe0d7bfd21ab6ed2f44b2fa53c8f8f Mon Sep 17 00:00:00 2001 From: Jacob Trimble Date: Fri, 15 Jan 2016 15:53:31 -0800 Subject: [PATCH] Removed goog.require from test code. This removed any goog.require from the test code to make it simpler. Now, shaka-player.uncompiled is required to be loaded before any tests. This fixes some dependency problems. This also moves the utility test code to test/util. Change-Id: I8991a61fc59c9c03e0143bb0883fd6d166af86c2 --- karma.conf.js | 3 ++- lib/media/streaming_engine.js | 1 + shaka-player.uncompiled.js | 3 +++ test/dash_parser_live_unit.js | 2 -- test/dash_parser_manifest_unit.js | 5 ----- test/dash_parser_segment_base_unit.js | 3 --- test/dash_parser_segment_list_unit.js | 5 ----- test/dash_parser_segment_template_unit.js | 5 ----- test/data_uri_plugin_unit.js | 4 ---- test/data_view_reader_unit.js | 3 --- test/ebml_parser_unit.js | 3 --- test/event_manager_unit.js | 2 -- test/fake_event_unit.js | 3 --- test/http_plugin_unit.js | 3 --- test/media_source_engine_integration.js | 2 -- test/media_source_engine_unit.js | 3 --- test/mpd_utils_unit.js | 2 -- test/networking_engine_unit.js | 3 --- test/playhead_unit.js | 3 --- test/presentation_timeline_unit.js | 2 -- test/pssh_unit.js | 4 ---- test/segment_index_unit.js | 3 --- test/stream_generator.js | 4 ---- test/streaming_engine_unit.js | 5 ----- test/text_parser_unit.js | 2 -- test/text_source_buffer_unit.js | 3 --- test/{ => util}/dash_parser_util.js | 5 ----- test/{ => util}/util.js | 4 ---- test/vtt_text_parser_unit.js | 4 ---- test/xml_utils_unit.js | 2 -- 30 files changed, 6 insertions(+), 90 deletions(-) rename test/{ => util}/dash_parser_util.js (98%) rename test/{ => util}/util.js (96%) diff --git a/karma.conf.js b/karma.conf.js index 52829e479..1076f2e62 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -25,9 +25,10 @@ module.exports = function(config) { // deps next 'dist/deps.js', + 'shaka-player.uncompiled.js', // test utils next - 'test/*util.js', + 'test/util/*.js', // actual tests last 'test/*.js', diff --git a/lib/media/streaming_engine.js b/lib/media/streaming_engine.js index 8cfa44860..581a9d03a 100644 --- a/lib/media/streaming_engine.js +++ b/lib/media/streaming_engine.js @@ -19,6 +19,7 @@ goog.provide('shaka.media.StreamingEngine'); goog.require('shaka.asserts'); goog.require('shaka.media.MediaSourceEngine'); +goog.require('shaka.media.Playhead'); goog.require('shaka.net.NetworkingEngine'); goog.require('shaka.util.Error'); goog.require('shaka.util.IDestroyable'); diff --git a/shaka-player.uncompiled.js b/shaka-player.uncompiled.js index 3fcaad62d..f65ba4d1d 100644 --- a/shaka-player.uncompiled.js +++ b/shaka-player.uncompiled.js @@ -24,11 +24,14 @@ goog.require('shaka.polyfill.installAll'); goog.require('shaka.util.Error'); goog.require('shaka.util.StringUtils'); goog.require('shaka.util.Uint8ArrayUtils'); +// TODO: Remove once player uses StreamingEngine. +goog.require('shaka.media.StreamingEngine'); // Require logging. goog.require('shaka.log'); // Require standard plugins. +goog.require('shaka.dash.DashParser'); goog.require('shaka.media.VttTextParser'); goog.require('shaka.net.DataUriPlugin'); goog.require('shaka.net.HttpPlugin'); diff --git a/test/dash_parser_live_unit.js b/test/dash_parser_live_unit.js index ccb78a7c2..0abc06eff 100644 --- a/test/dash_parser_live_unit.js +++ b/test/dash_parser_live_unit.js @@ -15,8 +15,6 @@ * limitations under the License. */ -goog.require('shaka.dash.DashParser'); - describe('DashParser.Live', function() { var errorCallback; var fakeNetEngine; diff --git a/test/dash_parser_manifest_unit.js b/test/dash_parser_manifest_unit.js index ba537c350..bfcb4684d 100644 --- a/test/dash_parser_manifest_unit.js +++ b/test/dash_parser_manifest_unit.js @@ -15,11 +15,6 @@ * limitations under the License. */ -goog.require('shaka.dash.DashParser'); -goog.require('shaka.media.PresentationTimeline'); -goog.require('shaka.media.SegmentReference'); -goog.require('shaka.util.Uint8ArrayUtils'); - // Test basic manifest parsing functionality. describe('DashParser.Manifest', function() { var fakeNetEngine; diff --git a/test/dash_parser_segment_base_unit.js b/test/dash_parser_segment_base_unit.js index 7fc605a9c..c0a800508 100644 --- a/test/dash_parser_segment_base_unit.js +++ b/test/dash_parser_segment_base_unit.js @@ -15,9 +15,6 @@ * limitations under the License. */ -goog.require('shaka.dash.DashParser'); -goog.require('shaka.util.Uint8ArrayUtils'); - describe('DashParser.SegmentBase', function() { it('requests init data for WebM', function(done) { var source = [ diff --git a/test/dash_parser_segment_list_unit.js b/test/dash_parser_segment_list_unit.js index e11b2961d..5e50b2174 100644 --- a/test/dash_parser_segment_list_unit.js +++ b/test/dash_parser_segment_list_unit.js @@ -15,11 +15,6 @@ * limitations under the License. */ -goog.require('shaka.dash.DashParser'); -goog.require('shaka.log'); -goog.require('shaka.media.SegmentReference'); -goog.require('shaka.util.Uint8ArrayUtils'); - describe('DashParser.SegmentList', function() { dashMakeTimelineTests('SegmentList', '', [ '', diff --git a/test/dash_parser_segment_template_unit.js b/test/dash_parser_segment_template_unit.js index 882972627..c68e7efe3 100644 --- a/test/dash_parser_segment_template_unit.js +++ b/test/dash_parser_segment_template_unit.js @@ -15,11 +15,6 @@ * limitations under the License. */ -goog.require('shaka.dash.DashParser'); -goog.require('shaka.log'); -goog.require('shaka.media.SegmentReference'); -goog.require('shaka.util.Uint8ArrayUtils'); - describe('DashParser.SegmentTemplate', function() { dashMakeTimelineTests('SegmentTemplate', 'media="s$Number$.mp4"', []); diff --git a/test/data_uri_plugin_unit.js b/test/data_uri_plugin_unit.js index 2ebbdc84f..5fe2df33a 100644 --- a/test/data_uri_plugin_unit.js +++ b/test/data_uri_plugin_unit.js @@ -15,10 +15,6 @@ * limitations under the License. */ -goog.require('shaka.net.DataUriPlugin'); -goog.require('shaka.net.NetworkingEngine'); -goog.require('shaka.util.Uint8ArrayUtils'); - describe('DataUriPlugin', function() { it('supports MIME types', function(done) { testSucceeds('data:text/plain,Hello', 'Hello', done); diff --git a/test/data_view_reader_unit.js b/test/data_view_reader_unit.js index 10d026784..029bc281b 100644 --- a/test/data_view_reader_unit.js +++ b/test/data_view_reader_unit.js @@ -15,9 +15,6 @@ * limitations under the License. */ -goog.require('shaka.util.DataViewReader'); -goog.require('shaka.util.Error'); - describe('DataViewReader', function() { // |data| as interpreted as a 64 bit integer must not be larger than 2^53-1. // decimal digits. diff --git a/test/ebml_parser_unit.js b/test/ebml_parser_unit.js index 89bbf99ac..c1ede93a5 100644 --- a/test/ebml_parser_unit.js +++ b/test/ebml_parser_unit.js @@ -15,9 +15,6 @@ * limitations under the License. */ -goog.require('shaka.util.EbmlParser'); -goog.require('shaka.util.Error'); - describe('EbmlParser', function() { var Code; diff --git a/test/event_manager_unit.js b/test/event_manager_unit.js index a985573cb..54b8b3fa8 100644 --- a/test/event_manager_unit.js +++ b/test/event_manager_unit.js @@ -15,8 +15,6 @@ * limitations under the License. */ -goog.require('shaka.util.EventManager'); - describe('EventManager', function() { var eventManager; var event1; diff --git a/test/fake_event_unit.js b/test/fake_event_unit.js index 690703552..322154ef4 100644 --- a/test/fake_event_unit.js +++ b/test/fake_event_unit.js @@ -15,9 +15,6 @@ * limitations under the License. */ -goog.require('shaka.util.FakeEvent'); -goog.require('shaka.util.FakeEventTarget'); - describe('FakeEventTarget', function() { it('sets target on dispatched events', function(done) { var target = new shaka.util.FakeEventTarget(null); diff --git a/test/http_plugin_unit.js b/test/http_plugin_unit.js index 3b13f9cab..23719f7a7 100644 --- a/test/http_plugin_unit.js +++ b/test/http_plugin_unit.js @@ -15,9 +15,6 @@ * limitations under the License. */ -goog.require('shaka.net.HttpPlugin'); -goog.require('shaka.net.NetworkingEngine'); - describe('HttpPlugin', function() { beforeAll(function() { jasmine.Ajax.install(); diff --git a/test/media_source_engine_integration.js b/test/media_source_engine_integration.js index 712386a52..5f3bbab70 100644 --- a/test/media_source_engine_integration.js +++ b/test/media_source_engine_integration.js @@ -15,8 +15,6 @@ * limitations under the License. */ -goog.require('shaka.media.MediaSourceEngine'); - describe('MediaSourceEngine', function() { var metadata = { video: { diff --git a/test/media_source_engine_unit.js b/test/media_source_engine_unit.js index 0cefed384..cd365aa8a 100644 --- a/test/media_source_engine_unit.js +++ b/test/media_source_engine_unit.js @@ -15,9 +15,6 @@ * limitations under the License. */ -goog.require('shaka.media.MediaSourceEngine'); -goog.require('shaka.media.TextSourceBuffer'); - describe('MediaSourceEngine', function() { var originalMediaSource; var originalTextSourceBuffer; diff --git a/test/mpd_utils_unit.js b/test/mpd_utils_unit.js index 7495f4cf2..170432dc3 100644 --- a/test/mpd_utils_unit.js +++ b/test/mpd_utils_unit.js @@ -15,8 +15,6 @@ * limitations under the License. */ -goog.require('shaka.dash.MpdUtils'); - describe('MpdUtils', function() { // A number that cannot be represented as a Javascript number. var HUGE_NUMBER_STRING = new Array(500).join('7'); diff --git a/test/networking_engine_unit.js b/test/networking_engine_unit.js index b0ef8642c..f2c2442c9 100644 --- a/test/networking_engine_unit.js +++ b/test/networking_engine_unit.js @@ -15,9 +15,6 @@ * limitations under the License. */ -goog.require('shaka.net.NetworkingEngine'); -goog.require('shaka.util.PublicPromise'); - describe('NetworkingEngine', function() { var networkingEngine; var resolveScheme; diff --git a/test/playhead_unit.js b/test/playhead_unit.js index 403c9ac57..360af8e71 100644 --- a/test/playhead_unit.js +++ b/test/playhead_unit.js @@ -15,9 +15,6 @@ * limitations under the License. */ -goog.require('shaka.media.Playhead'); -goog.require('shaka.media.PresentationTimeline'); - describe('Playhead', function() { var video; var timeline; diff --git a/test/presentation_timeline_unit.js b/test/presentation_timeline_unit.js index 6b7dc1fc3..ca8411a20 100644 --- a/test/presentation_timeline_unit.js +++ b/test/presentation_timeline_unit.js @@ -15,8 +15,6 @@ * limitations under the License. */ -goog.require('shaka.media.PresentationTimeline'); - describe('PresentationTimeline', function() { var originalDateNow; var baseTime; diff --git a/test/pssh_unit.js b/test/pssh_unit.js index 455f531c5..887503696 100644 --- a/test/pssh_unit.js +++ b/test/pssh_unit.js @@ -15,10 +15,6 @@ * limitations under the License. */ -goog.require('shaka.util.Error'); -goog.require('shaka.util.Pssh'); -goog.require('shaka.util.Uint8ArrayUtils'); - describe('Pssh', function() { var fromHex = shaka.util.Uint8ArrayUtils.fromHex; var toHex = shaka.util.Uint8ArrayUtils.toHex; diff --git a/test/segment_index_unit.js b/test/segment_index_unit.js index 13c850570..a9d16ae22 100644 --- a/test/segment_index_unit.js +++ b/test/segment_index_unit.js @@ -15,9 +15,6 @@ * limitations under the License. */ -goog.require('shaka.media.SegmentIndex'); -goog.require('shaka.media.SegmentReference'); - describe('SegmentIndex', function() { describe('find', function() { it('finds the correct references', function() { diff --git a/test/stream_generator.js b/test/stream_generator.js index ed5df984f..0f2f70eb9 100644 --- a/test/stream_generator.js +++ b/test/stream_generator.js @@ -20,10 +20,6 @@ goog.provide('shaka.test.DashVodStreamGenerator'); goog.provide('shaka.test.IStreamGenerator'); goog.provide('shaka.test.StreamGenerator'); -goog.require('shaka.asserts'); -goog.require('shaka.log'); -goog.require('shaka.util.DataViewReader'); - /** diff --git a/test/streaming_engine_unit.js b/test/streaming_engine_unit.js index e542900ce..7d06bb93c 100644 --- a/test/streaming_engine_unit.js +++ b/test/streaming_engine_unit.js @@ -15,11 +15,6 @@ * limitations under the License. */ -goog.require('shaka.media.StreamingEngine'); -goog.require('shaka.media.TextSourceBuffer'); -goog.require('shaka.net.NetworkingEngine'); -goog.require('shaka.util.PublicPromise'); - describe('StreamingEngine', function() { var originalSetTimeout; var currentTime; diff --git a/test/text_parser_unit.js b/test/text_parser_unit.js index e9dbf69ae..4a01d842a 100644 --- a/test/text_parser_unit.js +++ b/test/text_parser_unit.js @@ -15,8 +15,6 @@ * limitations under the License. */ -goog.require('shaka.util.TextParser'); - describe('TextParser', function() { var textParser; diff --git a/test/text_source_buffer_unit.js b/test/text_source_buffer_unit.js index 9eb147fcf..930ac66df 100644 --- a/test/text_source_buffer_unit.js +++ b/test/text_source_buffer_unit.js @@ -15,9 +15,6 @@ * limitations under the License. */ -goog.require('shaka.media.TextSourceBuffer'); -goog.require('shaka.util.EventManager'); - describe('TextSourceBuffer', function() { var TextSourceBuffer; var dummyData = new ArrayBuffer(); diff --git a/test/dash_parser_util.js b/test/util/dash_parser_util.js similarity index 98% rename from test/dash_parser_util.js rename to test/util/dash_parser_util.js index 37dc0bd34..a7b1a4d27 100644 --- a/test/dash_parser_util.js +++ b/test/util/dash_parser_util.js @@ -15,11 +15,6 @@ * limitations under the License. */ -goog.require('shaka.dash.DashParser'); -goog.require('shaka.log'); -goog.require('shaka.media.SegmentReference'); -goog.require('shaka.util.Uint8ArrayUtils'); - /** diff --git a/test/util.js b/test/util/util.js similarity index 96% rename from test/util.js rename to test/util/util.js index c07e7018e..6c5da2553 100644 --- a/test/util.js +++ b/test/util/util.js @@ -15,10 +15,6 @@ * limitations under the License. */ -goog.require('shaka.asserts'); -goog.require('shaka.polyfill.CustomEvent'); -goog.require('shaka.polyfill.Promise'); - /** * Capture a Promise's status and attach it to the Promise. diff --git a/test/vtt_text_parser_unit.js b/test/vtt_text_parser_unit.js index 546317e33..406b3573f 100644 --- a/test/vtt_text_parser_unit.js +++ b/test/vtt_text_parser_unit.js @@ -15,10 +15,6 @@ * limitations under the License. */ -goog.require('shaka.media.VttTextParser'); -goog.require('shaka.util.Error'); -goog.require('shaka.util.Uint8ArrayUtils'); - describe('VttTextParser', function() { var mockCue = false; diff --git a/test/xml_utils_unit.js b/test/xml_utils_unit.js index 58840269a..d0a7999c2 100644 --- a/test/xml_utils_unit.js +++ b/test/xml_utils_unit.js @@ -15,8 +15,6 @@ * limitations under the License. */ -goog.require('shaka.util.XmlUtils'); - describe('XmlUtils', function() { // A number that cannot be represented as a Javascript number. var HUGE_NUMBER_STRING = new Array(500).join('7');