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

Unified Diff: chrome/browser/policy/test/local_policy_test_server.cc

Issue 2530023002: Fix policy test server key rotation feature (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/test/local_policy_test_server.cc
diff --git a/chrome/browser/policy/test/local_policy_test_server.cc b/chrome/browser/policy/test/local_policy_test_server.cc
index f336af1d07e37b7373272052e2a1f4d9a210fe9f..476e037c4a158078577522a462fc83e15b78e432 100644
--- a/chrome/browser/policy/test/local_policy_test_server.cc
+++ b/chrome/browser/policy/test/local_policy_test_server.cc
@@ -15,6 +15,7 @@
#include "base/json/json_writer.h"
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
+#include "base/values.h"
#include "build/build_config.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "crypto/rsa_private_key.h"
@@ -114,6 +115,10 @@ bool LocalPolicyTestServer::SetSigningKeyAndSignature(
return bytes_written == static_cast<int>(signature.size());
}
+void LocalPolicyTestServer::SetSigningKeysAutomaticRotation() {
+ signing_keys_automatic_rotation_ = true;
+}
+
void LocalPolicyTestServer::RegisterClient(const std::string& dm_token,
const std::string& device_id) {
CHECK(server_data_dir_.IsValid());
@@ -237,6 +242,10 @@ bool LocalPolicyTestServer::GenerateAdditionalArguments(
arguments->SetString("config-file", config_file_.AsUTF8Unsafe());
if (!policy_key_.empty())
arguments->SetString("policy-key", policy_key_.AsUTF8Unsafe());
+ if (signing_keys_automatic_rotation_) {
+ arguments->Set("rotate-policy-keys-automatically",
+ base::Value::CreateNullValue());
+ }
if (server_data_dir_.IsValid()) {
arguments->SetString("data-dir", server_data_dir_.GetPath().AsUTF8Unsafe());

Powered by Google App Engine
This is Rietveld 408576698