| 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 "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 5 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 14 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
| 15 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 15 #include "chrome/browser/chromeos/settings/install_attributes.h" |
| 16 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
| 17 #include "chromeos/chromeos_paths.h" | 17 #include "chromeos/chromeos_paths.h" |
| 18 #include "chromeos/dbus/dbus_thread_manager.h" | 18 #include "chromeos/dbus/dbus_thread_manager.h" |
| 19 #include "chromeos/dbus/fake_session_manager_client.h" | 19 #include "chromeos/dbus/fake_session_manager_client.h" |
| 20 #include "crypto/rsa_private_key.h" | 20 #include "crypto/rsa_private_key.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 23 |
| 24 using ::testing::_; | 24 using ::testing::_; |
| 25 using ::testing::AnyNumber; | 25 using ::testing::AnyNumber; |
| 26 using ::testing::Return; | 26 using ::testing::Return; |
| 27 | 27 |
| 28 namespace policy { | 28 namespace policy { |
| 29 | 29 |
| 30 DevicePolicyCrosTestHelper::DevicePolicyCrosTestHelper() {} | 30 DevicePolicyCrosTestHelper::DevicePolicyCrosTestHelper() {} |
| 31 | 31 |
| 32 DevicePolicyCrosTestHelper::~DevicePolicyCrosTestHelper() {} | 32 DevicePolicyCrosTestHelper::~DevicePolicyCrosTestHelper() {} |
| 33 | 33 |
| 34 // static | 34 // static |
| 35 void DevicePolicyCrosTestHelper::MarkAsEnterpriseOwnedBy( | 35 void DevicePolicyCrosTestHelper::MarkAsEnterpriseOwnedBy( |
| 36 const std::string& user_name) { | 36 const std::string& user_name) { |
| 37 OverridePaths(); | 37 OverridePaths(); |
| 38 | 38 |
| 39 const std::string install_attrs_blob( | 39 const std::string install_attrs_blob( |
| 40 EnterpriseInstallAttributes:: | 40 chromeos::InstallAttributes:: |
| 41 GetEnterpriseOwnedInstallAttributesBlobForTesting(user_name)); | 41 GetEnterpriseOwnedInstallAttributesBlobForTesting(user_name)); |
| 42 | 42 |
| 43 base::FilePath install_attrs_file; | 43 base::FilePath install_attrs_file; |
| 44 ASSERT_TRUE( | 44 ASSERT_TRUE( |
| 45 PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES, &install_attrs_file)); | 45 PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES, &install_attrs_file)); |
| 46 ASSERT_EQ(static_cast<int>(install_attrs_blob.size()), | 46 ASSERT_EQ(static_cast<int>(install_attrs_blob.size()), |
| 47 base::WriteFile(install_attrs_file, | 47 base::WriteFile(install_attrs_file, |
| 48 install_attrs_blob.c_str(), | 48 install_attrs_blob.c_str(), |
| 49 install_attrs_blob.size())); | 49 install_attrs_blob.size())); |
| 50 } | 50 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 void DevicePolicyCrosBrowserTest::RefreshDevicePolicy() { | 107 void DevicePolicyCrosBrowserTest::RefreshDevicePolicy() { |
| 108 // Reset the key to its original state. | 108 // Reset the key to its original state. |
| 109 device_policy()->SetDefaultSigningKey(); | 109 device_policy()->SetDefaultSigningKey(); |
| 110 device_policy()->Build(); | 110 device_policy()->Build(); |
| 111 session_manager_client()->set_device_policy(device_policy()->GetBlob()); | 111 session_manager_client()->set_device_policy(device_policy()->GetBlob()); |
| 112 session_manager_client()->OnPropertyChangeComplete(true); | 112 session_manager_client()->OnPropertyChangeComplete(true); |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace policy | 115 } // namespace policy |
| OLD | NEW |