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

Side by Side Diff: chrome/browser/policy/mock_device_management_backend.cc

Issue 4121003: Implement device token fetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/logging.h"
6 #include "chrome/browser/policy/mock_device_management_backend.h"
7
8 namespace {
9
10 static const char kFakeDeviceManagementToken[] = "FAKE_DEVICE_TOKEN_";
11 static char next_token_suffix_ = '0';
12
13 } // namespace
14
15 namespace policy {
16
17 using enterprise_management::DeviceRegisterRequest;
18 using enterprise_management::DeviceUnregisterRequest;
19 using enterprise_management::DevicePolicyRequest;
20 using enterprise_management::DeviceRegisterResponse;
21 using enterprise_management::DeviceUnregisterResponse;
22 using enterprise_management::DevicePolicyResponse;
23
24 MockDeviceManagementBackend::MockDeviceManagementBackend()
25 : DeviceManagementBackend(),
26 failure_(false) {
27 }
28
29 void MockDeviceManagementBackend::ProcessRegisterRequest(
30 const std::string& auth_token,
31 const std::string& device_id,
32 const DeviceRegisterRequest& request,
33 DeviceRegisterResponseDelegate* delegate) {
34 if (failure_) {
35 delegate->OnError(kErrorRequestInvalid);
36 } else {
37 DeviceRegisterResponse response;
38 std::string token(kFakeDeviceManagementToken);
39 token += next_token_suffix_++;
40 response.set_device_management_token(token);
41 delegate->HandleRegisterResponse(response);
42 }
43 }
44
45 void MockDeviceManagementBackend::ProcessUnregisterRequest(
46 const std::string& device_management_token,
47 const DeviceUnregisterRequest& request,
48 DeviceUnregisterResponseDelegate* delegate) {
49 // TODO(danno): need a mock implementation for the backend here.
50 NOTREACHED();
51 }
52
53 void MockDeviceManagementBackend::ProcessPolicyRequest(
54 const std::string& device_management_token,
55 const DevicePolicyRequest& request,
56 DevicePolicyResponseDelegate* delegate) {
57 // TODO(danno): need a mock implementation for the backend here.
58 NOTREACHED();
59 }
60
61 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/policy/mock_device_management_backend.h ('k') | chrome/browser/policy/proto/device_management_backend.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698