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

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

Issue 5346005: Unmanaged devices should forget device id/token (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit 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 74979e96e240aeb69eb4a334b869452a29b0b3a0..bd8c16f977920121eca83315f2bee7ac36d8363b 100644
--- a/chrome/browser/policy/device_management_policy_provider_unittest.cc
+++ b/chrome/browser/policy/device_management_policy_provider_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/scoped_temp_dir.h"
#include "chrome/browser/browser_thread.h"
@@ -33,7 +34,6 @@ class DeviceManagementPolicyProviderTest : public testing::Test {
file_thread_(BrowserThread::FILE, &loop_) {}
virtual ~DeviceManagementPolicyProviderTest() {}
-
virtual void SetUp() {
profile_.reset(new TestingProfile);
CreateNewBackend();
@@ -56,6 +56,10 @@ class DeviceManagementPolicyProviderTest : public testing::Test {
loop_.RunAllPending();
}
+ FilePath GetTokenPath() const {
markusheintz_ 2010/11/29 09:01:43 Why was this introduced? It looks like it is only
+ return provider_->GetTokenPath();
+ }
+
void SimulateSuccessfulLoginAndRunPending() {
loop_.RunAllPending();
profile_->GetTokenService()->IssueAuthTokenForTest(
@@ -249,4 +253,26 @@ TEST_F(DeviceManagementPolicyProviderTest, InvalidTokenOnPolicyRequest) {
SimulateSuccessfulLoginAndRunPending();
}
+// If the client is successfully managed, but the admin stops managing the
+// device, the client should notice and throw away the device token and id.
+TEST_F(DeviceManagementPolicyProviderTest, DeviceNoLongerManaged) {
+ InSequence s;
+ SetRefreshDelays(provider_.get(), 0, 0, 1000 * 1000, 1000);
+ EXPECT_CALL(*backend_, ProcessRegisterRequest(_, _, _, _)).WillOnce(
+ MockDeviceManagementBackendSucceedRegister());
+ EXPECT_CALL(*backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce(
+ MockDeviceManagementBackendSucceedBooleanPolicy(key::kDisableSpdy, true));
+ EXPECT_CALL(*backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce(
+ MockDeviceManagementBackendSucceedBooleanPolicy(key::kDisableSpdy, true));
+ EXPECT_CALL(*backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce(
+ MockDeviceManagementBackendFailPolicy(
+ DeviceManagementBackend::kErrorServiceManagementNotSupported));
+ EXPECT_CALL(*backend_, ProcessRegisterRequest(_, _, _, _)).WillOnce(
+ MockDeviceManagementBackendFailRegister(
+ DeviceManagementBackend::kErrorServiceManagementNotSupported));
+ SimulateSuccessfulLoginAndRunPending();
+ FilePath token_path(GetTokenPath());
+ EXPECT_FALSE(file_util::PathExists(token_path));
+}
+
} // 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