UpdateManager: rename UpdateCurrentConnectionAllowed into UpdateDownloadAllowed.

The signifies the *functional* nature of this policy request, instead of
dwelling on the low-level information it is evaluating.

BUG=chromium:389677
TEST=Unit tests.

Change-Id: I684ea13d4e89554b6a4d596666c18e2dbd609991
Reviewed-on: https://chromium-review.googlesource.com/206903
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/update_manager/chromeos_policy.cc b/update_manager/chromeos_policy.cc
index fc73d0d..e2de820 100644
--- a/update_manager/chromeos_policy.cc
+++ b/update_manager/chromeos_policy.cc
@@ -80,7 +80,7 @@
     case ErrorCode::kDownloadTransferError:
     case ErrorCode::kDownloadWriteError:
     case ErrorCode::kDownloadStateInitializationError:
-    case ErrorCode::kOmahaErrorInHTTPResponse: // Aggregate for HTTP errors.
+    case ErrorCode::kOmahaErrorInHTTPResponse:  // Aggregate for HTTP errors.
       LOG(INFO) << "Incrementing URL failure count due to error "
                 << chromeos_update_engine::utils::CodeToString(err_code)
                 << " (" << static_cast<int>(err_code) << ")";
@@ -301,7 +301,7 @@
 // updates over a cellular network (disabled by default). We may want to
 // revisit this semantics, allowing greater flexibility in defining specific
 // permissions over all types of networks.
-EvalStatus ChromeOSPolicy::UpdateCurrentConnectionAllowed(
+EvalStatus ChromeOSPolicy::UpdateDownloadAllowed(
     EvaluationContext* ec,
     State* state,
     string* error,
diff --git a/update_manager/chromeos_policy.h b/update_manager/chromeos_policy.h
index 09f55c4..aa076ec 100644
--- a/update_manager/chromeos_policy.h
+++ b/update_manager/chromeos_policy.h
@@ -47,7 +47,7 @@
       const bool interactive,
       const UpdateState& update_state) const override;
 
-  virtual EvalStatus UpdateCurrentConnectionAllowed(
+  virtual EvalStatus UpdateDownloadAllowed(
       EvaluationContext* ec,
       State* state,
       std::string* error,
diff --git a/update_manager/chromeos_policy_unittest.cc b/update_manager/chromeos_policy_unittest.cc
index 6c6eeff..0d19720 100644
--- a/update_manager/chromeos_policy_unittest.cc
+++ b/update_manager/chromeos_policy_unittest.cc
@@ -47,7 +47,7 @@
     fake_state_.updater_provider()->var_last_checked_time()->reset(
         new Time(fake_clock_.GetWallclockTime()));
     fake_state_.updater_provider()->var_consecutive_failed_update_checks()->
-        reset(new unsigned int(0));
+        reset(new unsigned int(0));  // NOLINT(readability/casting)
 
     fake_state_.random_provider()->var_seed()->reset(
         new uint64_t(4));  // chosen by fair dice roll.
@@ -160,7 +160,7 @@
   Time next_update_check;
 
   fake_state_.updater_provider()->var_consecutive_failed_update_checks()->
-      reset(new unsigned int(100));
+      reset(new unsigned int(100));  // NOLINT(readability/casting)
   ExpectPolicyStatus(EvalStatus::kSucceeded,
                      &ChromeOSPolicy::NextUpdateCheckTime, &next_update_check);
 
@@ -700,7 +700,7 @@
   EXPECT_EQ(0, result.download_url_num_failures);
 }
 
-TEST_F(UmChromeOSPolicyTest, UpdateCurrentConnectionAllowedEthernetDefault) {
+TEST_F(UmChromeOSPolicyTest, UpdateDownloadAllowedEthernetDefault) {
   // Ethernet is always allowed.
 
   fake_state_.shill_provider()->var_conn_type()->
@@ -708,11 +708,11 @@
 
   bool result;
   ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCurrentConnectionAllowed, &result);
+                     &Policy::UpdateDownloadAllowed, &result);
   EXPECT_TRUE(result);
 }
 
-TEST_F(UmChromeOSPolicyTest, UpdateCurrentConnectionAllowedWifiDefault) {
+TEST_F(UmChromeOSPolicyTest, UpdateDownloadAllowedWifiDefault) {
   // Wifi is allowed if not tethered.
 
   fake_state_.shill_provider()->var_conn_type()->
@@ -720,7 +720,7 @@
 
   bool result;
   ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCurrentConnectionAllowed, &result);
+                     &Policy::UpdateDownloadAllowed, &result);
   EXPECT_TRUE(result);
 }
 
@@ -735,12 +735,12 @@
 
   bool result;
   ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCurrentConnectionAllowed, &result);
