OLD | NEW |
1 // Copyright (c) 2011 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 a txt file on the local file system with some random text. | 8 1. Creates a txt file on the local file system with some random text. |
9 2. Finds a registered task (file item context menu) and invokes it with url | 9 2. Finds a registered task (file item context menu) and invokes it with url |
10 of the test file. | 10 of the test file. |
11 3. Listens for a message from context menu handler and makes sure its payload | 11 3. Listens for a message from context menu handler and makes sure its payload |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 function onGetTasks(tasks) { | 68 function onGetTasks(tasks) { |
69 console.log("Tasks: "); | 69 console.log("Tasks: "); |
70 console.log(tasks); | 70 console.log(tasks); |
71 if (!tasks || !tasks.length) { | 71 if (!tasks || !tasks.length) { |
72 chrome.test.fail("No tasks registered"); | 72 chrome.test.fail("No tasks registered"); |
73 return; | 73 return; |
74 } | 74 } |
75 | 75 |
76 var expected_tasks = {'TextAction': ['filesystem:*.txt'], | 76 var expected_tasks = {'TextAction': ['filesystem:chrome-extension://*/*.txt'], |
77 'BaseAction': ['filesystem:*', 'filesystem:*.*']}; | 77 'BaseAction': ['filesystem:chrome-extension://*/*', |
| 78 'filesystem:chrome-extension://*/*.*']}; |
78 | 79 |
79 console.log("DONE fetching " + tasks.length + " tasks"); | 80 console.log("DONE fetching " + tasks.length + " tasks"); |
80 | 81 |
81 if (tasks.length != 2) | 82 if (tasks.length != 2) |
82 chrome.test.fail('Wrong number of tasks found.'); | 83 chrome.test.fail('Wrong number of tasks found.'); |
83 | 84 |
84 for (var i = 0; i < tasks.length; ++i) { | 85 for (var i = 0; i < tasks.length; ++i) { |
85 var task_name = /^.*[|](\w+)$/.exec(tasks[i].taskId)[1]; | 86 var task_name = /^.*[|](\w+)$/.exec(tasks[i].taskId)[1]; |
86 var patterns = tasks[i].patterns; | 87 var patterns = tasks[i].patterns; |
87 var expected_patterns = expected_tasks[task_name]; | 88 var expected_patterns = expected_tasks[task_name]; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 console.log(request); | 148 console.log(request); |
148 chrome.test.fail("Got error: " + request.error); | 149 chrome.test.fail("Got error: " + request.error); |
149 } | 150 } |
150 }); | 151 }); |
151 | 152 |
152 chrome.test.runTests([function tab() { | 153 chrome.test.runTests([function tab() { |
153 // Get local FS, create dir with a file in it. | 154 // Get local FS, create dir with a file in it. |
154 console.log("Requesting local file system..."); | 155 console.log("Requesting local file system..."); |
155 chrome.fileBrowserPrivate.requestLocalFileSystem(onFileSystemFetched); | 156 chrome.fileBrowserPrivate.requestLocalFileSystem(onFileSystemFetched); |
156 }]); | 157 }]); |
OLD | NEW |