summaryrefslogtreecommitdiffstats
path: root/chrome/browser/policy/mock_device_management_backend.h
diff options
context:
space:
mode:
authordanno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 09:20:03 +0000
committerdanno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 09:20:03 +0000
commit2a87dce080ab4f09a180e9e6881a85ac9e8aedde (patch)
treec1d960efade31be45b7b7ba30532af14279d4bda /chrome/browser/policy/mock_device_management_backend.h
parentdc7bec0219a6d54cadf530786907bc72c6b31268 (diff)
downloadchromium_src-2a87dce080ab4f09a180e9e6881a85ac9e8aedde.zip
chromium_src-2a87dce080ab4f09a180e9e6881a85ac9e8aedde.tar.gz
chromium_src-2a87dce080ab4f09a180e9e6881a85ac9e8aedde.tar.bz2
Implement device token fetcher
First step in mechanism for fetching cloud-based policy for CrOS. BUG=none TEST=DeviceTokenFetcher* Review URL: http://codereview.chromium.org/4121003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64388 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/policy/mock_device_management_backend.h')
-rw-r--r--chrome/browser/policy/mock_device_management_backend.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/chrome/browser/policy/mock_device_management_backend.h b/chrome/browser/policy/mock_device_management_backend.h
new file mode 100644
index 0000000..290e615
--- /dev/null
+++ b/chrome/browser/policy/mock_device_management_backend.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_
+#define CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_
+#pragma once
+
+#include <string>
+
+#include "chrome/browser/policy/device_management_backend.h"
+
+namespace policy {
+
+namespace em = enterprise_management;
+
+// Useful for unit testing when a server-based backend isn't
+// available. Simulates both successful and failed requests to the device
+// management server.
+class MockDeviceManagementBackend
+ : public DeviceManagementBackend {
+ public:
+ MockDeviceManagementBackend();
+ virtual ~MockDeviceManagementBackend() {}
+
+ void SetFailure(bool failure) { failure_ = failure; }
+
+ // DeviceManagementBackend method overrides:
+ virtual void ProcessRegisterRequest(
+ const std::string& auth_token,
+ const std::string& device_id,
+ const em::DeviceRegisterRequest& request,
+ DeviceRegisterResponseDelegate* delegate);
+
+ virtual void ProcessUnregisterRequest(
+ const std::string& device_management_token,
+ const em::DeviceUnregisterRequest& request,
+ DeviceUnregisterResponseDelegate* delegate);
+
+ virtual void ProcessPolicyRequest(
+ const std::string& device_management_token,
+ const em::DevicePolicyRequest& request,
+ DevicePolicyResponseDelegate* delegate);
+
+ private:
+ bool failure_;
+ DISALLOW_COPY_AND_ASSIGN(MockDeviceManagementBackend);
+};
+
+} // namespace policy
+
+#endif // CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_