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

Unified Diff: chrome/browser/extensions/permission_message_combinations_unittest.cc

Issue 1047943002: Cache --whitelisted-extension-id in SimpleFeature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Expose SetWhitelistedExtensionId for tests. Created 5 years, 8 months 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/browser/extensions/permission_message_combinations_unittest.cc
diff --git a/chrome/browser/extensions/permission_message_combinations_unittest.cc b/chrome/browser/extensions/permission_message_combinations_unittest.cc
index 7581ff1d42618ca91b4167cdc2b85899086ceaf3..595ffa042868007848aaa7546b532065829383ef 100644
--- a/chrome/browser/extensions/permission_message_combinations_unittest.cc
+++ b/chrome/browser/extensions/permission_message_combinations_unittest.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/extensions/test_extension_environment.h"
#include "chrome/common/extensions/permissions/chrome_permission_message_provider.h"
#include "extensions/common/extension.h"
+#include "extensions/common/features/simple_feature.h"
#include "extensions/common/permissions/permission_message_test_util.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/switches.h"
@@ -16,6 +17,8 @@
namespace extensions {
+const char kWhitelistedExtensionID[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
+
// Tests that ChromePermissionMessageProvider produces the expected messages for
// various combinations of app/extension permissions.
class PermissionMessageCombinationsUnittest : public testing::Test {
@@ -29,6 +32,11 @@ class PermissionMessageCombinationsUnittest : public testing::Test {
testing::Test::SetUp();
// Force creation of ExtensionPrefs before adding extensions.
env_.GetExtensionPrefs();
+
+ // Whitelist a known extension id so we can test all permissions. This ID
+ // will be used for each test app.
+ extensions::SimpleFeature::SetWhitelistedExtensionId(
+ kWhitelistedExtensionID);
}
protected:
@@ -39,10 +47,8 @@ class PermissionMessageCombinationsUnittest : public testing::Test {
std::replace(json_manifest_with_double_quotes.begin(),
json_manifest_with_double_quotes.end(), '\'', '"');
app_ = env_.MakeExtension(
- *base::test::ParseJson(json_manifest_with_double_quotes));
- // Add the app to any whitelists so we can test all permissions.
- base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
- switches::kWhitelistedExtensionID, app_->id());
+ *base::test::ParseJson(json_manifest_with_double_quotes),
+ kWhitelistedExtensionID);
}
// Checks whether the currently installed app or extension produces the given
« no previous file with comments | « no previous file | chrome/browser/extensions/test_extension_environment.h » ('j') | extensions/common/features/simple_feature.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698