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

Side by Side Diff: chrome/test/data/extensions/api_test/filebrowser_component/main.js

Issue 10834383: Chrome OS "open with" picker allowing Web Intents (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: reorder class, revert net/* Created 8 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 /* 5 /*
6 This component extension test does the following: 6 This component extension test does the following:
7 7
8 1. Creates an abc and log file on the local file system with some random text. 8 1. Creates an abc and log file on the local file system with some random text.
9 2. Finds a registered task (file item context menu) for abc file and invokes it 9 2. Finds a registered task (file item context menu) for abc file and invokes it
10 with url of the test file. 10 with url of the test file.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 this.fileCreator_.init(fs, this.onFileCreatorInit_.bind(this), 92 this.fileCreator_.init(fs, this.onFileCreatorInit_.bind(this),
93 this.errorCallback_.bind(this)); 93 this.errorCallback_.bind(this));
94 }; 94 };
95 95
96 TestRunner.prototype.onFileCreatorInit_ = function() { 96 TestRunner.prototype.onFileCreatorInit_ = function() {
97 var ext = this.expectations_.getFileExtension(); 97 var ext = this.expectations_.getFileExtension();
98 if (!ext) { 98 if (!ext) {
99 this.errorCallback_({message: "Test file extension not set."}); 99 this.errorCallback_({message: "Test file extension not set."});
100 return; 100 return;
101 } 101 }
102 console.log(this.fileExtension);
103 var self = this; 102 var self = this;
104 this.fileCreator_.createFile('.log', 103 this.fileCreator_.createFile('.log',
105 function(file, text) { 104 function(file, text) {
106 self.fileCreator_.createFile(ext, 105 self.fileCreator_.createFile(ext,
107 self.onFileCreated_.bind(self), 106 self.onFileCreated_.bind(self),
108 self.errorCallback_.bind(self)); 107 self.errorCallback_.bind(self));
109 }, 108 },
110 this.errorCallback_.bind(this)); 109 this.errorCallback_.bind(this));
111 }; 110 };
112 111
(...skipping 10 matching lines...) Expand all
123 TestRunner.prototype.onGetTasks_ = function(fileUrl, tasks) { 122 TestRunner.prototype.onGetTasks_ = function(fileUrl, tasks) {
124 console.log('Tasks: '); 123 console.log('Tasks: ');
125 console.log(tasks); 124 console.log(tasks);
126 if (!tasks || !tasks.length) { 125 if (!tasks || !tasks.length) {
127 this.errorCallback_({message: 'No tasks registered'}); 126 this.errorCallback_({message: 'No tasks registered'});
128 return; 127 return;
129 } 128 }
130 129
131 console.log('DONE fetching ' + tasks.length + ' tasks'); 130 console.log('DONE fetching ' + tasks.length + ' tasks');
132 131
133 tasks = this.filterTasks_(tasks);
134 chrome.fileBrowserPrivate.executeTask(tasks[0].taskId, [fileUrl]); 132 chrome.fileBrowserPrivate.executeTask(tasks[0].taskId, [fileUrl]);
135 }; 133 };
136 134
137 TestRunner.prototype.filterTasks_ = function(tasks) { 135 TestRunner.prototype.filterTasks_ = function(tasks) {
138 var result = []; 136 var result = [];
139 for (var i = 0; i < tasks.length; i++) { 137 for (var i = 0; i < tasks.length; i++) {
140 if (tasks[i].taskId.split('|')[0] != kFileManagerExtensionId) { 138 if (tasks[i].taskId.split('|')[0] != kFileManagerExtensionId) {
141 result.push(tasks[i]); 139 result.push(tasks[i]);
142 } 140 }
143 } 141 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 if (!error) { 196 if (!error) {
199 sendResponse({success: true}); 197 sendResponse({success: true});
200 this.fileCreator_.cleanupAndEndTest(this.reportSuccess_.bind(this), 198 this.fileCreator_.cleanupAndEndTest(this.reportSuccess_.bind(this),
201 this.reportFail_.bind(this, 199 this.reportFail_.bind(this,
202 cleanupError)); 200 cleanupError));
203 } else { 201 } else {
204 sendResponse({success: false}); 202 sendResponse({success: false});
205 this.errorCallback_(error); 203 this.errorCallback_(error);
206 } 204 }
207 }; 205 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698