Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: chrome/browser/resources/video_player/js/background.js

Issue 209853011: [VideoPlayer] Browser tests for new separated video player app (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7
8 // Stores the app windows OLNY for test purpose.
9 // We SHOULD NOT use it as it is except for test, since the files which have
10 // the same name will be overridden each other.
11 var appWindowsForTest = {};
12
7 chrome.app.runtime.onLaunched.addListener(function(launchData) { 13 chrome.app.runtime.onLaunched.addListener(function(launchData) {
8 if (!launchData || !launchData.items || launchData.items.length == 0) 14 if (!launchData || !launchData.items || launchData.items.length == 0)
9 return; 15 return;
10 16
11 var entry = launchData.items[0].entry; 17 var entry = launchData.items[0].entry;
12 entry.file(function(file) { 18 entry.file(function(file) {
13 var url = window.URL.createObjectURL(file); 19 var url = window.URL.createObjectURL(file);
14 open(url, entry.name); 20 open(url, entry.name);
15 }, function() { 21 }, function() {
16 // TODO(yoshiki): handle error in a smarter way. 22 // TODO(yoshiki): handle error in a smarter way.
17 open('', 'error'); // Empty URL shows the error message. 23 open('', 'error'); // Empty URL shows the error message.
18 }); 24 });
19 }); 25 });
20 26
21 function open(url, title) { 27 function open(url, title) {
22 chrome.app.window.create('video_player.html', { 28 chrome.app.window.create('video_player.html', {
23 id: 'video', 29 id: 'video',
24 singleton: false, 30 singleton: false,
25 minWidth: 160, 31 minWidth: 160,
26 minHeight: 100 32 minHeight: 100
27 }, 33 },
28 function(createdWindow) { 34 function(createdWindow) {
35 // Stores the window for test purpose.
36 appWindowsForTest[title] = createdWindow;
37
29 createdWindow.setIcon('images/200/icon.png'); 38 createdWindow.setIcon('images/200/icon.png');
30 createdWindow.contentWindow.videoUrl = url; 39 createdWindow.contentWindow.videoUrl = url;
31 createdWindow.contentWindow.videoTitle = title; 40 createdWindow.contentWindow.videoTitle = title;
32 }); 41 });
33 } 42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698