Index: chrome/browser/policy/cloud/component_cloud_policy_updater_unittest.cc |
diff --git a/chrome/browser/policy/cloud/component_cloud_policy_updater_unittest.cc b/chrome/browser/policy/cloud/component_cloud_policy_updater_unittest.cc |
index fd6a3773a4e6fd4711be49e70dfc926dfacf6830..fe500eac067fd8ec22fc56e3152892ce3547a892 100644 |
--- a/chrome/browser/policy/cloud/component_cloud_policy_updater_unittest.cc |
+++ b/chrome/browser/policy/cloud/component_cloud_policy_updater_unittest.cc |
@@ -4,8 +4,6 @@ |
#include "chrome/browser/policy/cloud/component_cloud_policy_updater.h" |
-#include <string> |
- |
#include "base/callback.h" |
#include "base/compiler_specific.h" |
#include "base/files/scoped_temp_dir.h" |
@@ -332,4 +330,21 @@ TEST_F(ComponentCloudPolicyUpdaterTest, NoPolicy) { |
EXPECT_FALSE(fetcher_factory_.GetFetcherByID(0)); |
} |
+TEST_F(ComponentCloudPolicyUpdaterTest, CancelUpdate) { |
+ // Submit a policy fetch response with a valid download URL. |
+ updater_->UpdateExternalPolicy(CreateResponse()); |
+ task_runner_->RunUntilIdle(); |
+ |
+ // Verify that the download has been started. |
+ EXPECT_TRUE(fetcher_factory_.GetFetcherByID(0)); |
+ |
+ // Now cancel that update before the download completes. |
+ EXPECT_CALL(store_delegate_, OnComponentCloudPolicyStoreUpdated()).Times(0); |
+ updater_->CancelUpdate( |
+ PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kTestExtension)); |
+ task_runner_->RunUntilIdle(); |
+ Mock::VerifyAndClearExpectations(&store_delegate_); |
+ EXPECT_FALSE(fetcher_factory_.GetFetcherByID(0)); |
+} |
+ |
} // namespace policy |