| Index: chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc
|
| diff --git a/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc b/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc
|
| index 1dd640632e139fe802089884c38561a75e9a4f0f..f9ee546cec91bfb8da476cd82adb5a909d120985 100644
|
| --- a/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc
|
| +++ b/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc
|
| @@ -13,6 +13,7 @@
|
| #include "chrome/browser/chromeos/policy/user_network_configuration_updater.h"
|
| #include "chrome/browser/chromeos/settings/cros_settings.h"
|
| #include "chrome/browser/chromeos/settings/device_settings_service.h"
|
| +#include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
|
| #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h"
|
| #include "chrome/test/base/testing_profile.h"
|
| #include "chromeos/network/fake_network_device_handler.h"
|
| @@ -198,11 +199,12 @@ ACTION_P(SetCertificateList, list) {
|
|
|
| } // namespace
|
|
|
| -class NetworkConfigurationUpdaterTest : public testing::Test {
|
| +class NetworkConfigurationUpdaterTest : public chromeos::OwnerSettingsTestBase {
|
| protected:
|
| NetworkConfigurationUpdaterTest() : certificate_importer_(NULL) {}
|
|
|
| virtual void SetUp() override {
|
| + chromeos::OwnerSettingsTestBase::SetUp();
|
| EXPECT_CALL(provider_, IsInitializationComplete(_))
|
| .WillRepeatedly(Return(false));
|
| provider_.Init();
|
| @@ -233,6 +235,7 @@ class NetworkConfigurationUpdaterTest : public testing::Test {
|
| }
|
|
|
| virtual void TearDown() override {
|
| + chromeos::OwnerSettingsTestBase::TearDown();
|
| network_configuration_updater_.reset();
|
| provider_.Shutdown();
|
| base::RunLoop().RunUntilIdle();
|
| @@ -258,11 +261,8 @@ class NetworkConfigurationUpdaterTest : public testing::Test {
|
| bool set_cert_importer) {
|
| UserNetworkConfigurationUpdater* updater =
|
| UserNetworkConfigurationUpdater::CreateForUserPolicy(
|
| - &profile_,
|
| - allow_trusted_certs_from_policy,
|
| - fake_user_,
|
| - policy_service_.get(),
|
| - &network_config_handler_).release();
|
| + profile_.get(), allow_trusted_certs_from_policy, fake_user_,
|
| + policy_service_.get(), &network_config_handler_).release();
|
| if (set_cert_importer) {
|
| EXPECT_TRUE(certificate_importer_owned_);
|
| updater->SetCertificateImporterForTest(
|
| @@ -288,10 +288,6 @@ class NetworkConfigurationUpdaterTest : public testing::Test {
|
| network_config_handler_;
|
| FakeNetworkDeviceHandler network_device_handler_;
|
|
|
| - // Not used directly. Required for CrosSettings.
|
| - chromeos::ScopedTestDeviceSettingsService scoped_device_settings_service_;
|
| - chromeos::ScopedTestCrosSettings scoped_cros_settings_;
|
| -
|
| // Ownership of certificate_importer_owned_ is passed to the
|
| // NetworkConfigurationUpdater. When that happens, |certificate_importer_|
|
| // continues to point to that instance but |certificate_importer_owned_| is
|
| @@ -303,38 +299,26 @@ class NetworkConfigurationUpdaterTest : public testing::Test {
|
| scoped_ptr<PolicyServiceImpl> policy_service_;
|
| FakeUser fake_user_;
|
|
|
| - TestingProfile profile_;
|
| -
|
| scoped_ptr<NetworkConfigurationUpdater> network_configuration_updater_;
|
| - content::TestBrowserThreadBundle thread_bundle_;
|
| };
|
|
|
| TEST_F(NetworkConfigurationUpdaterTest, CellularAllowRoaming) {
|
| // Ignore network config updates.
|
| EXPECT_CALL(network_config_handler_, SetPolicy(_, _, _, _)).Times(AtLeast(1));
|
|
|
| - // Setup the DataRoaming device setting.
|
| - chromeos::CrosSettings* cros_settings = chromeos::CrosSettings::Get();
|
| - chromeos::CrosSettingsProvider* device_settings_provider =
|
| - cros_settings->GetProvider(chromeos::kSignedDataRoamingEnabled);
|
| - cros_settings->RemoveSettingsProvider(device_settings_provider);
|
| - delete device_settings_provider;
|
| - chromeos::StubCrosSettingsProvider* stub_settings_provider =
|
| - new chromeos::StubCrosSettingsProvider;
|
| - cros_settings->AddSettingsProvider(stub_settings_provider);
|
| -
|
| - chromeos::CrosSettings::Get()->Set(chromeos::kSignedDataRoamingEnabled,
|
| - base::FundamentalValue(false));
|
| + ReplaceProvider(chromeos::kSignedDataRoamingEnabled);
|
| + owner_settings_service_->SetBoolean(chromeos::kSignedDataRoamingEnabled,
|
| + false);
|
| EXPECT_FALSE(network_device_handler_.allow_roaming_);
|
|
|
| CreateNetworkConfigurationUpdaterForDevicePolicy();
|
| MarkPolicyProviderInitialized();
|
| - chromeos::CrosSettings::Get()->Set(chromeos::kSignedDataRoamingEnabled,
|
| - base::FundamentalValue(true));
|
| + owner_settings_service_->SetBoolean(chromeos::kSignedDataRoamingEnabled,
|
| + true);
|
| EXPECT_TRUE(network_device_handler_.allow_roaming_);
|
|
|
| - chromeos::CrosSettings::Get()->Set(chromeos::kSignedDataRoamingEnabled,
|
| - base::FundamentalValue(false));
|
| + owner_settings_service_->SetBoolean(chromeos::kSignedDataRoamingEnabled,
|
| + false);
|
| EXPECT_FALSE(network_device_handler_.allow_roaming_);
|
| }
|
|
|
|
|