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

Unified Diff: chrome/test/data/extensions/api_test/filesystem_handler/background.js

Issue 8758008: Move another block of extension tests to manifest_version 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/filesystem_handler/background.js
===================================================================
--- chrome/test/data/extensions/api_test/filesystem_handler/background.js (revision 0)
+++ chrome/test/data/extensions/api_test/filesystem_handler/background.js (revision 0)
@@ -0,0 +1,45 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var last_file_entries = null;
+
+function getLastFileEntries() {
+ return last_file_entries;
+}
+
+function executeListener(id, details) {
+ if (id != "TextAction" && id != "BaseAction" && id != "JpegAction") {
+ chrome.test.fail("Unexpected action id: " + id);
+ return;
+ }
+ var file_entries = details.entries;
+ if (!file_entries || file_entries.length != 1) {
+ chrome.test.fail("Unexpected file url list");
+ return;
+ }
+ last_file_entries = file_entries;
+ chrome.tabs.get(details.tab_id, function(tab) {
+ if (tab.title != "file browser component test") {
+ chrome.test.fail("Unexpected tab title: " + tab.title);
+ return;
+ }
+ // Create a new tab
+ chrome.tabs.create({
+ url: "tab.html"
+ });
+ });
+}
+
+chrome.fileBrowserHandler.onExecute.addListener(executeListener);
+
+// This extension just initializes its chrome.fileBrowserHandler.onExecute
+// event listener, the real testing is done when this extension's handler is
+// invoked from filebrowser_component tests. This event will be raised from that
+// component extension test and it simulates user action in the file browser.
+// tab.html part of this extension can run only after the component raises this
+// event, since that operation sets the propery security context and creates
+// event's payload with proper file Entry instances. tab.html will return
+// results of its execution to filebrowser_component test through a
+// cross-component message.
+chrome.test.succeed();

Powered by Google App Engine
This is Rietveld 408576698