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> |
| 8 |
7 #include <vector> | 9 #include <vector> |
8 | 10 |
9 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
11 #include "base/path_service.h" | 13 #include "base/path_service.h" |
12 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 14 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
13 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 15 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
14 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
15 #include "chromeos/chromeos_paths.h" | 17 #include "chromeos/chromeos_paths.h" |
16 #include "chromeos/dbus/dbus_thread_manager.h" | 18 #include "chromeos/dbus/dbus_thread_manager.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 51 |
50 void DevicePolicyCrosTestHelper::MarkAsEnterpriseOwned() { | 52 void DevicePolicyCrosTestHelper::MarkAsEnterpriseOwned() { |
51 MarkAsEnterpriseOwnedBy(device_policy_.policy_data().username()); | 53 MarkAsEnterpriseOwnedBy(device_policy_.policy_data().username()); |
52 } | 54 } |
53 | 55 |
54 void DevicePolicyCrosTestHelper::InstallOwnerKey() { | 56 void DevicePolicyCrosTestHelper::InstallOwnerKey() { |
55 OverridePaths(); | 57 OverridePaths(); |
56 | 58 |
57 base::FilePath owner_key_file; | 59 base::FilePath owner_key_file; |
58 ASSERT_TRUE(PathService::Get(chromeos::FILE_OWNER_KEY, &owner_key_file)); | 60 ASSERT_TRUE(PathService::Get(chromeos::FILE_OWNER_KEY, &owner_key_file)); |
59 std::vector<uint8> owner_key_bits; | 61 std::vector<uint8_t> owner_key_bits; |
60 ASSERT_TRUE( | 62 ASSERT_TRUE( |
61 device_policy()->GetSigningKey()->ExportPublicKey(&owner_key_bits)); | 63 device_policy()->GetSigningKey()->ExportPublicKey(&owner_key_bits)); |
62 ASSERT_EQ(base::WriteFile(owner_key_file, reinterpret_cast<const char*>( | 64 ASSERT_EQ(base::WriteFile(owner_key_file, reinterpret_cast<const char*>( |
63 owner_key_bits.data()), | 65 owner_key_bits.data()), |
64 owner_key_bits.size()), | 66 owner_key_bits.size()), |
65 static_cast<int>(owner_key_bits.size())); | 67 static_cast<int>(owner_key_bits.size())); |
66 } | 68 } |
67 | 69 |
68 // static | 70 // static |
69 void DevicePolicyCrosTestHelper::OverridePaths() { | 71 void DevicePolicyCrosTestHelper::OverridePaths() { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 105 |
104 void DevicePolicyCrosBrowserTest::RefreshDevicePolicy() { | 106 void DevicePolicyCrosBrowserTest::RefreshDevicePolicy() { |
105 // Reset the key to its original state. | 107 // Reset the key to its original state. |
106 device_policy()->SetDefaultSigningKey(); | 108 device_policy()->SetDefaultSigningKey(); |
107 device_policy()->Build(); | 109 device_policy()->Build(); |
108 session_manager_client()->set_device_policy(device_policy()->GetBlob()); | 110 session_manager_client()->set_device_policy(device_policy()->GetBlob()); |
109 session_manager_client()->OnPropertyChangeComplete(true); | 111 session_manager_client()->OnPropertyChangeComplete(true); |
110 } | 112 } |
111 | 113 |
112 } // namespace policy | 114 } // namespace policy |
OLD | NEW |