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

Side by Side Diff: chrome/test/data/extensions/api_test/filesystem_handler_write/tab.js

Issue 9395077: [filebrowser] Introduce View action for supported file types (e.g. pdf). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/extensions/api_test/filesystem_handler_write/manifest.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 extension is a file intent handler and does the following during the test: 6 This extension is a file intent handler and does the following during the test:
7 7
8 1. It first registers content hander. 8 1. It first registers content hander.
9 2. When content handler callback is invoked, opens tab.html page and passes 9 2. When content handler callback is invoked, opens tab.html page and passes
10 file url via hash ref. 10 file url via hash ref.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 reader.onerror = function(e) { 86 reader.onerror = function(e) {
87 errorCallback({message: "Unable to read file."}); 87 errorCallback({message: "Unable to read file."});
88 }; 88 };
89 entry.file(function(file) { 89 entry.file(function(file) {
90 reader.readAsText(file); 90 reader.readAsText(file);
91 }, 91 },
92 errorCallback); 92 errorCallback);
93 } 93 }
94 94
95 function executeListener(id, details) { 95 function executeListener(id, details) {
96 if (id != "TextAction" && id != "BaseAction" && id != "JpegAction") { 96 if (id != "AbcAction" && id != "BaseAction" && id != "123Action") {
97 chrome.test.fail("Unexpected action id: " + id); 97 chrome.test.fail("Unexpected action id: " + id);
98 return; 98 return;
99 } 99 }
100 var file_entries = details.entries; 100 var file_entries = details.entries;
101 if (!file_entries || file_entries.length != 1) { 101 if (!file_entries || file_entries.length != 1) {
102 chrome.test.fail("Unexpected file url list"); 102 chrome.test.fail("Unexpected file url list");
103 return; 103 return;
104 } 104 }
105 chrome.tabs.get(details.tab_id, function(tab) { 105 chrome.tabs.get(details.tab_id, function(tab) {
106 if (tab.title != "file browser component test") { 106 if (tab.title != "file browser component test") {
107 chrome.test.fail("Unexpected tab title: " + tab.title); 107 chrome.test.fail("Unexpected tab title: " + tab.title);
108 return; 108 return;
109 } 109 }
110 runFileSystemHandlerTest(file_entries); 110 runFileSystemHandlerTest(file_entries);
111 }); 111 });
112 } 112 }
113 113
114 chrome.fileBrowserHandler.onExecute.addListener(executeListener); 114 chrome.fileBrowserHandler.onExecute.addListener(executeListener);
115 115
116 // This extension just initializes its chrome.fileBrowserHandler.onExecute 116 // This extension just initializes its chrome.fileBrowserHandler.onExecute
117 // event listener, the real testing is done when this extension's handler is 117 // event listener, the real testing is done when this extension's handler is
118 // invoked from filebrowser_component tests. This event will be raised from that 118 // invoked from filebrowser_component tests. This event will be raised from that
119 // component extension test and it simulates user action in the file browser. 119 // component extension test and it simulates user action in the file browser.
120 // tab.html part of this extension can run only after the component raises this 120 // tab.html part of this extension can run only after the component raises this
121 // event, since that operation sets the propery security context and creates 121 // event, since that operation sets the propery security context and creates
122 // event's payload with proper file Entry instances. tab.html will return 122 // event's payload with proper file Entry instances. tab.html will return
123 // results of its execution to filebrowser_component test through a 123 // results of its execution to filebrowser_component test through a
124 // cross-component message. 124 // cross-component message.
125 chrome.test.succeed(); 125 chrome.test.succeed();
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/filesystem_handler_write/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698