+                     &Policy::UpdateDownloadAllowed, &result);
   EXPECT_FALSE(result);
 }
 
 TEST_F(UmChromeOSPolicyTest,
-       UpdateCurrentConnectionAllowedWifiTetheredPolicyOverride) {
+       UpdateDownloadAllowedWifiTetheredPolicyOverride) {
   // Tethered wifi can be allowed by policy.
 
   fake_state_.shill_provider()->var_conn_type()->
@@ -755,11 +755,11 @@
 
   bool result;
   ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCurrentConnectionAllowed, &result);
+                     &Policy::UpdateDownloadAllowed, &result);
   EXPECT_TRUE(result);
 }
 
-TEST_F(UmChromeOSPolicyTest, UpdateCurrentConnectionAllowedWimaxDefault) {
+TEST_F(UmChromeOSPolicyTest, UpdateDownloadAllowedWimaxDefault) {
   // Wimax is always allowed.
 
   fake_state_.shill_provider()->var_conn_type()->
@@ -767,7 +767,7 @@
 
   bool result;
   ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCurrentConnectionAllowed, &result);
+                     &Policy::UpdateDownloadAllowed, &result);
   EXPECT_TRUE(result);
 }
 
@@ -780,7 +780,7 @@
 
   bool result;
   ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCurrentConnectionAllowed, &result);
+                     &Policy::UpdateDownloadAllowed, &result);
   EXPECT_FALSE(result);
 }
 
@@ -798,7 +798,7 @@
 
   bool result;
   ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCurrentConnectionAllowed, &result);
+                     &Policy::UpdateDownloadAllowed, &result);
   EXPECT_FALSE(result);
 }
 
@@ -810,12 +810,12 @@
 
   bool result;
   ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCurrentConnectionAllowed, &result);
+                     &Policy::UpdateDownloadAllowed, &result);
   EXPECT_FALSE(result);
 }
 
 TEST_F(UmChromeOSPolicyTest,
-       UpdateCurrentConnectionAllowedCellularPolicyOverride) {
+       UpdateDownloadAllowedCellularPolicyOverride) {
   // Update over cellular can be enabled by policy.
 
   fake_state_.shill_provider()->var_conn_type()->
@@ -828,12 +828,12 @@
 
   bool result;
   ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCurrentConnectionAllowed, &result);
+                     &Policy::UpdateDownloadAllowed, &result);
   EXPECT_TRUE(result);
 }
 
 TEST_F(UmChromeOSPolicyTest,
-       UpdateCurrentConnectionAllowedCellularUserOverride) {
+       UpdateDownloadAllowedCellularUserOverride) {
   // Update over cellular can be enabled by user settings, but only if policy
   // is present and does not determine allowed connections.
 
@@ -846,7 +846,7 @@
 
   bool result;
   ExpectPolicyStatus(EvalStatus::kSucceeded,
-                     &Policy::UpdateCurrentConnectionAllowed, &result);
+                     &Policy::UpdateDownloadAllowed, &result);
   EXPECT_TRUE(result);
 }
 
diff --git a/update_manager/default_policy.h b/update_manager/default_policy.h
index 6cdc19d..54bbe3e 100644
--- a/update_manager/default_policy.h
+++ b/update_manager/default_policy.h
@@ -47,7 +47,7 @@
     return EvalStatus::kSucceeded;
   }
 
-  virtual EvalStatus UpdateCurrentConnectionAllowed(
+  virtual EvalStatus UpdateDownloadAllowed(
       EvaluationContext* ec,
       State* state,
       std::string* error,
diff --git a/update_manager/policy.h b/update_manager/policy.h
index 1c9e876..42a10bf 100644
--- a/update_manager/policy.h
+++ b/update_manager/policy.h
@@ -131,9 +131,9 @@
     if (reinterpret_cast<typeof(&Policy::UpdateCanStart)>(
             policy_method) == &Policy::UpdateCanStart)
       return class_name + "UpdateCanStart";
-    if (reinterpret_cast<typeof(&Policy::UpdateCurrentConnectionAllowed)>(
-            policy_method) == &Policy::UpdateCurrentConnectionAllowed)
-      return class_name + "UpdateCurrentConnectionAllowed";
+    if (reinterpret_cast<typeof(&Policy::UpdateDownloadAllowed)>(
+            policy_method) == &Policy::UpdateDownloadAllowed)
+      return class_name + "UpdateDownloadAllowed";
 
     NOTREACHED();
     return class_name + "(unknown)";
@@ -168,12 +168,13 @@
       const bool interactive,
       const UpdateState& update_state) const = 0;
 
-  // Checks whether updating is allowed over the current network connection
-  // Consults the shill provider as well as the device policy (if available).
+  // Checks whether downloading of an update is allowed; currently, this checks
+  // whether the network connection type is suitable for updating over.  May
+  // consult the shill provider as well as the device policy (if available).
   // Returns |EvalStatus::kSucceeded|, setting |result| according to whether or
   // not the current connection can be used; on failure, returns
   // |EvalStatus::kFailed| and sets |error| accordingly.
-  virtual EvalStatus UpdateCurrentConnectionAllowed(
+  virtual EvalStatus UpdateDownloadAllowed(
       EvaluationContext* ec,
       State* state,
       std::string* error,