forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Extensions Bindings] Add an end-to-end test for the fileSystem API
Add an end-to-end test for the fileSystem API, which exercises a few different niche properties: a) It has an unusual isInstanceOf property (Entry) b) It hacks up the arguments with a setUpdateArgumentsPostValidate hook c) It uses some craziness to bind file entries to the background page a) is already implemented, but this adds an end-to-end test for it. b) required updating logic to no longer parse and validate arguments after a post-update hook. This is unfortunate (see comments for why), but a number of APIs do this, so for now, we have to support it. Add a few comments lamenting the state, and a test to ensure it doesn't break. c) required updating the util js module to not require the method from the API module's custom bindings, since an API instantiated through a require() won't have the apiBridge passed in. APIs should be instatiated through the lazy get; utils should be require()d. BUG=653596 Review-Url: https://codereview.chromium.org/2793033002 Cr-Commit-Position: refs/heads/master@{#461976}
- Loading branch information
Showing
14 changed files
with
203 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
chrome/test/data/extensions/api_test/native_bindings/instance_of/background.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright 2017 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. | ||
|
||
chrome.app.runtime.onLaunched.addListener(function () { | ||
chrome.app.window.create('test.html'); | ||
}); |
11 changes: 11 additions & 0 deletions
11
chrome/test/data/extensions/api_test/native_bindings/instance_of/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "instanceof test", | ||
"version": "1", | ||
"description": "instanceof test", | ||
"permissions": ["fileSystem"], | ||
"app": { | ||
"background": { | ||
"scripts": ["background.js"] | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
chrome/test/data/extensions/api_test/native_bindings/instance_of/test.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<html> | ||
<script src="test.js"></script> | ||
</html> |
17 changes: 17 additions & 0 deletions
17
chrome/test/data/extensions/api_test/native_bindings/instance_of/test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2017 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. | ||
|
||
chrome.test.runTests([ | ||
function getDisplayPath() { | ||
chrome.fileSystem.chooseEntry(function(entry) { | ||
chrome.test.assertEq('text.txt', entry.name); | ||
// Test that we can get the display path of the file. | ||
chrome.fileSystem.getDisplayPath(entry, function(path) { | ||
chrome.test.assertTrue(path.indexOf('native_bindings') >= 0); | ||
chrome.test.assertTrue(path.indexOf('text.txt') >= 0); | ||
chrome.test.succeed(); | ||
}); | ||
}); | ||
}, | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters