summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormtomasz <mtomasz@chromium.org>2014-09-03 01:49:21 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-03 08:53:58 +0000
commitc171298eff20e7e8efe2e9fd21b9466bfffcb71c (patch)
tree1e9e0c18d2c3d04b571db032ce91c5aa324f414c
parent03573630c9619e21c299eef4fd41c8704421d2a6 (diff)
downloadchromium_src-c171298eff20e7e8efe2e9fd21b9466bfffcb71c.zip
chromium_src-c171298eff20e7e8efe2e9fd21b9466bfffcb71c.tar.gz
chromium_src-c171298eff20e7e8efe2e9fd21b9466bfffcb71c.tar.bz2
[fsp] Enable the File System Provider API for extensions.
Previously, only apps were allowed to use this api, however most clients will be actually written as extensions. TEST=browser_tests: *FileSystemProvider*Extension* BUG=409487 Review URL: https://codereview.chromium.org/527663002 Cr-Commit-Position: refs/heads/master@{#293100}
-rw-r--r--chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_apitest.cc6
-rw-r--r--chrome/common/extensions/api/_permission_features.json2
-rw-r--r--chrome/common/extensions/docs/templates/public/extensions/fileSystemProvider.html1
-rw-r--r--chrome/test/data/extensions/api_test/file_system_provider/extension/manifest.json15
-rw-r--r--chrome/test/data/extensions/api_test/file_system_provider/extension/test.js21
5 files changed, 44 insertions, 1 deletions
diff --git a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_apitest.cc b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_apitest.cc
index a7381e4..717fa3d 100644
--- a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_apitest.cc
+++ b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_apitest.cc
@@ -120,4 +120,10 @@ IN_PROC_BROWSER_TEST_F(FileSystemProviderApiTest, WriteFile) {
<< message_;
}
+IN_PROC_BROWSER_TEST_F(FileSystemProviderApiTest, Extension) {
+ ASSERT_TRUE(RunPlatformAppTestWithFlags("file_system_provider/extension",
+ kFlagLoadAsComponent))
+ << message_;
+}
+
} // namespace extensions
diff --git a/chrome/common/extensions/api/_permission_features.json b/chrome/common/extensions/api/_permission_features.json
index e99372d..11c7e16 100644
--- a/chrome/common/extensions/api/_permission_features.json
+++ b/chrome/common/extensions/api/_permission_features.json
@@ -559,7 +559,7 @@
}],
"fileSystemProvider": {
"channel": "dev",
- "extension_types": ["platform_app"]
+ "extension_types": ["extension", "platform_app"]
},
"firstRunPrivate": {
"channel": "stable",
diff --git a/chrome/common/extensions/docs/templates/public/extensions/fileSystemProvider.html b/chrome/common/extensions/docs/templates/public/extensions/fileSystemProvider.html
new file mode 100644
index 0000000..8f3e547
--- /dev/null
+++ b/chrome/common/extensions/docs/templates/public/extensions/fileSystemProvider.html
@@ -0,0 +1 @@
+{{+partials.standard_extensions_api api:apis.extensions.fileSystemProvider intro:intros.fileSystemProvider/}}
diff --git a/chrome/test/data/extensions/api_test/file_system_provider/extension/manifest.json b/chrome/test/data/extensions/api_test/file_system_provider/extension/manifest.json
new file mode 100644
index 0000000..b81661a
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/file_system_provider/extension/manifest.json
@@ -0,0 +1,15 @@
+{
+ "key": "MIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDOuXEIuoK1kAkBe0SKiJn/N9oNn3oUxGa4dwj40MnJqPn+w0aR2vuyocm0R4Drp67aYwtLjOVPF4CICRq6ICP6eU07gGwQxGdZ7HJASXV8hm0tab5I70oJmRLfFJyVAMCeWlFaOGq05v2i6EbifZM0qO5xALKNGQt+yjXi5INM5wIBIw==",
+ "name": "chrome.fileSystemProvider.mount in extensions",
+ "version": "0.1",
+ "manifest_version": 2,
+ "description": "Test for chrome.fileSystemProvider.mount() in an extension.",
+ "permissions": ["fileSystemProvider", "fileBrowserPrivate"],
+ "background": {
+ "persistent": false,
+ "scripts": [
+ "chrome-extension://gfnblenhaahcnmfdbebgincjohfkbnch/test_util.js",
+ "test.js"
+ ]
+ }
+}
diff --git a/chrome/test/data/extensions/api_test/file_system_provider/extension/test.js b/chrome/test/data/extensions/api_test/file_system_provider/extension/test.js
new file mode 100644
index 0000000..e734b8b
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/file_system_provider/extension/test.js
@@ -0,0 +1,21 @@
+// Copyright 2014 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.
+
+'use strict';
+
+chrome.test.runTests([
+ // Tests if mounting succeeds when invoked from an extension. Note that all
+ // other tests are implemented as apps.
+ function mount() {
+ var onTestSuccess = chrome.test.callbackPass();
+ chrome.fileSystemProvider.mount(
+ {fileSystemId: 'file-system-id', displayName: 'file-system-name'},
+ function() {
+ onTestSuccess();
+ },
+ function(error) {
+ chrome.test.fail();
+ });
+ },
+]);