OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_AFFILIATION_TEST_HELPER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_AFFILIATION_TEST_HELPER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_AFFILIATION_TEST_HELPER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_AFFILIATION_TEST_HELPER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include "components/policy/core/common/cloud/policy_builder.h" | 10 #include "components/policy/core/common/cloud/policy_builder.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // Sets device affiliation ID to |fake_session_manager| from | 31 // Sets device affiliation ID to |fake_session_manager| from |
32 // |device_affiliation_ids| and modifies |test_helper| so that it contains | 32 // |device_affiliation_ids| and modifies |test_helper| so that it contains |
33 // correct values of device affiliation IDs for future use. To add some device | 33 // correct values of device affiliation IDs for future use. To add some device |
34 // policies and have device affiliation ID valid please use |test_helper| | 34 // policies and have device affiliation ID valid please use |test_helper| |
35 // modified by this function. Example: | 35 // modified by this function. Example: |
36 // | 36 // |
37 // FakeSessionManagerClient* fake_session_manager_client = | 37 // FakeSessionManagerClient* fake_session_manager_client = |
38 // new chromeos::FakeSessionManagerClient; | 38 // new chromeos::FakeSessionManagerClient; |
39 // DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( | 39 // DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( |
40 // scoped_ptr<SessionManagerClient>(fake_session_manager_client)); | 40 // std::unique_ptr<SessionManagerClient>(fake_session_manager_client)); |
41 // | 41 // |
42 // policy::DevicePolicyCrosTestHelper test_helper; | 42 // policy::DevicePolicyCrosTestHelper test_helper; |
43 // std::set<std::string> device_affiliation_ids; | 43 // std::set<std::string> device_affiliation_ids; |
44 // device_affiliation_ids.insert(some-affiliation-id); | 44 // device_affiliation_ids.insert(some-affiliation-id); |
45 // | 45 // |
46 // affiliation_test_helper::SetDeviceAffiliationID(&test_helper, | 46 // affiliation_test_helper::SetDeviceAffiliationID(&test_helper, |
47 // fake_session_manager_client, | 47 // fake_session_manager_client, |
48 // device_affiliation_ids); | 48 // device_affiliation_ids); |
49 // | 49 // |
50 // If it is used together with SetUserAffiliationIDs() (which is the most common | 50 // If it is used together with SetUserAffiliationIDs() (which is the most common |
51 // case) |fake_session_manager_client| must point to the same object as in | 51 // case) |fake_session_manager_client| must point to the same object as in |
52 // SetUserAffiliationIDs() call. | 52 // SetUserAffiliationIDs() call. |
53 // In browser tests one can call this function from | 53 // In browser tests one can call this function from |
54 // SetUpInProcessBrowserTestFixture(). | 54 // SetUpInProcessBrowserTestFixture(). |
55 void SetDeviceAffiliationID( | 55 void SetDeviceAffiliationID( |
56 policy::DevicePolicyCrosTestHelper* test_helper, | 56 policy::DevicePolicyCrosTestHelper* test_helper, |
57 chromeos::FakeSessionManagerClient* fake_session_manager_client, | 57 chromeos::FakeSessionManagerClient* fake_session_manager_client, |
58 const std::set<std::string>& device_affiliation_ids); | 58 const std::set<std::string>& device_affiliation_ids); |
59 | 59 |
60 // Sets user affiliation ID for |user_name| to |fake_session_manager| from | 60 // Sets user affiliation ID for |user_name| to |fake_session_manager| from |
61 // |user_affiliation_ids| and modifies |user_policy| so that it contains | 61 // |user_affiliation_ids| and modifies |user_policy| so that it contains |
62 // correct values of user affiliation IDs for future use. To add user policies | 62 // correct values of user affiliation IDs for future use. To add user policies |
63 // and have user affiliation IDs valid please use |user_policy| modified by this | 63 // and have user affiliation IDs valid please use |user_policy| modified by this |
64 // function. Example: | 64 // function. Example: |
65 // | 65 // |
66 // FakeSessionManagerClient* fake_session_manager_client = | 66 // FakeSessionManagerClient* fake_session_manager_client = |
67 // new chromeos::FakeSessionManagerClient; | 67 // new chromeos::FakeSessionManagerClient; |
68 // DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( | 68 // DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( |
69 // scoped_ptr<SessionManagerClient>(fake_session_manager_client)); | 69 // std::unique_ptr<SessionManagerClient>(fake_session_manager_client)); |
70 // | 70 // |
71 // policy::UserPolicyBuilder user_policy; | 71 // policy::UserPolicyBuilder user_policy; |
72 // std::set<std::string> user_affiliation_ids; | 72 // std::set<std::string> user_affiliation_ids; |
73 // user_affiliation_ids.insert("some-affiliation-id"); | 73 // user_affiliation_ids.insert("some-affiliation-id"); |
74 // | 74 // |
75 // affiliation_test_helper::SetUserAffiliationIDs( | 75 // affiliation_test_helper::SetUserAffiliationIDs( |
76 // &user_policy, fake_session_manager_client, "user@example.com", | 76 // &user_policy, fake_session_manager_client, "user@example.com", |
77 // user_affiliation_ids); | 77 // user_affiliation_ids); |
78 // | 78 // |
79 // If it is used together SetDeviceAffiliationID() (which is the most common | 79 // If it is used together SetDeviceAffiliationID() (which is the most common |
(...skipping 19 matching lines...) Expand all Loading... |
99 void AppendCommandLineSwitchesForLoginManager(base::CommandLine* command_line); | 99 void AppendCommandLineSwitchesForLoginManager(base::CommandLine* command_line); |
100 | 100 |
101 extern const char kFakeRefreshToken[]; | 101 extern const char kFakeRefreshToken[]; |
102 extern const char kEnterpriseUser[]; | 102 extern const char kEnterpriseUser[]; |
103 | 103 |
104 } // namespace affiliation_test_helper | 104 } // namespace affiliation_test_helper |
105 | 105 |
106 } // namespace policy | 106 } // namespace policy |
107 | 107 |
108 #endif // CHROME_BROWSER_CHROMEOS_POLICY_AFFILIATION_TEST_HELPER_H_ | 108 #endif // CHROME_BROWSER_CHROMEOS_POLICY_AFFILIATION_TEST_HELPER_H_ |
OLD | NEW |