summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_function_test_utils.h
diff options
context:
space:
mode:
authormiket@chromium.org <miket@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-11 22:39:07 +0000
committermiket@chromium.org <miket@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-11 22:39:07 +0000
commit0942685d61d6a040a82bffd24728b5ac12b94e27 (patch)
tree582becb1a972155217e5d08e4afde171e3e3992f /chrome/browser/extensions/extension_function_test_utils.h
parent26dae7de0ce12e5ada8bdc2c956e46de9c13d80a (diff)
downloadchromium_src-0942685d61d6a040a82bffd24728b5ac12b94e27.zip
chromium_src-0942685d61d6a040a82bffd24728b5ac12b94e27.tar.gz
chromium_src-0942685d61d6a040a82bffd24728b5ac12b94e27.tar.bz2
Make sure that a given app/extension requests only its own resources.
All ApiResources of a given type live in a single pool. Until now, one app could send arbitrary resource IDs in and get another app's resources if it were lucky. Now we check that an app is getting back only its own resources. Note that this CL could have been shorter if I hadn't decided to break out the owner_extension_id in ApiResource's constructor. I decided to do this anyway because the other way to get that information (asking ApiResourceEventNotifier) violated the Law of Demeter, or even if it was a technical non-violation, I didn't feel good about relying on the incidental fact that AREN knew the extension ID. Ben for OWNERS TBR=ben@chromium.org BUG=142521 TEST=added Review URL: https://chromiumcodereview.appspot.com/10919201 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_function_test_utils.h')
-rw-r--r--chrome/browser/extensions/extension_function_test_utils.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_function_test_utils.h b/chrome/browser/extensions/extension_function_test_utils.h
index cea6e78..e42c1d5 100644
--- a/chrome/browser/extensions/extension_function_test_utils.h
+++ b/chrome/browser/extensions/extension_function_test_utils.h
@@ -54,6 +54,20 @@ scoped_refptr<extensions::Extension> CreateEmptyExtension();
scoped_refptr<extensions::Extension> CreateEmptyExtensionWithLocation(
extensions::Extension::Location location);
+// Creates an empty extension with a variable ID, for tests that require
+// multiple extensions side-by-side having distinct IDs. If not empty, then
+// id_input is passed directly to Extension::CreateId() and thus has the same
+// behavior as that method. If id_input is empty, then Extension::Create()
+// receives an empty explicit ID and generates an appropriate ID for a blank
+// extension.
+scoped_refptr<extensions::Extension> CreateEmptyExtension(
+ const std::string& id_input);
+
+scoped_refptr<extensions::Extension> CreateExtension(
+ extensions::Extension::Location location,
+ base::DictionaryValue* test_extension_value,
+ const std::string& id_input);
+
// Creates an extension instance with a specified extension value that can be
// attached to an ExtensionFunction before running.
scoped_refptr<extensions::Extension> CreateExtension(