Commit 8d2c5139 authored by Olivier Robin's avatar Olivier Robin Committed by Commit Bot

Disable MainThreadFreezeDetection on tests

The main thread test interfers with the EarlGrey synchromization.
If a tests enables metrics, any subsequent sync will wait forever.
Disable MainThreadFreezeDetection on tests.

Bug: 1070286
Change-Id: I96381b423f9915f22015bfe1af264e3ce51697ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2151517Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759715}
parent f7cdf235
......@@ -28,6 +28,9 @@ bool DisableSigninRecallPromo() {
bool DisableUpdateService() {
return false;
}
bool DisableMainThreadFreezeDetection() {
return false;
}
policy::ConfigurationPolicyProvider* GetOverriddenPlatformPolicyProvider() {
return nullptr;
}
......
......@@ -36,6 +36,11 @@ bool DisableSigninRecallPromo();
// infobar won't be shown during testing.
bool DisableUpdateService();
// The main thread freeze detection is interfering with the EarlGrey
// synchronization.
// Return true if it should be disabled.
bool DisableMainThreadFreezeDetection();
// Returns a policy provider that should be installed as the platform policy
// provider when testing. May return nullptr.
policy::ConfigurationPolicyProvider* GetOverriddenPlatformPolicyProvider();
......
......@@ -26,6 +26,7 @@ source_set("crash_report") {
"//base",
"//components/crash/core/common",
"//components/upload_list",
"//ios/chrome/app:tests_hook",
"//ios/chrome/browser",
"//ios/chrome/browser/browser_state",
"//ios/chrome/browser/crash_report/breadcrumbs",
......
......@@ -6,6 +6,7 @@
#include "base/metrics/histogram_macros.h"
#include "base/time/time.h"
#include "ios/chrome/app/tests_hook.h"
#include "ios/chrome/browser/crash_report/breakpad_helper.h"
#import "third_party/breakpad/breakpad/src/client/ios/Breakpad.h"
#import "third_party/breakpad/breakpad/src/client/ios/BreakpadController.h"
......@@ -110,7 +111,8 @@ void LogRecoveryTime(base::TimeDelta time) {
}
- (void)start {
if (self.delay == 0 || self.running || !_enabled) {
if (self.delay == 0 || self.running || !_enabled ||
tests_hook::DisableMainThreadFreezeDetection()) {
return;
}
self.running = YES;
......
......@@ -37,6 +37,10 @@ bool DisableUpdateService() {
return true;
}
bool DisableMainThreadFreezeDetection() {
return true;
}
policy::ConfigurationPolicyProvider* GetOverriddenPlatformPolicyProvider() {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
"com.apple.configuration.managed")) {
......
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