diff options
10 files changed, 68 insertions, 21 deletions
diff --git a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc index 7886eed..93637c2 100644 --- a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc +++ b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc @@ -8,15 +8,16 @@ #include "chrome/browser/chromeos/login/user.h" #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/extensions/extension_apitest.h" +#include "chrome/common/chrome_switches.h" +#include "chrome/test/base/ui_test_utils.h" +#include "testing/gmock/include/gmock/gmock.h" + +#if defined(OS_CHROMEOS) #include "chrome/browser/policy/browser_policy_connector.h" #include "chrome/browser/policy/external_data_fetcher.h" #include "chrome/browser/policy/mock_configuration_policy_provider.h" #include "chrome/browser/policy/policy_map.h" #include "chrome/browser/policy/policy_types.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/test/base/ui_test_utils.h" - -#if defined(OS_CHROMEOS) #include "chromeos/chromeos_switches.h" #include "chromeos/dbus/cryptohome_client.h" #include "chromeos/dbus/dbus_thread_manager.h" @@ -30,6 +31,7 @@ #include "policy/policy_constants.h" #include "third_party/cros_system_api/dbus/service_constants.h" #endif // OS_CHROMEOS + using testing::AnyNumber; using testing::Return; using testing::_; @@ -40,7 +42,6 @@ namespace chromeos { const char kUser1ProfilePath[] = "/profile/user1/shill"; #endif // defined(OS_CHROMEOS) - class ExtensionNetworkingPrivateApiTest : public ExtensionApiTest, public testing::WithParamInterface<bool> { @@ -52,10 +53,12 @@ class ExtensionNetworkingPrivateApiTest : } virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { +#if defined(OS_CHROMEOS) EXPECT_CALL(provider_, IsInitializationComplete(_)) .WillRepeatedly(Return(true)); EXPECT_CALL(provider_, RegisterPolicyDomain(_)).Times(AnyNumber()); policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); +#endif ExtensionApiTest::SetUpInProcessBrowserTestFixture(); } @@ -224,8 +227,10 @@ class ExtensionNetworkingPrivateApiTest : #endif // OS_CHROMEOS protected: +#if defined(OS_CHROMEOS) policy::MockConfigurationPolicyProvider provider_; std::string userhash_; +#endif }; // Place each subtest into a separate browser test so that the stub networking diff --git a/chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc b/chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc index 644cffa..ecb4781 100644 --- a/chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc +++ b/chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc @@ -8,9 +8,6 @@ #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "base/values.h" -#include "chrome/browser/policy/browser_policy_connector.h" -#include "chrome/browser/policy/mock_configuration_policy_provider.h" -#include "chrome/browser/policy/policy_map.h" #include "chrome/browser/prefs/synced_pref_change_registrar.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/pref_names.h" @@ -18,13 +15,19 @@ #include "chrome/test/base/testing_pref_service_syncable.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_utils.h" -#include "policy/policy_constants.h" #include "sync/api/sync_change.h" #include "sync/api/sync_error_factory.h" #include "sync/api/sync_error_factory_mock.h" #include "sync/api/syncable_service.h" #include "sync/protocol/sync.pb.h" +#if defined(ENABLE_CONFIGURATION_POLICY) +#include "chrome/browser/policy/browser_policy_connector.h" +#include "chrome/browser/policy/mock_configuration_policy_provider.h" +#include "chrome/browser/policy/policy_map.h" +#include "policy/policy_constants.h" +#endif + namespace { using testing::AnyNumber; @@ -49,12 +52,14 @@ class SyncedPrefChangeRegistrarTest : public InProcessBrowserTest { SyncedPrefChangeRegistrarTest() : next_sync_data_id_(0) {} virtual ~SyncedPrefChangeRegistrarTest() {} +#if defined(ENABLE_CONFIGURATION_POLICY) void UpdateChromePolicy(const policy::PolicyMap& policies) { policy_provider_.UpdateChromePolicy(policies); DCHECK(base::MessageLoop::current()); base::RunLoop loop; loop.RunUntilIdle(); } +#endif void SetBooleanPrefValueFromSync(const std::string& name, bool value) { std::string serialized_value; @@ -95,6 +100,7 @@ class SyncedPrefChangeRegistrarTest : public InProcessBrowserTest { } private: +#if defined(ENABLE_CONFIGURATION_POLICY) virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { EXPECT_CALL(policy_provider_, IsInitializationComplete(_)) .WillRepeatedly(Return(true)); @@ -102,6 +108,7 @@ class SyncedPrefChangeRegistrarTest : public InProcessBrowserTest { policy::BrowserPolicyConnector::SetPolicyProviderForTesting( &policy_provider_); } +#endif virtual void SetUpOnMainThread() OVERRIDE { prefs_ = PrefServiceSyncable::FromProfile(browser()->profile()); @@ -123,7 +130,9 @@ class SyncedPrefChangeRegistrarTest : public InProcessBrowserTest { int next_sync_data_id_; scoped_ptr<SyncedPrefChangeRegistrar> registrar_; +#if defined(ENABLE_CONFIGURATION_POLICY) policy::MockConfigurationPolicyProvider policy_provider_; +#endif }; struct TestSyncedPrefObserver { @@ -179,6 +188,7 @@ IN_PROC_BROWSER_TEST_F(SyncedPrefChangeRegistrarTest, EXPECT_FALSE(observer.last_seen_value); } +#if defined(ENABLE_CONFIGURATION_POLICY) IN_PROC_BROWSER_TEST_F(SyncedPrefChangeRegistrarTest, IgnoreLocalChangesToManagedPrefs) { TestSyncedPrefObserver observer = {}; @@ -219,3 +229,4 @@ IN_PROC_BROWSER_TEST_F(SyncedPrefChangeRegistrarTest, EXPECT_FALSE(observer.has_been_notified); EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); } +#endif diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc index c8ac37f..0726f0c 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc +++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc @@ -199,13 +199,6 @@ void OneClickSigninSyncStarter::OnRegisteredForPolicy( new SigninDialogDelegate(weak_pointer_factory_.GetWeakPtr())); } -void OneClickSigninSyncStarter::CancelSigninAndDelete() { - SigninManagerFactory::GetForProfile(profile_)->SignOut(); - // The statement above results in a call to SigninFailed() which will free - // this object, so do not refer to the OneClickSigninSyncStarter object - // after this point. -} - void OneClickSigninSyncStarter::LoadPolicyWithCachedClient() { DCHECK(policy_client_); policy::UserPolicySigninService* policy_service = @@ -306,6 +299,13 @@ void OneClickSigninSyncStarter::CompleteInitForNewProfile( } #endif +void OneClickSigninSyncStarter::CancelSigninAndDelete() { + SigninManagerFactory::GetForProfile(profile_)->SignOut(); + // The statement above results in a call to SigninFailed() which will free + // this object, so do not refer to the OneClickSigninSyncStarter object + // after this point. +} + void OneClickSigninSyncStarter::ConfirmAndSignin() { SigninManager* signin = SigninManagerFactory::GetForProfile(profile_); if (confirmation_required_ == CONFIRM_UNTRUSTED_SIGNIN) { diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.h b/chrome/browser/ui/sync/one_click_signin_sync_starter.h index 60bd105..5d09c58 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_starter.h +++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.h @@ -155,9 +155,10 @@ class OneClickSigninSyncStarter : public SigninTracker::Observer, Profile* profile, Profile::CreateStatus status); +#endif // defined(ENABLE_CONFIGURATION_POLICY) + // Cancels the in-progress signin for this profile. void CancelSigninAndDelete(); -#endif // defined(ENABLE_CONFIGURATION_POLICY) // Callback invoked to check whether the user needs policy or if a // confirmation is required (in which case we have to prompt the user first). diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index bde65b5..bd59e9b 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2732,7 +2732,7 @@ 'browser/media_galleries/fileapi/safe_picasa_albums_indexer.h', ], }], - ['OS!="android" and OS!="ios" and chromeos==0', { + ['OS!="android" and OS!="ios" and chromeos==0 and configuration_policy==1', { 'sources': [ 'browser/download/download_dir_policy_handler.cc', 'browser/download/download_dir_policy_handler.h', @@ -2844,6 +2844,16 @@ ['exclude', '^browser/policy/'], ['exclude', 'browser/net/disk_cache_dir_policy_handler.cc'], ['exclude', 'browser/net/disk_cache_dir_policy_handler.h'], + ['exclude', 'browser/net/proxy_policy_handler.cc'], + ['exclude', 'browser/net/proxy_policy_handler.h'], + ['exclude', 'browser/profiles/incognito_mode_policy_handler.cc'], + ['exclude', 'browser/profiles/incognito_mode_policy_handler.h'], + ['exclude', 'browser/search_engines/default_search_policy_handler.cc'], + ['exclude', 'browser/search_engines/default_search_policy_handler.h'], + ['exclude', 'browser/sessions/restore_on_startup_policy_handler.cc'], + ['exclude', 'browser/sessions/restore_on_startup_policy_handler.h'], + ['exclude', 'browser/sync/sync_policy_handler.cc'], + ['exclude', 'browser/sync/sync_policy_handler.h'], ['include', 'browser/policy/external_data_fetcher.cc'], ['include', 'browser/policy/external_data_fetcher.h'], ['include', 'browser/policy/external_data_manager.h'], diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index fbec12f..7f0d640 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -1045,6 +1045,8 @@ 'browser/extensions/api/storage/managed_value_store_cache.h', 'browser/extensions/api/storage/policy_value_store.cc', 'browser/extensions/api/storage/policy_value_store.h', + 'browser/extensions/policy_handlers.cc', + 'browser/extensions/policy_handlers.h', ], }], ['OS=="win"', { diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 326ea38..f788af3 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1773,8 +1773,9 @@ ['exclude', '^browser/policy/'], ], 'sources!': [ - 'browser/ui/webui/policy_ui_browsertest.cc', + 'browser/ui/webui/options/certificate_manager_browsertest.cc', 'browser/ui/webui/options/preferences_browsertest.cc', + 'browser/ui/webui/policy_ui_browsertest.cc', ], }], ['input_speech==0', { diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 6251662..44c5f5a 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -2223,7 +2223,13 @@ ['configuration_policy==0', { 'sources!': [ 'browser/extensions/api/storage/policy_value_store_unittest.cc', + 'browser/extensions/policy_handlers_unittest.cc', + 'browser/net/proxy_policy_handler_unittest.cc', 'browser/prefs/proxy_policy_unittest.cc', + 'browser/profiles/incognito_mode_policy_handler_unittest.cc', + 'browser/search_engines/default_search_policy_handler_unittest.cc', + 'browser/sessions/restore_on_startup_policy_handler_unittest.cc', + 'browser/sync/sync_policy_handler_unittest.cc', ], 'sources/': [ ['exclude', '^browser/policy/'], @@ -2681,7 +2687,7 @@ }], ], }], # OS == android - ['OS!="android" and OS!="ios" and chromeos==0', { + ['OS!="android" and OS!="ios" and chromeos==0 and configuration_policy==1', { 'sources': [ 'browser/download/download_dir_policy_handler_unittest.cc', 'browser/net/disk_cache_dir_policy_handler_unittest.cc', diff --git a/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc b/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc index a9bef0ce..ed4edee 100644 --- a/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc +++ b/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc @@ -14,12 +14,15 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "chrome/common/extensions/extension.h" -#include "components/policy/core/common/schema.h" #include "extensions/common/install_warning.h" #include "extensions/common/manifest.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/permissions/api_permission.h" +#if defined(ENABLE_CONFIGURATION_POLICY) +#include "components/policy/core/common/schema.h" +#endif + using extensions::manifest_keys::kStorageManagedSchema; namespace extensions { @@ -28,6 +31,7 @@ StorageSchemaManifestHandler::StorageSchemaManifestHandler() {} StorageSchemaManifestHandler::~StorageSchemaManifestHandler() {} +#if defined(ENABLE_CONFIGURATION_POLICY) // static scoped_ptr<policy::SchemaOwner> StorageSchemaManifestHandler::GetSchema( const Extension* extension, @@ -58,6 +62,7 @@ scoped_ptr<policy::SchemaOwner> StorageSchemaManifestHandler::GetSchema( } return policy::SchemaOwner::Parse(content, error); } +#endif bool StorageSchemaManifestHandler::Parse(Extension* extension, string16* error) { @@ -74,7 +79,11 @@ bool StorageSchemaManifestHandler::Validate( const Extension* extension, std::string* error, std::vector<InstallWarning>* warnings) const { +#if defined(ENABLE_CONFIGURATION_POLICY) return !!GetSchema(extension, error); +#else + return true; +#endif } const std::vector<std::string> StorageSchemaManifestHandler::Keys() const { diff --git a/chrome/common/extensions/api/storage/storage_schema_manifest_handler.h b/chrome/common/extensions/api/storage/storage_schema_manifest_handler.h index d2406d6..a387d52 100644 --- a/chrome/common/extensions/api/storage/storage_schema_manifest_handler.h +++ b/chrome/common/extensions/api/storage/storage_schema_manifest_handler.h @@ -20,12 +20,14 @@ class StorageSchemaManifestHandler : public ManifestHandler { StorageSchemaManifestHandler(); virtual ~StorageSchemaManifestHandler(); +#if defined(ENABLE_CONFIGURATION_POLICY) // Returns the managed storage schema defined for |extension|. // If the schema is invalid then NULL is returned, and the failure reason // is stored in |error|. // This function does file I/O and must be called on a thread that allows I/O. static scoped_ptr<policy::SchemaOwner> GetSchema(const Extension* extension, std::string* error); +#endif private: // ManifestHandler implementation: |