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 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 base::FilePath user_keys_dir; | 174 base::FilePath user_keys_dir; |
175 ASSERT_TRUE(PathService::Get(chromeos::DIR_USER_POLICY_KEYS, &user_keys_dir)); | 175 ASSERT_TRUE(PathService::Get(chromeos::DIR_USER_POLICY_KEYS, &user_keys_dir)); |
176 std::string sanitized_username = | 176 std::string sanitized_username = |
177 chromeos::CryptohomeClient::GetStubSanitizedUsername( | 177 chromeos::CryptohomeClient::GetStubSanitizedUsername( |
178 chromeos::UserManager::kStubUser); | 178 chromeos::UserManager::kStubUser); |
179 base::FilePath user_key_file = | 179 base::FilePath user_key_file = |
180 user_keys_dir.AppendASCII(sanitized_username) | 180 user_keys_dir.AppendASCII(sanitized_username) |
181 .AppendASCII("policy.pub"); | 181 .AppendASCII("policy.pub"); |
182 std::vector<uint8> user_key_bits; | 182 std::vector<uint8> user_key_bits; |
183 ASSERT_TRUE(user_policy_.GetSigningKey()->ExportPublicKey(&user_key_bits)); | 183 ASSERT_TRUE(user_policy_.GetSigningKey()->ExportPublicKey(&user_key_bits)); |
184 ASSERT_TRUE(file_util::CreateDirectory(user_key_file.DirName())); | 184 ASSERT_TRUE(base::CreateDirectory(user_key_file.DirName())); |
185 ASSERT_EQ(file_util::WriteFile( | 185 ASSERT_EQ(file_util::WriteFile( |
186 user_key_file, | 186 user_key_file, |
187 reinterpret_cast<const char*>(user_key_bits.data()), | 187 reinterpret_cast<const char*>(user_key_bits.data()), |
188 user_key_bits.size()), | 188 user_key_bits.size()), |
189 static_cast<int>(user_key_bits.size())); | 189 static_cast<int>(user_key_bits.size())); |
190 } | 190 } |
191 | 191 |
192 void PowerPolicyBrowserTestBase::StoreAndReloadUserPolicy() { | 192 void PowerPolicyBrowserTestBase::StoreAndReloadUserPolicy() { |
193 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 193 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
194 Profile* profile = profile_manager->GetProfileByPath( | 194 Profile* profile = profile_manager->GetProfileByPath( |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 policy.set_ac_idle_action( | 423 policy.set_ac_idle_action( |
424 power_manager_client_->get_policy().ac_idle_action()); | 424 power_manager_client_->get_policy().ac_idle_action()); |
425 policy.set_battery_idle_action( | 425 policy.set_battery_idle_action( |
426 power_manager_client_->get_policy().battery_idle_action()); | 426 power_manager_client_->get_policy().battery_idle_action()); |
427 policy.set_reason(power_manager_client_->get_policy().reason()); | 427 policy.set_reason(power_manager_client_->get_policy().reason()); |
428 EXPECT_EQ(GetDebugString(policy), | 428 EXPECT_EQ(GetDebugString(policy), |
429 GetDebugString(power_manager_client_->get_policy())); | 429 GetDebugString(power_manager_client_->get_policy())); |
430 } | 430 } |
431 | 431 |
432 } // namespace policy | 432 } // namespace policy |
OLD | NEW |