OLD | NEW |
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 extension is a file intent handler with transient background page and does | 6 This extension is a file intent handler with transient background page and does |
7 the following during the test: | 7 the following during the test: |
8 | 8 |
9 1. It first registers content hander. | 9 1. It first registers content hander. |
10 2. When content handler callback is invoked, opens tab.html page and passes | 10 2. When content handler callback is invoked, opens tab.html page and passes |
(...skipping 25 matching lines...) Expand all Loading... |
36 break; | 36 break; |
37 default: | 37 default: |
38 msg = 'Unknown Error'; | 38 msg = 'Unknown Error'; |
39 break; | 39 break; |
40 }; | 40 }; |
41 } | 41 } |
42 | 42 |
43 // The ID of the extension we want to talk to. | 43 // The ID of the extension we want to talk to. |
44 var fileBrowserExtensionId = "ddammdhioacbehjngdmkjcjbnfginlla"; | 44 var fileBrowserExtensionId = "ddammdhioacbehjngdmkjcjbnfginlla"; |
45 | 45 |
46 chrome.extension.sendMessage(fileBrowserExtensionId, | 46 chrome.runtime.sendMessage(fileBrowserExtensionId, |
47 {fileContent: null, | 47 {fileContent: null, |
48 error: {message: "File handler error: " + msg}}, | 48 error: {message: "File handler error: " + msg}}, |
49 function(response) {}); | 49 function(response) {}); |
50 }; | 50 }; |
51 | 51 |
52 function runFileSystemHandlerTest(entries) { | 52 function runFileSystemHandlerTest(entries) { |
53 if (!entries || entries.length != 1 || !entries[0]) { | 53 if (!entries || entries.length != 1 || !entries[0]) { |
54 errorCallback({message: "Invalid file entries"}); | 54 errorCallback({message: "Invalid file entries"}); |
55 return; | 55 return; |
56 } | 56 } |
(...skipping 13 matching lines...) Expand all Loading... |
70 return; | 70 return; |
71 } | 71 } |
72 chrome.tabs.get(details.tab_id, function(tab) { | 72 chrome.tabs.get(details.tab_id, function(tab) { |
73 if (tab.title != "file browser component test") { | 73 if (tab.title != "file browser component test") { |
74 errorCallback({message: "Unexpected tab title: " + tab.title}); | 74 errorCallback({message: "Unexpected tab title: " + tab.title}); |
75 return; | 75 return; |
76 } | 76 } |
77 runFileSystemHandlerTest(file_entries); | 77 runFileSystemHandlerTest(file_entries); |
78 }); | 78 }); |
79 }); | 79 }); |
OLD | NEW |