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

Unified Diff: chrome/browser/policy/mock_device_management_backend.h

Issue 4121003: Implement device token fetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final feedback Created 10 years, 2 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/policy/mock_device_management_backend.h
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 0000000000000000000000000000000000000000..290e615400e06be309471c4c4d36dc3e8ba910c2
--- /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_
« no previous file with comments | « chrome/browser/policy/device_token_fetcher_unittest.cc ('k') | chrome/browser/policy/mock_device_management_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698