summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h
blob: 84b4473c517f533b7753c6e42f966abac7f5d030 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (c) 2013 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_CHROMEOS_POLICY_STUB_ENTERPRISE_INSTALL_ATTRIBUTES_H_
#define CHROME_BROWSER_CHROMEOS_POLICY_STUB_ENTERPRISE_INSTALL_ATTRIBUTES_H_

#include <string>

#include "base/basictypes.h"
#include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"

namespace policy {

// This class allows tests to override specific values for easier testing.
// To make IsEnterpriseDevice() return true, set a non-empty registration
// user.
class StubEnterpriseInstallAttributes : public EnterpriseInstallAttributes {
 public:
  StubEnterpriseInstallAttributes();

  void SetDomain(const std::string& domain);
  void SetRegistrationUser(const std::string& user);
  void SetDeviceId(const std::string& id);
  void SetMode(DeviceMode mode);

 private:
  DISALLOW_COPY_AND_ASSIGN(StubEnterpriseInstallAttributes);
};

// Helper class to set enterprise install attributes in the scope of a test.
class ScopedStubEnterpriseInstallAttributes {
 public:
  ScopedStubEnterpriseInstallAttributes(const std::string& domain,
                                        const std::string& registration_user,
                                        const std::string& device_id,
                                        DeviceMode mode);
  ~ScopedStubEnterpriseInstallAttributes();
};

}  // namespace policy

#endif  // CHROME_BROWSER_CHROMEOS_POLICY_STUB_ENTERPRISE_INSTALL_ATTRIBUTES_H_