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

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

Issue 5341004: Chrome should re-register device when DMServer doesn't recognize token (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review feedback Created 10 years, 1 month 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
« no previous file with comments | « chrome/browser/policy/device_management_policy_provider.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/device_management_policy_provider_unittest.cc
diff --git a/chrome/browser/policy/device_management_policy_provider_unittest.cc b/chrome/browser/policy/device_management_policy_provider_unittest.cc
index 1761e80ea60cd7b72cd0418f1f26421cd38aa2cc..7b92d1be8e6d464c27f82f180e6d75e86f9798e2 100644
--- a/chrome/browser/policy/device_management_policy_provider_unittest.cc
+++ b/chrome/browser/policy/device_management_policy_provider_unittest.cc
@@ -210,4 +210,36 @@ TEST_F(DeviceManagementPolicyProviderTest, RefreshPolicies) {
SimulateSuccessfulLoginAndRunPending();
}
+// The client should try to re-register the device if the device server reports
+// back that it doesn't recognize the device token on a policy request.
+TEST_F(DeviceManagementPolicyProviderTest, DeviceNotFound) {
+ InSequence s;
+ EXPECT_CALL(*backend_, ProcessRegisterRequest(_, _, _, _)).WillOnce(
+ MockDeviceManagementBackendSucceedRegister());
+ EXPECT_CALL(*backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce(
+ MockDeviceManagementBackendFailPolicy(
+ DeviceManagementBackend::kErrorServiceDeviceNotFound));
+ EXPECT_CALL(*backend_, ProcessRegisterRequest(_, _, _, _)).WillOnce(
+ MockDeviceManagementBackendSucceedRegister());
+ EXPECT_CALL(*backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce(
+ MockDeviceManagementBackendSucceedBooleanPolicy(key::kDisableSpdy, true));
+ SimulateSuccessfulLoginAndRunPending();
+}
+
+// The client should try to re-register the device if the device server reports
+// back that the device token is invalid on a policy request.
+TEST_F(DeviceManagementPolicyProviderTest, InvalidTokenOnPolicyRequest) {
+ InSequence s;
+ EXPECT_CALL(*backend_, ProcessRegisterRequest(_, _, _, _)).WillOnce(
+ MockDeviceManagementBackendSucceedRegister());
+ EXPECT_CALL(*backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce(
+ MockDeviceManagementBackendFailPolicy(
+ DeviceManagementBackend::kErrorServiceManagementTokenInvalid));
+ EXPECT_CALL(*backend_, ProcessRegisterRequest(_, _, _, _)).WillOnce(
+ MockDeviceManagementBackendSucceedRegister());
+ EXPECT_CALL(*backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce(
+ MockDeviceManagementBackendSucceedBooleanPolicy(key::kDisableSpdy, true));
+ SimulateSuccessfulLoginAndRunPending();
+}
+
} // namespace policy
« no previous file with comments | « chrome/browser/policy/device_management_policy_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698