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