| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "content/public/browser/notification_service.h" | 49 #include "content/public/browser/notification_service.h" |
| 50 #include "content/public/browser/notification_source.h" | 50 #include "content/public/browser/notification_source.h" |
| 51 #include "content/public/test/test_utils.h" | 51 #include "content/public/test/test_utils.h" |
| 52 #include "net/url_request/url_request_context_getter.h" | 52 #include "net/url_request/url_request_context_getter.h" |
| 53 #include "testing/gmock/include/gmock/gmock.h" | 53 #include "testing/gmock/include/gmock/gmock.h" |
| 54 #include "testing/gtest/include/gtest/gtest.h" | 54 #include "testing/gtest/include/gtest/gtest.h" |
| 55 #include "url/gurl.h" | 55 #include "url/gurl.h" |
| 56 | 56 |
| 57 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
| 58 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 58 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 59 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 59 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h" |
| 60 #include "chromeos/chromeos_paths.h" | 60 #include "chromeos/chromeos_paths.h" |
| 61 #include "chromeos/cryptohome/cryptohome_parameters.h" | 61 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 62 #include "chromeos/dbus/cryptohome_client.h" | 62 #include "chromeos/dbus/cryptohome_client.h" |
| 63 #include "components/signin/core/account_id/account_id.h" | 63 #include "components/signin/core/account_id/account_id.h" |
| 64 #include "components/user_manager/user_names.h" | 64 #include "components/user_manager/user_names.h" |
| 65 #else | 65 #else |
| 66 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 66 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 67 #include "chrome/browser/signin/signin_manager_factory.h" | 67 #include "chrome/browser/signin/signin_manager_factory.h" |
| 68 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 68 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
| 69 #include "components/signin/core/browser/signin_manager.h" | 69 #include "components/signin/core/browser/signin_manager.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 void SetUpOnMainThread() override { | 200 void SetUpOnMainThread() override { |
| 201 ASSERT_TRUE(PolicyServiceIsEmpty(g_browser_process->policy_service())) | 201 ASSERT_TRUE(PolicyServiceIsEmpty(g_browser_process->policy_service())) |
| 202 << "Pre-existing policies in this machine will make this test fail."; | 202 << "Pre-existing policies in this machine will make this test fail."; |
| 203 | 203 |
| 204 BrowserPolicyConnector* connector = | 204 BrowserPolicyConnector* connector = |
| 205 g_browser_process->browser_policy_connector(); | 205 g_browser_process->browser_policy_connector(); |
| 206 connector->ScheduleServiceInitialization(0); | 206 connector->ScheduleServiceInitialization(0); |
| 207 | 207 |
| 208 #if defined(OS_CHROMEOS) | 208 #if defined(OS_CHROMEOS) |
| 209 UserCloudPolicyManagerChromeOS* policy_manager = | 209 UserCloudPolicyManagerChromeOS* policy_manager = |
| 210 UserCloudPolicyManagerFactoryChromeOS::GetForProfile( | 210 UserPolicyManagerFactoryChromeOS::GetCloudPolicyManagerForProfile( |
| 211 browser()->profile()); | 211 browser()->profile()); |
| 212 ASSERT_TRUE(policy_manager); | 212 ASSERT_TRUE(policy_manager); |
| 213 #else | 213 #else |
| 214 // Mock a signed-in user. This is used by the UserCloudPolicyStore to pass | 214 // Mock a signed-in user. This is used by the UserCloudPolicyStore to pass |
| 215 // the username to the UserCloudPolicyValidator. | 215 // the username to the UserCloudPolicyValidator. |
| 216 SigninManager* signin_manager = | 216 SigninManager* signin_manager = |
| 217 SigninManagerFactory::GetForProfile(browser()->profile()); | 217 SigninManagerFactory::GetForProfile(browser()->profile()); |
| 218 ASSERT_TRUE(signin_manager); | 218 ASSERT_TRUE(signin_manager); |
| 219 signin_manager->SetAuthenticatedAccountInfo(GetTestGaiaId(), GetTestUser()); | 219 signin_manager->SetAuthenticatedAccountInfo(GetTestGaiaId(), GetTestUser()); |
| 220 | 220 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 | 491 |
| 492 // They should now serialize to the same bytes. | 492 // They should now serialize to the same bytes. |
| 493 std::string chrome_settings_serialized; | 493 std::string chrome_settings_serialized; |
| 494 std::string cloud_policy_serialized; | 494 std::string cloud_policy_serialized; |
| 495 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); | 495 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); |
| 496 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); | 496 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); |
| 497 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); | 497 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); |
| 498 } | 498 } |
| 499 | 499 |
| 500 } // namespace policy | 500 } // namespace policy |
| OLD | NEW |