Index: chromecast/shell/browser/cast_browser_main_parts.cc |
diff --git a/chromecast/shell/browser/cast_browser_main_parts.cc b/chromecast/shell/browser/cast_browser_main_parts.cc |
index 3f7b358349eab5b9963073d880ef7d9f71bff842..c3525a9c6005faee0145ccc8cba0d4952687aab3 100644 |
--- a/chromecast/shell/browser/cast_browser_main_parts.cc |
+++ b/chromecast/shell/browser/cast_browser_main_parts.cc |
@@ -51,6 +51,7 @@ CastBrowserMainParts::CastBrowserMainParts( |
URLRequestContextFactory* url_request_context_factory) |
: BrowserMainParts(), |
cast_browser_process_(new CastBrowserProcess()), |
+ parameters_(parameters), |
url_request_context_factory_(url_request_context_factory) { |
CommandLine* command_line = CommandLine::ForCurrentProcess(); |
AddDefaultCommandLineSwitches(command_line); |
@@ -92,7 +93,13 @@ void CastBrowserMainParts::PreMainMessageLoopRun() { |
} |
bool CastBrowserMainParts::MainMessageLoopRun(int* result_code) { |
- base::MessageLoopForUI::current()->Run(); |
+ // If parameters_.ui_task is not NULL, we are running browser tests. In this |
+ // case, the browser's main message loop will not run. |
+ if (parameters_.ui_task) { |
+ parameters_.ui_task->Run(); |
+ } else { |
+ base::MessageLoopForUI::current()->Run(); |
+ } |
return true; |
} |