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

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

Issue 2835233002: Fix integration tests in src/chrome and src/extensions so that we can turn on IO thread checks wi... (Closed)
Patch Set: ready for review Created 3 years, 8 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 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 0f9a9d9a46c2ce9dfd8775582f170c4b71b8ec7f..731588ba7d5eb93ac90d92da0ae946b94c4480ea 100644
--- a/chrome/browser/policy/test/local_policy_test_server.cc
+++ b/chrome/browser/policy/test/local_policy_test_server.cc
@@ -17,6 +17,7 @@
#include "base/numerics/safe_conversions.h"
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
+#include "base/threading/thread_restrictions.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
@@ -63,6 +64,7 @@ LocalPolicyTestServer::LocalPolicyTestServer()
: net::LocalTestServer(net::BaseTestServer::TYPE_HTTP,
net::BaseTestServer::kLocalhost,
base::FilePath()) {
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
CHECK(server_data_dir_.CreateUniqueTempDir());
config_file_ = server_data_dir_.GetPath().Append(kPolicyFileName);
}
@@ -78,6 +80,7 @@ LocalPolicyTestServer::LocalPolicyTestServer(const std::string& test_name)
net::BaseTestServer::kLocalhost,
base::FilePath()) {
// Read configuration from a file in chrome/test/data/policy.
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
base::FilePath source_root;
CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &source_root));
config_file_ = source_root
@@ -92,6 +95,7 @@ LocalPolicyTestServer::~LocalPolicyTestServer() {}
bool LocalPolicyTestServer::SetSigningKeyAndSignature(
const crypto::RSAPrivateKey* key, const std::string& signature) {
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
CHECK(server_data_dir_.IsValid());
std::vector<uint8_t> signing_key_bits;
@@ -147,6 +151,7 @@ void LocalPolicyTestServer::RegisterClient(const std::string& dm_token,
bool LocalPolicyTestServer::UpdatePolicy(const std::string& type,
const std::string& entity_id,
const std::string& policy) {
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
CHECK(server_data_dir_.IsValid());
std::string selector = GetSelector(type, entity_id);
@@ -160,6 +165,7 @@ bool LocalPolicyTestServer::UpdatePolicy(const std::string& type,
bool LocalPolicyTestServer::UpdatePolicyData(const std::string& type,
const std::string& entity_id,
const std::string& data) {
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
CHECK(server_data_dir_.IsValid());
std::string selector = GetSelector(type, entity_id);
@@ -175,6 +181,7 @@ GURL LocalPolicyTestServer::GetServiceURL() const {
}
bool LocalPolicyTestServer::SetPythonPath() const {
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
if (!net::LocalTestServer::SetPythonPath())
return false;
@@ -222,6 +229,7 @@ bool LocalPolicyTestServer::SetPythonPath() const {
bool LocalPolicyTestServer::GetTestServerPath(
base::FilePath* testserver_path) const {
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
base::FilePath source_root;
if (!PathService::Get(base::DIR_SOURCE_ROOT, &source_root)) {
LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT";
@@ -238,6 +246,7 @@ bool LocalPolicyTestServer::GetTestServerPath(
bool LocalPolicyTestServer::GenerateAdditionalArguments(
base::DictionaryValue* arguments) const {
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
if (!net::LocalTestServer::GenerateAdditionalArguments(arguments))
return false;
« no previous file with comments | « chrome/browser/policy/policy_prefs_browsertest.cc ('k') | chrome/browser/prefs/pref_functional_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698