Commit 5c97f509 authored by Abhishek Bhardwaj's avatar Abhishek Bhardwaj Committed by Commit Bot

arc: Add switch to prevent ARC container throttling during tests

This change adds a switch that prevents CPU throttling for the ARC
container. This is needed for some ARC tests that timeout when the
container is throttled.

BUG=b:118696077
TEST=Manual testing.

Change-Id: Ic78a8f3cc00d2b33ce8d083bfd6b84f9de246ec9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1561050Reviewed-by: default avatarHidehiko Abe <hidehiko@chromium.org>
Reviewed-by: default avatarDan Erat <derat@chromium.org>
Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649722}
parent 10a1abdf
...@@ -542,6 +542,11 @@ const char kWaitForInitialPolicyFetchForTest[] = ...@@ -542,6 +542,11 @@ const char kWaitForInitialPolicyFetchForTest[] =
// of network packets from whitelisted sources. // of network packets from whitelisted sources.
const char kWakeOnWifiPacket[] = "wake-on-wifi-packet"; const char kWakeOnWifiPacket[] = "wake-on-wifi-packet";
// Prevents any CPU restrictions being set on the ARC container. Only meant to
// be used by tests as some tests may time out if the ARC container is
// throttled.
const char kDisableArcCpuRestriction[] = "disable-arc-cpu-restriction";
bool WakeOnWifiEnabled() { bool WakeOnWifiEnabled() {
return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi); return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi);
} }
...@@ -650,5 +655,10 @@ bool IsGaiaServicesDisabled() { ...@@ -650,5 +655,10 @@ bool IsGaiaServicesDisabled() {
kDisableGaiaServices); kDisableGaiaServices);
} }
bool IsArcCpuRestrictionDisabled() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(
kDisableArcCpuRestriction);
}
} // namespace switches } // namespace switches
} // namespace chromeos } // namespace chromeos
...@@ -185,6 +185,8 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kOobeGuestSession[]; ...@@ -185,6 +185,8 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kOobeGuestSession[];
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kOobeSkipPostLogin[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kOobeSkipPostLogin[];
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kOobeSkipToLogin[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kOobeSkipToLogin[];
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kOobeTimerInterval[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kOobeTimerInterval[];
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const char kDisableArcCpuRestriction[];
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kProfileRequiresPolicy[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kProfileRequiresPolicy[];
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const char kRedirectLibassistantLogging[]; extern const char kRedirectLibassistantLogging[];
...@@ -290,6 +292,9 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool ShouldSkipOobePostLogin(); ...@@ -290,6 +292,9 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool ShouldSkipOobePostLogin();
// Returns true if GAIA services has been disabled. // Returns true if GAIA services has been disabled.
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsGaiaServicesDisabled(); COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsGaiaServicesDisabled();
// Returns true if |kDisableArcCpuRestriction| is true.
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsArcCpuRestrictionDisabled();
} // namespace switches } // namespace switches
} // namespace chromeos } // namespace chromeos
......
...@@ -182,6 +182,10 @@ void SetArcCpuRestriction(bool do_restrict) { ...@@ -182,6 +182,10 @@ void SetArcCpuRestriction(bool do_restrict) {
LOG(WARNING) << "SessionManagerClient is not available"; LOG(WARNING) << "SessionManagerClient is not available";
return; return;
} }
if (chromeos::switches::IsArcCpuRestrictionDisabled())
return;
const login_manager::ContainerCpuRestrictionState state = const login_manager::ContainerCpuRestrictionState state =
do_restrict ? login_manager::CONTAINER_CPU_RESTRICTION_BACKGROUND do_restrict ? login_manager::CONTAINER_CPU_RESTRICTION_BACKGROUND
: login_manager::CONTAINER_CPU_RESTRICTION_FOREGROUND; : login_manager::CONTAINER_CPU_RESTRICTION_FOREGROUND;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment