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

Unified Diff: chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc

Issue 814123006: Revert of Implemented consumer management unenrollment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dcpm
Patch Set: Created 5 years, 11 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/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc
index e41eeeddfafcfb138ba485313e55b1405515a4f1..a13be1b74be9a01ba25a4bb4cf4a9d43c0935e37 100644
--- a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc
+++ b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc
@@ -40,7 +40,6 @@
#include "chromeos/system/statistics_provider.h"
#include "components/policy/core/common/cloud/cloud_policy_client.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
-#include "components/policy/core/common/cloud/cloud_policy_core.h"
#include "components/policy/core/common/cloud/mock_device_management_service.h"
#include "components/policy/core/common/external_data_fetcher.h"
#include "components/policy/core/common/schema_registry.h"
@@ -198,7 +197,6 @@
}
MOCK_METHOD0(OnDeviceCloudPolicyManagerConnected, void());
- MOCK_METHOD0(OnDeviceCloudPolicyManagerDisconnected, void());
scoped_ptr<EnterpriseInstallAttributes> install_attributes_;
@@ -328,28 +326,19 @@
EXPECT_TRUE(manager_->policies().Equals(bundle));
}
-TEST_F(DeviceCloudPolicyManagerChromeOSTest, ConnectAndDisconnect) {
+TEST_F(DeviceCloudPolicyManagerChromeOSTest, ObserverIsNotifiedOnConnected) {
LockDevice();
FlushDeviceSettings();
- EXPECT_FALSE(manager_->core()->service()); // Not connected.
-
- // Connect the manager.
+
MockDeviceManagementJob* policy_fetch_job = nullptr;
EXPECT_CALL(device_management_service_,
CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, _))
.WillOnce(device_management_service_.CreateAsyncJob(&policy_fetch_job));
EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _));
EXPECT_CALL(*this, OnDeviceCloudPolicyManagerConnected());
+
ConnectManager();
base::RunLoop().RunUntilIdle();
- Mock::VerifyAndClearExpectations(&device_management_service_);
- Mock::VerifyAndClearExpectations(this);
- EXPECT_TRUE(manager_->core()->service()); // Connected.
-
- // Disconnect the manager.
- EXPECT_CALL(*this, OnDeviceCloudPolicyManagerDisconnected());
- manager_->Disconnect();
- EXPECT_FALSE(manager_->core()->service()); // Not connnected.
}
class DeviceCloudPolicyManagerChromeOSEnrollmentTest
@@ -359,8 +348,6 @@
status_ = status;
done_ = true;
}
-
- MOCK_METHOD1(OnUnregistered, void(bool));
protected:
DeviceCloudPolicyManagerChromeOSEnrollmentTest()
@@ -675,44 +662,6 @@
ExpectSuccessfulEnrollment();
}
-TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, UnregisterSucceeds) {
- // Enroll first.
- RunTest();
- ExpectSuccessfulEnrollment();
-
- // Set up mock objects for the upcoming unregistration job.
- em::DeviceManagementResponse response;
- response.mutable_unregister_response();
- EXPECT_CALL(device_management_service_,
- CreateJob(DeviceManagementRequestJob::TYPE_UNREGISTRATION, _))
- .WillOnce(device_management_service_.SucceedJob(response));
- EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _));
- EXPECT_CALL(*this, OnUnregistered(true));
-
- // Start unregistering.
- manager_->Unregister(base::Bind(
- &DeviceCloudPolicyManagerChromeOSEnrollmentTest::OnUnregistered,
- base::Unretained(this)));
-}
-
-TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, UnregisterFails) {
- // Enroll first.
- RunTest();
- ExpectSuccessfulEnrollment();
-
- // Set up mock objects for the upcoming unregistration job.
- EXPECT_CALL(device_management_service_,
- CreateJob(DeviceManagementRequestJob::TYPE_UNREGISTRATION, _))
- .WillOnce(device_management_service_.FailJob(DM_STATUS_REQUEST_FAILED));
- EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _));
- EXPECT_CALL(*this, OnUnregistered(false));
-
- // Start unregistering.
- manager_->Unregister(base::Bind(
- &DeviceCloudPolicyManagerChromeOSEnrollmentTest::OnUnregistered,
- base::Unretained(this)));
-}
-
// A subclass that runs with a blank system salt.
class DeviceCloudPolicyManagerChromeOSEnrollmentBlankSystemSaltTest
: public DeviceCloudPolicyManagerChromeOSEnrollmentTest {

Powered by Google App Engine
This is Rietveld 408576698