Relanding "Add apk for running content_browsertests"
Revert "Revert 179189"
This reverts commit 5844ab0c6a41cc9d306f8c355cc7ceb5e290cbb1.
Original CL:https://codereview.chromium.org/12047068/
was reverted as we failed to update the bot scripts with the new package
name for content_shell_apk
TBR=mark@chromium.org,jam@chromium.org
BUG=138275
Review URL: https://chromiumcodereview.appspot.com/12091033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179428 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 4d4eb5babc558ccddc09168f66970905ed0204d4
diff --git a/base/message_loop.cc b/base/message_loop.cc
index 5428026..0a6bf6c 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -251,9 +251,12 @@
}
// static
-void MessageLoop::InitMessagePumpForUIFactory(MessagePumpFactory* factory) {
- DCHECK(!message_pump_for_ui_factory_);
+bool MessageLoop::InitMessagePumpForUIFactory(MessagePumpFactory* factory) {
+ if (message_pump_for_ui_factory_)
+ return false;
+
message_pump_for_ui_factory_ = factory;
+ return true;
}
void MessageLoop::AddDestructionObserver(
diff --git a/base/message_loop.h b/base/message_loop.h
index 446a520..b690940 100644
--- a/base/message_loop.h
+++ b/base/message_loop.h
@@ -120,9 +120,10 @@
static void EnableHistogrammer(bool enable_histogrammer);
typedef base::MessagePump* (MessagePumpFactory)();
- // Using the given base::MessagePumpForUIFactory to override the default
- // MessagePump implementation for 'TYPE_UI'.
- static void InitMessagePumpForUIFactory(MessagePumpFactory* factory);
+ // Uses the given base::MessagePumpForUIFactory to override the default
+ // MessagePump implementation for 'TYPE_UI'. Returns true if the factory
+ // was successfully registered.
+ static bool InitMessagePumpForUIFactory(MessagePumpFactory* factory);
// A DestructionObserver is notified when the current MessageLoop is being
// destroyed. These observers are notified prior to MessageLoop::current()
diff --git a/base/test/test_support_android.cc b/base/test/test_support_android.cc
index 8b512f4..e38a897 100644
--- a/base/test/test_support_android.cc
+++ b/base/test/test_support_android.cc
@@ -183,7 +183,8 @@
}
void InitAndroidTestMessageLoop() {
- MessageLoop::InitMessagePumpForUIFactory(&CreateMessagePumpForUIStub);
+ if (!MessageLoop::InitMessagePumpForUIFactory(&CreateMessagePumpForUIStub))
+ LOG(INFO) << "MessagePumpForUIFactory already set, unable to override.";
}
void InitAndroidTest() {