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

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

Issue 4967005: No persisted device id/token for unmanaged devices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/policy/mock_device_management_backend.h" 5 #include "chrome/browser/policy/mock_device_management_backend.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 ON_CALL(*this, ProcessRegisterRequest(_, _, _, _)). 52 ON_CALL(*this, ProcessRegisterRequest(_, _, _, _)).
53 WillByDefault(Invoke( 53 WillByDefault(Invoke(
54 this, 54 this,
55 &MockDeviceManagementBackend::SimulateFailedRegisterRequest)); 55 &MockDeviceManagementBackend::SimulateFailedRegisterRequest));
56 ON_CALL(*this, ProcessPolicyRequest(_, _, _)). 56 ON_CALL(*this, ProcessPolicyRequest(_, _, _)).
57 WillByDefault(Invoke( 57 WillByDefault(Invoke(
58 this, 58 this,
59 &MockDeviceManagementBackend::SimulateFailedPolicyRequest)); 59 &MockDeviceManagementBackend::SimulateFailedPolicyRequest));
60 } 60 }
61 61
62 void MockDeviceManagementBackend::UnmanagedDevice() {
63 ON_CALL(*this, ProcessRegisterRequest(_, _, _, _)).
64 WillByDefault(Invoke(
65 this,
66 &MockDeviceManagementBackend::SimulateUnmanagedRegisterRequest));
67 }
68
62 void MockDeviceManagementBackend::AddBooleanPolicy(const char* policy_name, 69 void MockDeviceManagementBackend::AddBooleanPolicy(const char* policy_name,
63 bool value) { 70 bool value) {
64 em::GenericSetting* policy_value = policy_setting_->mutable_policy_value(); 71 em::GenericSetting* policy_value = policy_setting_->mutable_policy_value();
65 em::GenericNamedValue* named_value = policy_value->add_named_value(); 72 em::GenericNamedValue* named_value = policy_value->add_named_value();
66 named_value->set_name(policy_name); 73 named_value->set_name(policy_name);
67 named_value->mutable_value()->set_value_type( 74 named_value->mutable_value()->set_value_type(
68 em::GenericValue::VALUE_TYPE_BOOL); 75 em::GenericValue::VALUE_TYPE_BOOL);
69 named_value->mutable_value()->set_bool_value(value); 76 named_value->mutable_value()->set_bool_value(value);
70 } 77 }
71 78
(...skipping 24 matching lines...) Expand all
96 delegate->OnError(kErrorRequestFailed); 103 delegate->OnError(kErrorRequestFailed);
97 } 104 }
98 105
99 void MockDeviceManagementBackend::SimulateFailedPolicyRequest( 106 void MockDeviceManagementBackend::SimulateFailedPolicyRequest(
100 const std::string& device_management_token, 107 const std::string& device_management_token,
101 const em::DevicePolicyRequest& request, 108 const em::DevicePolicyRequest& request,
102 DevicePolicyResponseDelegate* delegate) { 109 DevicePolicyResponseDelegate* delegate) {
103 delegate->OnError(kErrorRequestFailed); 110 delegate->OnError(kErrorRequestFailed);
104 } 111 }
105 112
113 void MockDeviceManagementBackend::SimulateUnmanagedRegisterRequest(
114 const std::string& auth_token,
115 const std::string& device_id,
116 const em::DeviceRegisterRequest& request,
117 DeviceRegisterResponseDelegate* delegate) {
118 delegate->OnError(kErrorServiceManagementNotSupported);
119 }
120
106 } // namespace 121 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698