From 0942685d61d6a040a82bffd24728b5ac12b94e27 Mon Sep 17 00:00:00 2001 From: "miket@chromium.org" Date: Tue, 11 Sep 2012 22:39:07 +0000 Subject: 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 --- chrome/browser/extensions/extension_function_test_utils.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'chrome/browser/extensions/extension_function_test_utils.h') 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 CreateEmptyExtension(); scoped_refptr 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 CreateEmptyExtension( + const std::string& id_input); + +scoped_refptr 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 CreateExtension( -- cgit v1.1