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

Unified Diff: ios/chrome/test/ios_chrome_unit_test_suite.mm

Issue 2592173002: Fix ios_chrome_unittests to crash on DCHECK failure. (Closed)
Patch Set: Address comments Created 4 years 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
« no previous file with comments | « ios/chrome/test/ios_chrome_unit_test_suite.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/test/ios_chrome_unit_test_suite.mm
diff --git a/ios/chrome/test/ios_chrome_unit_test_suite.mm b/ios/chrome/test/ios_chrome_unit_test_suite.mm
index 43b6b2b2b144114614f50f9fcee4a641ea042f99..0797c7de4f697aac656b40e33e292f71b317a2f1 100644
--- a/ios/chrome/test/ios_chrome_unit_test_suite.mm
+++ b/ios/chrome/test/ios_chrome_unit_test_suite.mm
@@ -5,7 +5,9 @@
#include "ios/chrome/test/ios_chrome_unit_test_suite.h"
#include "base/macros.h"
+#include "base/metrics/user_metrics.h"
#include "base/path_service.h"
+#include "base/test/test_simple_task_runner.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "ios/chrome/browser/browser_state/browser_state_keyed_service_factories.h"
#include "ios/chrome/browser/chrome_paths.h"
@@ -55,7 +57,8 @@ class IOSChromeUnitTestSuiteInitializer
} // namespace
IOSChromeUnitTestSuite::IOSChromeUnitTestSuite(int argc, char** argv)
- : web::WebTestSuite(argc, argv) {}
+ : web::WebTestSuite(argc, argv),
+ action_task_runner_(new base::TestSimpleTaskRunner) {}
IOSChromeUnitTestSuite::~IOSChromeUnitTestSuite() {}
@@ -74,6 +77,10 @@ void IOSChromeUnitTestSuite::Initialize() {
// test is run so that the dependencies are correctly resolved.
EnsureBrowserStateKeyedServiceFactoriesBuilt();
+ // Register a SingleThreadTaskRunner for base::RecordAction as overridding
+ // it in individual tests is unsafe (as there is no way to unregister).
+ base::SetRecordActionTaskRunner(action_task_runner_);
+
ios::RegisterPathProvider();
ui::RegisterPathProvider();
url::AddStandardScheme(kChromeUIScheme, url::SCHEME_WITHOUT_PORT);
« no previous file with comments | « ios/chrome/test/ios_chrome_unit_test_suite.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698