OLD | NEW |
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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/base64url.h" | 7 #include "base/base64url.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "components/policy/proto/cloud_policy.pb.h" | 32 #include "components/policy/proto/cloud_policy.pb.h" |
33 #include "components/policy/proto/device_management_backend.pb.h" | 33 #include "components/policy/proto/device_management_backend.pb.h" |
34 #include "extensions/common/extension.h" | 34 #include "extensions/common/extension.h" |
35 #include "extensions/test/extension_test_message_listener.h" | 35 #include "extensions/test/extension_test_message_listener.h" |
36 #include "net/url_request/url_request_context_getter.h" | 36 #include "net/url_request/url_request_context_getter.h" |
37 #include "testing/gmock/include/gmock/gmock.h" | 37 #include "testing/gmock/include/gmock/gmock.h" |
38 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
39 | 39 |
40 #if defined(OS_CHROMEOS) | 40 #if defined(OS_CHROMEOS) |
41 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 41 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
42 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 42 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h" |
43 #include "chromeos/chromeos_switches.h" | 43 #include "chromeos/chromeos_switches.h" |
44 #else | 44 #else |
45 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 45 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
46 #include "chrome/browser/signin/signin_manager_factory.h" | 46 #include "chrome/browser/signin/signin_manager_factory.h" |
47 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 47 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
48 #include "components/signin/core/browser/signin_manager.h" | 48 #include "components/signin/core/browser/signin_manager.h" |
49 #endif | 49 #endif |
50 | 50 |
51 using testing::InvokeWithoutArgs; | 51 using testing::InvokeWithoutArgs; |
52 using testing::Mock; | 52 using testing::Mock; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 return extension; | 163 return extension; |
164 } | 164 } |
165 | 165 |
166 void SignInAndRegister() { | 166 void SignInAndRegister() { |
167 BrowserPolicyConnector* connector = | 167 BrowserPolicyConnector* connector = |
168 g_browser_process->browser_policy_connector(); | 168 g_browser_process->browser_policy_connector(); |
169 connector->ScheduleServiceInitialization(0); | 169 connector->ScheduleServiceInitialization(0); |
170 | 170 |
171 #if defined(OS_CHROMEOS) | 171 #if defined(OS_CHROMEOS) |
172 UserCloudPolicyManagerChromeOS* policy_manager = | 172 UserCloudPolicyManagerChromeOS* policy_manager = |
173 UserCloudPolicyManagerFactoryChromeOS::GetForProfile( | 173 UserPolicyManagerFactoryChromeOS::GetCloudPolicyManagerForProfile( |
174 browser()->profile()); | 174 browser()->profile()); |
175 ASSERT_TRUE(policy_manager); | 175 ASSERT_TRUE(policy_manager); |
176 #else | 176 #else |
177 // Mock a signed-in user. This is used by the UserCloudPolicyStore to pass | 177 // Mock a signed-in user. This is used by the UserCloudPolicyStore to pass |
178 // the username to the UserCloudPolicyValidator. | 178 // the username to the UserCloudPolicyValidator. |
179 SigninManager* signin_manager = | 179 SigninManager* signin_manager = |
180 SigninManagerFactory::GetForProfile(browser()->profile()); | 180 SigninManagerFactory::GetForProfile(browser()->profile()); |
181 ASSERT_TRUE(signin_manager); | 181 ASSERT_TRUE(signin_manager); |
182 signin_manager->SetAuthenticatedAccountInfo("12345", | 182 signin_manager->SetAuthenticatedAccountInfo("12345", |
183 PolicyBuilder::kFakeUsername); | 183 PolicyBuilder::kFakeUsername); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 ExtensionTestMessageListener policy_listener1("{}", true); | 402 ExtensionTestMessageListener policy_listener1("{}", true); |
403 event_listener_->Reply("get-policy-Name"); | 403 event_listener_->Reply("get-policy-Name"); |
404 EXPECT_TRUE(policy_listener1.WaitUntilSatisfied()); | 404 EXPECT_TRUE(policy_listener1.WaitUntilSatisfied()); |
405 | 405 |
406 ExtensionTestMessageListener policy_listener2(kTestPolicy2JSON, false); | 406 ExtensionTestMessageListener policy_listener2(kTestPolicy2JSON, false); |
407 policy_listener1.Reply("get-policy-Another"); | 407 policy_listener1.Reply("get-policy-Another"); |
408 EXPECT_TRUE(policy_listener2.WaitUntilSatisfied()); | 408 EXPECT_TRUE(policy_listener2.WaitUntilSatisfied()); |
409 } | 409 } |
410 | 410 |
411 } // namespace policy | 411 } // namespace policy |
OLD | NEW |