Permalink
Browse files

moving content tests to test shim

  • Loading branch information...
1 parent a8c3e6a commit 126b4b8b93cda5d220522e0f16120d380fbd6d5a @benvanik committed Nov 9, 2011
Showing with 55 additions and 18 deletions.
  1. +22 −0 apps/chrome/src/service.js
  2. +33 −4 apps/chrome/src/test.html
  3. +0 −14 lib/api.js
View
@@ -149,3 +149,25 @@ Service.prototype.photo = function(deviceId, content, transition, callback) {
}
});
};
+
+Service.prototype.setupContent = function(source, target, callback) {
+ var request = {
+ source: source,
+ target: target
+ };
+ this.post_('/content/setup', request, function(response) {
+ window.console.log(response);
+ if (callback) {
+ callback(response);
+ }
+ });
+};
+
+Service.prototype.getContentStatus = function(contentId, callback) {
+ this.get_('/content/' + contentId + '/status', function(response) {
+ window.console.log(response);
+ if (callback) {
+ callback(response);
+ }
+ });
+};
View
@@ -6,7 +6,7 @@
<script src="service.js"></script>
<script src="device.js"></script>
<script>
- var endpoint = 'http://localhost:8090';
+ var endpoint = 'http://10.0.1.3:8090';
var service = new Service(endpoint);
var deviceList;
@@ -94,12 +94,38 @@
targetDevice.stop();
}
- function test1() {
+ function testRemote() {
var content = 'http://wwwappskc.lonestar.edu/cgi/video/html5/test.m4v';
- //var content = 'http://10.0.1.3:8090/content/test';
play(content);
}
+ function testContent(url) {
+ var source = {
+ content: url
+ };
+ var target = {
+ mimeType: 'video/mp4',
+ //resolution: 720,
+ //quality: 0.8
+ };
+ service.setupContent(source, target, function(response) {
+ var contentId = response.id;
+ play(endpoint + '/content/' + contentId);
+ });
+ }
+
+ function testContentLocal() {
+ testContent('file:///Users/noxa/Downloads/test.m4v');
+ }
+
+ function testContentRemote() {
+ testContent('http://wwwappskc.lonestar.edu/cgi/video/html5/test.m4v');
+ }
+
+ function testContentWebM() {
+ testContent('file:///Users/noxa/Downloads/test1.webm');
+ }
+
function play(content) {
targetDevice.play(content, 0);
}
@@ -138,7 +164,10 @@
<a href="javascript:pause();">pause</a>&nbsp;
<a href="javascript:stop();">stop</a>&nbsp;
<br/>
- <a href="javascript:test1();">test1</a>&nbsp;
+ <a href="javascript:testRemote();">test</a>&nbsp;
+ <a href="javascript:testContentLocal();">test/fs</a>&nbsp;
+ <a href="javascript:testContentRemote();">test/remote</a>&nbsp;
+ <a href="javascript:testContentWebM();">test/webm</a>&nbsp;
<br/>
<input id="urlInput" type="text" size="150"></input>
<a href="javascript:play(document.getElementById('urlInput').value);">
View
@@ -109,20 +109,6 @@ API.prototype.dispatchDeviceRequest = function(req, requestBody, res) {
API.prototype.dispatchContentSetupRequest = function(req, requestBody, res) {
var request = requestBody.length ? JSON.parse(requestBody) : {};
- // TESTING ONLY
- if (!request.source) {
- request.id = 'test';
- request.source = {
- //content: 'http://wwwappskc.lonestar.edu/cgi/video/html5/test.m4v'
- //content: 'file:///Users/noxa/Downloads/test.m4v',
- content: 'file:///Users/noxa/Downloads/test1.webm',
- mimeType: 'video/webm'
- };
- request.target = {
- mimeType: 'video/mp4'
- };
- }
-
var source = request.source;
var target = request.target;
var content = this.contentCache.findOrCreate(source, target, request.id);

0 comments on commit 126b4b8

Please sign in to comment.