OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 var last_file_entries = null; |
| 6 |
| 7 function getLastFileEntries() { |
| 8 return last_file_entries; |
| 9 } |
| 10 |
| 11 function executeListener(id, details) { |
| 12 if (id != "TextAction" && id != "BaseAction" && id != "JpegAction") { |
| 13 chrome.test.fail("Unexpected action id: " + id); |
| 14 return; |
| 15 } |
| 16 var file_entries = details.entries; |
| 17 if (!file_entries || file_entries.length != 1) { |
| 18 chrome.test.fail("Unexpected file url list"); |
| 19 return; |
| 20 } |
| 21 last_file_entries = file_entries; |
| 22 chrome.tabs.get(details.tab_id, function(tab) { |
| 23 if (tab.title != "file browser component test") { |
| 24 chrome.test.fail("Unexpected tab title: " + tab.title); |
| 25 return; |
| 26 } |
| 27 // Create a new tab |
| 28 chrome.tabs.create({ |
| 29 url: "tab.html" |
| 30 }); |
| 31 }); |
| 32 } |
| 33 |
| 34 chrome.fileBrowserHandler.onExecute.addListener(executeListener); |
| 35 |
| 36 // This extension just initializes its chrome.fileBrowserHandler.onExecute |
| 37 // event listener, the real testing is done when this extension's handler is |
| 38 // invoked from filebrowser_component tests. This event will be raised from that |
| 39 // component extension test and it simulates user action in the file browser. |
| 40 // tab.html part of this extension can run only after the component raises this |
| 41 // event, since that operation sets the propery security context and creates |
| 42 // event's payload with proper file Entry instances. tab.html will return |
| 43 // results of its execution to filebrowser_component test through a |
| 44 // cross-component message. |
| 45 chrome.test.succeed(); |
OLD | NEW |