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

Unified Diff: chrome/browser/extensions/extension_service_test_base.cc

Issue 948413005: [Extensions] Make chrome://extensions use management.uninstall (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/extensions/extension_service_test_base.cc
diff --git a/chrome/browser/extensions/extension_service_test_base.cc b/chrome/browser/extensions/extension_service_test_base.cc
index 9cc4b6ce0f57b7a6bb706faa24150c4549e31d4c..9f8ead83bd13b773332ebb665282a663dcef8acc 100644
--- a/chrome/browser/extensions/extension_service_test_base.cc
+++ b/chrome/browser/extensions/extension_service_test_base.cc
@@ -33,6 +33,9 @@ namespace extensions {
namespace {
+// By default, we run on the IO loop.
+const int kThreadOptions = content::TestBrowserThreadBundle::IO_MAINLOOP;
not at google - send to devlin 2015/02/25 21:37:57 UI thread makes more sense for a default test thre
Devlin 2015/02/25 23:12:47 But breaks tons of other stuff, as discussed offli
+
// Create a testing profile according to |params|.
scoped_ptr<TestingProfile> BuildTestingProfile(
const ExtensionServiceTestBase::ExtensionServiceInitParams& params) {
@@ -68,10 +71,10 @@ ExtensionServiceTestBase::ExtensionServiceInitParams::
profile_is_supervised(false) {
}
-// Our message loop may be used in tests which require it to be an IO loop.
ExtensionServiceTestBase::ExtensionServiceTestBase()
: service_(NULL),
- thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
+ thread_bundle_(new content::TestBrowserThreadBundle(kThreadOptions)),
+ did_reset_thread_bundle_(false),
registry_(NULL) {
base::FilePath test_data_dir;
if (!PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)) {
@@ -82,6 +85,11 @@ ExtensionServiceTestBase::ExtensionServiceTestBase()
}
ExtensionServiceTestBase::~ExtensionServiceTestBase() {
+ // Parts of destruction have to happen on an IO thread, so if the thread
+ // bundle is reset, we need to change it back.
+ if (did_reset_thread_bundle_)
+ ResetThreadBundle(kThreadOptions);
+
// Why? Because |profile_| has to be destroyed before |at_exit_manager_|, but
// is declared above it in the class definition since it's protected.
profile_.reset();
@@ -170,6 +178,12 @@ void ExtensionServiceTestBase::InitializeExtensionServiceWithUpdater() {
service_->updater()->Start();
}
+void ExtensionServiceTestBase::ResetThreadBundle(int options) {
+ did_reset_thread_bundle_ = true;
+ thread_bundle_.reset();
+ thread_bundle_.reset(new content::TestBrowserThreadBundle(options));
+}
+
void ExtensionServiceTestBase::SetUp() {
ExtensionErrorReporter::GetInstance()->ClearErrors();
}

Powered by Google App Engine
This is Rietveld 408576698