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

Unified Diff: chrome/common/extensions/sync_type_unittest.cc

Issue 16816024: Fix syncing of NPAPI plugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « chrome/common/extensions/sync_helper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/sync_type_unittest.cc
diff --git a/chrome/common/extensions/sync_type_unittest.cc b/chrome/common/extensions/sync_type_unittest.cc
index 73d33d14dc6173dffb412b4eab6061eadfa0bd84..f4c03f6179c6ed453e65fa8172811310a975eaac 100644
--- a/chrome/common/extensions/sync_type_unittest.cc
+++ b/chrome/common/extensions/sync_type_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/files/file_path.h"
+#include "chrome/common/extensions/api/plugins/plugins_handler.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
#include "chrome/common/extensions/manifest.h"
@@ -24,14 +25,15 @@ class ExtensionSyncTypeTest : public testing::Test {
THEME
};
- static scoped_refptr<Extension> MakeSyncTestExtension(
+ static scoped_refptr<Extension> MakeSyncTestExtensionWithPluginPermission(
SyncTestExtensionType type,
const GURL& update_url,
const GURL& launch_url,
Manifest::Location location,
int num_plugins,
const base::FilePath& extension_path,
- int creation_flags) {
+ int creation_flags,
+ bool has_plugin_permission) {
base::DictionaryValue source;
source.SetString(keys::kName, "PossiblySyncableExtension");
source.SetString(keys::kVersion, "0.0.0.0");
@@ -55,6 +57,11 @@ class ExtensionSyncTypeTest : public testing::Test {
}
source.Set(keys::kPlugins, plugins);
}
+ if (has_plugin_permission) {
+ ListValue* plugins = new ListValue();
+ plugins->Set(0, new StringValue("plugin"));
+ source.Set(keys::kPermissions, plugins);
+ }
std::string error;
scoped_refptr<Extension> extension = Extension::Create(
@@ -64,6 +71,19 @@ class ExtensionSyncTypeTest : public testing::Test {
return extension;
}
+ static scoped_refptr<Extension> MakeSyncTestExtension(
+ SyncTestExtensionType type,
+ const GURL& update_url,
+ const GURL& launch_url,
+ Manifest::Location location,
+ int num_plugins,
+ const base::FilePath& extension_path,
+ int creation_flags) {
+ return MakeSyncTestExtensionWithPluginPermission(
+ type, update_url, launch_url, location, num_plugins, extension_path,
+ creation_flags, false);
+ }
+
static const char kValidUpdateUrl1[];
static const char kValidUpdateUrl2[];
};
@@ -238,6 +258,16 @@ TEST_F(ExtensionSyncTypeTest, ExtensionWithTwoPlugins) {
if (extension.get())
EXPECT_FALSE(sync_helper::IsSyncableExtension(extension.get()));
}
+
+TEST_F(ExtensionSyncTypeTest, ExtensionWithPluginPermission) {
+ scoped_refptr<Extension> extension(
+ MakeSyncTestExtensionWithPluginPermission(EXTENSION, GURL(), GURL(),
+ Manifest::INTERNAL,
+ 0, base::FilePath(),
+ Extension::NO_FLAGS, true));
+ if (extension.get())
+ EXPECT_FALSE(sync_helper::IsSyncableExtension(extension));
+}
#endif // !defined(OS_CHROMEOS)
} // namespace extensions
« no previous file with comments | « chrome/common/extensions/sync_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698