summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_apitest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions/extension_apitest.cc')
-rw-r--r--chrome/browser/extensions/extension_apitest.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc
index cc16957..081a092 100644
--- a/chrome/browser/extensions/extension_apitest.cc
+++ b/chrome/browser/extensions/extension_apitest.cc
@@ -10,6 +10,10 @@
#include "chrome/common/notification_registrar.h"
#include "chrome/test/ui_test_utils.h"
+namespace {
+static const int kTimeoutMs = 60 * 1000; // 1 minute
+};
+
ExtensionApiTest::ResultCatcher::ResultCatcher() {
registrar_.Add(this, NotificationType::EXTENSION_TEST_PASSED,
NotificationService::AllSources());
@@ -22,18 +26,19 @@ bool ExtensionApiTest::ResultCatcher::GetNextResult() {
// to RunMessageLoop(), so we maintain a queue of results and just pull them
// off as the test calls this, going to the run loop only when the queue is
// empty.
- if (results_.empty())
+ if (!results_.size()) {
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE, new MessageLoop::QuitTask, kTimeoutMs);
ui_test_utils::RunMessageLoop();
-
- if (!results_.empty()) {
+ }
+ if (results_.size()) {
bool ret = results_.front();
results_.pop_front();
message_ = messages_.front();
messages_.pop_front();
return ret;
}
-
- NOTREACHED();
+ message_ = "No response from message loop.";
return false;
}