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

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
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 c64d8b838a1a90a6f35bd1c2193e395db3606d68..a74ed865e33e35f8bab8b132458b192d04c8ba10 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) {
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));
}
+
+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
« chrome/common/extensions/sync_helper.cc ('K') | « chrome/common/extensions/sync_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698