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

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

Issue 1735863002: Revert "Revert of Reland: No longer start up profile if there was an error fetching policy. (patchs… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/user_policy_test_helper.h" 5 #include "chrome/browser/chromeos/policy/user_policy_test_helper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 policy::ProfilePolicyConnector* const profile_connector = 121 policy::ProfilePolicyConnector* const profile_connector =
122 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile); 122 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile);
123 policy::PolicyService* const policy_service = 123 policy::PolicyService* const policy_service =
124 profile_connector->policy_service(); 124 profile_connector->policy_service();
125 125
126 base::RunLoop run_loop; 126 base::RunLoop run_loop;
127 policy_service->RefreshPolicies(run_loop.QuitClosure()); 127 policy_service->RefreshPolicies(run_loop.QuitClosure());
128 run_loop.Run(); 128 run_loop.Run();
129 } 129 }
130 130
131 void UserPolicyTestHelper::DeletePolicyFile() {
132 base::DeleteFile(PolicyFilePath(), false);
133 }
134
131 void UserPolicyTestHelper::WritePolicyFile( 135 void UserPolicyTestHelper::WritePolicyFile(
132 const base::DictionaryValue& mandatory, 136 const base::DictionaryValue& mandatory,
133 const base::DictionaryValue& recommended) { 137 const base::DictionaryValue& recommended) {
134 const std::string policy = BuildPolicy( 138 const std::string policy = BuildPolicy(
135 mandatory, recommended, dm_protocol::kChromeUserPolicyType, account_id_); 139 mandatory, recommended, dm_protocol::kChromeUserPolicyType, account_id_);
136 const int bytes_written = 140 const int bytes_written =
137 base::WriteFile(PolicyFilePath(), policy.data(), policy.size()); 141 base::WriteFile(PolicyFilePath(), policy.data(), policy.size());
138 ASSERT_EQ(static_cast<int>(policy.size()), bytes_written); 142 ASSERT_EQ(static_cast<int>(policy.size()), bytes_written);
139 } 143 }
140 144
141 base::FilePath UserPolicyTestHelper::PolicyFilePath() const { 145 base::FilePath UserPolicyTestHelper::PolicyFilePath() const {
142 return temp_dir_.path().AppendASCII("policy.json"); 146 return temp_dir_.path().AppendASCII("policy.json");
143 } 147 }
144 148
145 } // namespace policy 149 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/user_policy_test_helper.h ('k') | chrome/browser/policy/test/policy_testserver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698