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

Unified Diff: chrome/browser/policy/network_configuration_updater_unittest.cc

Issue 9111022: Removed ConfigurationPolicyType and extended PolicyMap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 12 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/policy/network_configuration_updater_unittest.cc
diff --git a/chrome/browser/policy/network_configuration_updater_unittest.cc b/chrome/browser/policy/network_configuration_updater_unittest.cc
index 6ce1f7ab7c7c95c39a2c008eb3ebd89d34853e11..083f8ca28059a1f7053fef6a5742f7329543f387 100644
--- a/chrome/browser/policy/network_configuration_updater_unittest.cc
+++ b/chrome/browser/policy/network_configuration_updater_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,20 +18,19 @@ namespace policy {
static const char kFakeONC[] = "{ \"GUID\": \"1234\" }";
class NetworkConfigurationUpdaterTest
- : public testing::TestWithParam<ConfigurationPolicyType> {
+ : public testing::TestWithParam<const char*> {
protected:
virtual void SetUp() OVERRIDE {
EXPECT_CALL(network_library_, LoadOncNetworks(_, "", _, _))
.WillRepeatedly(Return(true));
}
- // Maps configuration policy type to corresponding ONC source.
- static chromeos::NetworkUIData::ONCSource TypeToONCSource(
- ConfigurationPolicyType type) {
- switch (type) {
- case kPolicyDeviceOpenNetworkConfiguration:
+ // Maps configuration policy name to corresponding ONC source.
+ static chromeos::NetworkUIData::ONCSource NameToONCSource(const char* name) {
+ switch (name) {
+ case key::kDeviceOpenNetworkConfiguration:
return chromeos::NetworkUIData::ONC_SOURCE_DEVICE_POLICY;
- case kPolicyOpenNetworkConfiguration:
+ case key::kOpenNetworkConfiguration:
return chromeos::NetworkUIData::ONC_SOURCE_USER_POLICY;
default:
return chromeos::NetworkUIData::ONC_SOURCE_NONE;
@@ -46,7 +45,7 @@ TEST_P(NetworkConfigurationUpdaterTest, InitialUpdate) {
provider_.AddPolicy(GetParam(), Value::CreateStringValue(kFakeONC));
EXPECT_CALL(network_library_,
- LoadOncNetworks(kFakeONC, "", TypeToONCSource(GetParam()), _))
+ LoadOncNetworks(kFakeONC, "", NameToONCSource(GetParam()), _))
.WillOnce(Return(true));
NetworkConfigurationUpdater updater(&provider_, &network_library_);
@@ -58,7 +57,7 @@ TEST_P(NetworkConfigurationUpdaterTest, PolicyChange) {
// We should update if policy changes.
EXPECT_CALL(network_library_,
- LoadOncNetworks(kFakeONC, "", TypeToONCSource(GetParam()), _))
+ LoadOncNetworks(kFakeONC, "", NameToONCSource(GetParam()), _))
.WillOnce(Return(true));
provider_.AddPolicy(GetParam(), Value::CreateStringValue(kFakeONC));
provider_.NotifyPolicyUpdated();
@@ -66,7 +65,7 @@ TEST_P(NetworkConfigurationUpdaterTest, PolicyChange) {
// No update if the set the same value again.
EXPECT_CALL(network_library_,
- LoadOncNetworks(kFakeONC, "", TypeToONCSource(GetParam()), _))
+ LoadOncNetworks(kFakeONC, "", NameToONCSource(GetParam()), _))
.Times(0);
provider_.NotifyPolicyUpdated();
Mock::VerifyAndClearExpectations(&network_library_);
@@ -74,7 +73,7 @@ TEST_P(NetworkConfigurationUpdaterTest, PolicyChange) {
// Another update is expected if the policy goes away.
EXPECT_CALL(network_library_,
LoadOncNetworks(NetworkConfigurationUpdater::kEmptyConfiguration,
- "", TypeToONCSource(GetParam()), _))
+ "", NameToONCSource(GetParam()), _))
.WillOnce(Return(true));
provider_.RemovePolicy(GetParam());
provider_.NotifyPolicyUpdated();
@@ -84,7 +83,7 @@ TEST_P(NetworkConfigurationUpdaterTest, PolicyChange) {
INSTANTIATE_TEST_CASE_P(
NetworkConfigurationUpdaterTestInstance,
NetworkConfigurationUpdaterTest,
- testing::Values(kPolicyDeviceOpenNetworkConfiguration,
- kPolicyOpenNetworkConfiguration));
+ testing::Values(key::kDeviceOpenNetworkConfiguration,
+ key::kOpenNetworkConfiguration));
} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698