Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: chrome/browser/chromeos/policy/power_policy_browsertest.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 ASSERT_TRUE(PathService::Get(chromeos::DIR_USER_POLICY_KEYS, &user_keys_dir)); 203 ASSERT_TRUE(PathService::Get(chromeos::DIR_USER_POLICY_KEYS, &user_keys_dir));
204 std::string sanitized_username = 204 std::string sanitized_username =
205 chromeos::CryptohomeClient::GetStubSanitizedUsername( 205 chromeos::CryptohomeClient::GetStubSanitizedUsername(
206 chromeos::UserManager::kStubUser); 206 chromeos::UserManager::kStubUser);
207 base::FilePath user_key_file = 207 base::FilePath user_key_file =
208 user_keys_dir.AppendASCII(sanitized_username) 208 user_keys_dir.AppendASCII(sanitized_username)
209 .AppendASCII("policy.pub"); 209 .AppendASCII("policy.pub");
210 std::vector<uint8> user_key_bits; 210 std::vector<uint8> user_key_bits;
211 ASSERT_TRUE(user_policy_.GetSigningKey()->ExportPublicKey(&user_key_bits)); 211 ASSERT_TRUE(user_policy_.GetSigningKey()->ExportPublicKey(&user_key_bits));
212 ASSERT_TRUE(base::CreateDirectory(user_key_file.DirName())); 212 ASSERT_TRUE(base::CreateDirectory(user_key_file.DirName()));
213 ASSERT_EQ(file_util::WriteFile( 213 ASSERT_EQ(base::WriteFile(
214 user_key_file, 214 user_key_file,
215 reinterpret_cast<const char*>(user_key_bits.data()), 215 reinterpret_cast<const char*>(user_key_bits.data()),
216 user_key_bits.size()), 216 user_key_bits.size()),
217 static_cast<int>(user_key_bits.size())); 217 static_cast<int>(user_key_bits.size()));
218 } 218 }
219 219
220 void PowerPolicyBrowserTestBase::StoreAndReloadUserPolicy() { 220 void PowerPolicyBrowserTestBase::StoreAndReloadUserPolicy() {
221 ProfileManager* profile_manager = g_browser_process->profile_manager(); 221 ProfileManager* profile_manager = g_browser_process->profile_manager();
222 Profile* profile = profile_manager->GetProfileByPath( 222 Profile* profile = profile_manager->GetProfileByPath(
223 profile_manager->user_data_dir().Append( 223 profile_manager->user_data_dir().Append(
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 policy = baseline_policy; 515 policy = baseline_policy;
516 policy.set_ac_idle_action(power_manager_client_->policy().ac_idle_action()); 516 policy.set_ac_idle_action(power_manager_client_->policy().ac_idle_action());
517 policy.set_battery_idle_action( 517 policy.set_battery_idle_action(
518 power_manager_client_->policy().battery_idle_action()); 518 power_manager_client_->policy().battery_idle_action());
519 policy.set_reason(power_manager_client_->policy().reason()); 519 policy.set_reason(power_manager_client_->policy().reason());
520 EXPECT_EQ(GetDebugString(policy), 520 EXPECT_EQ(GetDebugString(policy),
521 GetDebugString(power_manager_client_->policy())); 521 GetDebugString(power_manager_client_->policy()));
522 } 522 }
523 523
524 } // namespace policy 524 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698