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() { ...@@ -28,6 +28,9 @@ bool DisableSigninRecallPromo() {
bool DisableUpdateService() { bool DisableUpdateService() {
return false; return false;
} }
bool DisableMainThreadFreezeDetection() {
return false;
}
policy::ConfigurationPolicyProvider* GetOverriddenPlatformPolicyProvider() { policy::ConfigurationPolicyProvider* GetOverriddenPlatformPolicyProvider() {
return nullptr; return nullptr;
} }
......
...@@ -36,6 +36,11 @@ bool DisableSigninRecallPromo(); ...@@ -36,6 +36,11 @@ bool DisableSigninRecallPromo();
// infobar won't be shown during testing. // infobar won't be shown during testing.
bool DisableUpdateService(); 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 // Returns a policy provider that should be installed as the platform policy
// provider when testing. May return nullptr. // provider when testing. May return nullptr.
policy::ConfigurationPolicyProvider* GetOverriddenPlatformPolicyProvider(); policy::ConfigurationPolicyProvider* GetOverriddenPlatformPolicyProvider();
......
...@@ -26,6 +26,7 @@ source_set("crash_report") { ...@@ -26,6 +26,7 @@ source_set("crash_report") {
"//base", "//base",
"//components/crash/core/common", "//components/crash/core/common",
"//components/upload_list", "//components/upload_list",
"//ios/chrome/app:tests_hook",
"//ios/chrome/browser", "//ios/chrome/browser",
"//ios/chrome/browser/browser_state", "//ios/chrome/browser/browser_state",
"//ios/chrome/browser/crash_report/breadcrumbs", "//ios/chrome/browser/crash_report/breadcrumbs",
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "ios/chrome/app/tests_hook.h"
#include "ios/chrome/browser/crash_report/breakpad_helper.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/Breakpad.h"
#import "third_party/breakpad/breakpad/src/client/ios/BreakpadController.h" #import "third_party/breakpad/breakpad/src/client/ios/BreakpadController.h"
...@@ -110,7 +111,8 @@ void LogRecoveryTime(base::TimeDelta time) { ...@@ -110,7 +111,8 @@ void LogRecoveryTime(base::TimeDelta time) {
} }
- (void)start { - (void)start {
if (self.delay == 0 || self.running || !_enabled) { if (self.delay == 0 || self.running || !_enabled ||
tests_hook::DisableMainThreadFreezeDetection()) {
return; return;
} }
self.running = YES; self.running = YES;
......
...@@ -37,6 +37,10 @@ bool DisableUpdateService() { ...@@ -37,6 +37,10 @@ bool DisableUpdateService() {
return true; return true;
} }
bool DisableMainThreadFreezeDetection() {
return true;
}
policy::ConfigurationPolicyProvider* GetOverriddenPlatformPolicyProvider() { policy::ConfigurationPolicyProvider* GetOverriddenPlatformPolicyProvider() {
if (base::CommandLine::ForCurrentProcess()->HasSwitch( if (base::CommandLine::ForCurrentProcess()->HasSwitch(
"com.apple.configuration.managed")) { "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