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

Side by Side Diff: chrome/browser/chromeos/policy/stub_enterprise_install_attributes.cc

Issue 247283007: Add ScopedStubEnterpriseInstallAttributes for tests to set test install attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromeos/policy/stub_enterprise_install_attributes.h" 5 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
9 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 10 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
10 11
11 namespace policy { 12 namespace policy {
12 13
13 StubEnterpriseInstallAttributes::StubEnterpriseInstallAttributes() 14 StubEnterpriseInstallAttributes::StubEnterpriseInstallAttributes()
14 : EnterpriseInstallAttributes(NULL) { 15 : EnterpriseInstallAttributes(NULL) {
15 device_locked_ = true; 16 device_locked_ = true;
16 } 17 }
17 18
18 void StubEnterpriseInstallAttributes::SetDomain(const std::string& domain) { 19 void StubEnterpriseInstallAttributes::SetDomain(const std::string& domain) {
19 registration_domain_ = domain; 20 registration_domain_ = domain;
20 } 21 }
21 22
22 void StubEnterpriseInstallAttributes::SetRegistrationUser( 23 void StubEnterpriseInstallAttributes::SetRegistrationUser(
23 const std::string& user) { 24 const std::string& user) {
24 registration_user_ = user; 25 registration_user_ = user;
25 } 26 }
26 27
27 void StubEnterpriseInstallAttributes::SetDeviceId(const std::string& id) { 28 void StubEnterpriseInstallAttributes::SetDeviceId(const std::string& id) {
28 registration_device_id_ = id; 29 registration_device_id_ = id;
29 } 30 }
30 31
31 void StubEnterpriseInstallAttributes::SetMode(DeviceMode mode) { 32 void StubEnterpriseInstallAttributes::SetMode(DeviceMode mode) {
32 registration_mode_ = mode; 33 registration_mode_ = mode;
33 } 34 }
34 35
36 ScopedStubEnterpriseInstallAttributes::ScopedStubEnterpriseInstallAttributes(
37 const std::string& domain,
38 const std::string& registration_user,
39 const std::string& device_id,
40 DeviceMode mode) {
41 StubEnterpriseInstallAttributes* attributes =
42 new StubEnterpriseInstallAttributes();
43 attributes->SetDomain(domain);
44 attributes->SetRegistrationUser(registration_user);
45 attributes->SetDeviceId(device_id);
46 attributes->SetMode(mode);
47 BrowserPolicyConnectorChromeOS::SetInstallAttributesForTesting(attributes);
Mattias Nissler (ping if slow) 2014/04/24 07:21:57 Hm, the whole SetInstallAttributesForTesting seems
Steve Condie 2014/04/24 18:14:28 Good call, done. I was thinking that resetting g_t
48 }
49
35 } // namespace policy 50 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698