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

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

Issue 353493002: Apps&Extensions for supervised users: Add Extension::WAS_INSTALLED_BY_CUSTODIAN flag and proto entry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update test Created 6 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/browser/extensions/extension_service_unittest.cc
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index e4b3556040c7f69266870589664b43261df61bad..905785136473143220a52655ab7179406b660bfe 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -2881,13 +2881,16 @@ TEST_F(ExtensionServiceTest, AddPendingExtensionFromSync) {
const GURL kFakeUpdateURL("http:://fake.update/url");
const bool kFakeInstallSilently(true);
const bool kFakeRemoteInstall(false);
+ const bool kFakeInstalledByCustodian(false);
EXPECT_TRUE(
- service()->pending_extension_manager()->AddFromSync(kFakeId,
- kFakeUpdateURL,
- &IsExtension,
- kFakeInstallSilently,
- kFakeRemoteInstall));
+ service()->pending_extension_manager()->AddFromSync(
+ kFakeId,
+ kFakeUpdateURL,
+ &IsExtension,
+ kFakeInstallSilently,
+ kFakeRemoteInstall,
+ kFakeInstalledByCustodian));
const extensions::PendingExtensionInfo* pending_extension_info;
ASSERT_TRUE((pending_extension_info =
@@ -2913,17 +2916,20 @@ const char kGoodUpdateURL[] = "http://good.update/url";
const bool kGoodIsFromSync = true;
const bool kGoodInstallSilently = true;
const bool kGoodRemoteInstall = false;
+const bool kGoodInstalledByCustodian = false;
} // namespace
// Test updating a pending extension.
TEST_F(ExtensionServiceTest, UpdatePendingExtension) {
InitializeEmptyExtensionService();
EXPECT_TRUE(
- service()->pending_extension_manager()->AddFromSync(kGoodId,
- GURL(kGoodUpdateURL),
- &IsExtension,
- kGoodInstallSilently,
- kGoodRemoteInstall));
+ service()->pending_extension_manager()->AddFromSync(
+ kGoodId,
+ GURL(kGoodUpdateURL),
+ &IsExtension,
+ kGoodInstallSilently,
+ kGoodRemoteInstall,
+ kGoodInstalledByCustodian));
EXPECT_TRUE(service()->pending_extension_manager()->IsIdPending(kGoodId));
base::FilePath path = data_dir().AppendASCII("good.crx");
@@ -2948,7 +2954,7 @@ bool IsTheme(const Extension* extension) {
TEST_F(ExtensionServiceTest, DISABLED_UpdatePendingTheme) {
InitializeEmptyExtensionService();
EXPECT_TRUE(service()->pending_extension_manager()->AddFromSync(
- theme_crx, GURL(), &IsTheme, false, false));
+ theme_crx, GURL(), &IsTheme, false, false, false));
EXPECT_TRUE(service()->pending_extension_manager()->IsIdPending(theme_crx));
base::FilePath path = data_dir().AppendASCII("theme.crx");
@@ -3008,11 +3014,13 @@ TEST_F(ExtensionServiceTest, UpdatePendingExternalCrxWinsOverSync) {
// Add a crx to be installed from the update mechanism.
EXPECT_TRUE(
- service()->pending_extension_manager()->AddFromSync(kGoodId,
- GURL(kGoodUpdateURL),
- &IsExtension,
- kGoodInstallSilently,
- kGoodRemoteInstall));
+ service()->pending_extension_manager()->AddFromSync(
+ kGoodId,
+ GURL(kGoodUpdateURL),
+ &IsExtension,
+ kGoodInstallSilently,
+ kGoodRemoteInstall,
+ kGoodInstalledByCustodian));
// Check that there is a pending crx, with is_from_sync set to true.
const extensions::PendingExtensionInfo* pending_extension_info;
@@ -3038,11 +3046,13 @@ TEST_F(ExtensionServiceTest, UpdatePendingExternalCrxWinsOverSync) {
// Add a crx to be installed from the update mechanism.
EXPECT_FALSE(
- service()->pending_extension_manager()->AddFromSync(kGoodId,
- GURL(kGoodUpdateURL),
- &IsExtension,
- kGoodInstallSilently,
- kGoodRemoteInstall));
+ service()->pending_extension_manager()->AddFromSync(
+ kGoodId,
+ GURL(kGoodUpdateURL),
+ &IsExtension,
+ kGoodInstallSilently,
+ kGoodRemoteInstall,
+ kGoodInstalledByCustodian));
// Check that the external, non-sync update was not overridden.
ASSERT_TRUE((pending_extension_info =
@@ -3057,7 +3067,7 @@ TEST_F(ExtensionServiceTest, UpdatePendingExternalCrxWinsOverSync) {
TEST_F(ExtensionServiceTest, UpdatePendingCrxThemeMismatch) {
InitializeEmptyExtensionService();
EXPECT_TRUE(service()->pending_extension_manager()->AddFromSync(
- theme_crx, GURL(), &IsExtension, true, false));
+ theme_crx, GURL(), &IsExtension, true, false, false));
EXPECT_TRUE(service()->pending_extension_manager()->IsIdPending(theme_crx));
@@ -3079,11 +3089,13 @@ TEST_F(ExtensionServiceTest, UpdatePendingExtensionFailedShouldInstallTest) {
InitializeEmptyExtensionService();
// Add pending extension with a flipped is_theme.
EXPECT_TRUE(
- service()->pending_extension_manager()->AddFromSync(kGoodId,
- GURL(kGoodUpdateURL),
- &IsTheme,
- kGoodInstallSilently,
- kGoodRemoteInstall));
+ service()->pending_extension_manager()->AddFromSync(
+ kGoodId,
+ GURL(kGoodUpdateURL),
+ &IsTheme,
+ kGoodInstallSilently,
+ kGoodRemoteInstall,
+ kGoodInstalledByCustodian));
EXPECT_TRUE(service()->pending_extension_manager()->IsIdPending(kGoodId));
base::FilePath path = data_dir().AppendASCII("good.crx");
@@ -6465,7 +6477,8 @@ class ExtensionSourcePriorityTest : public ExtensionServiceTest {
GURL(kGoodUpdateURL),
&IsExtension,
kGoodInstallSilently,
- kGoodRemoteInstall);
+ kGoodRemoteInstall,
+ kGoodInstalledByCustodian);
}
// Fake a policy install.

Powered by Google App Engine
This is Rietveld 408576698