Index: chrome/browser/chromeos/login/session/chrome_session_manager.cc |
diff --git a/chrome/browser/chromeos/login/session/chrome_session_manager.cc b/chrome/browser/chromeos/login/session/chrome_session_manager.cc |
index 466133dfe07f97373a7f2367457293c2f7e40463..54514ca0119f754ec9d4d3a722208580e715bf99 100644 |
--- a/chrome/browser/chromeos/login/session/chrome_session_manager.cc |
+++ b/chrome/browser/chromeos/login/session/chrome_session_manager.cc |
@@ -26,6 +26,7 @@ |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/signin/signin_manager_factory.h" |
#include "chrome/browser/ui/ash/ash_util.h" |
+#include "chrome/browser/ui/ash/session_controller_client.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/common/pref_names.h" |
#include "chromeos/audio/cras_audio_handler.h" |
@@ -133,8 +134,12 @@ void StartRestoreAfterCrashSession(Profile* user_profile, |
bool is_running_test = command_line->HasSwitch(::switches::kTestName) || |
command_line->HasSwitch(::switches::kTestType); |
- |
- if (!is_running_test) { |
+ if (is_running_test) { |
+ // Some browser tests (e.g. BrowserTest.GetSizeForNewRenderView) require |
+ // that ash is synchronously initialized before the first test window opens. |
+ // Ensure the session-related mojo messages are sent to ash. |
+ SessionControllerClient::FlushForTesting(); |
+ } else { |
// Enable CrasAudioHandler logging when chrome restarts after crashing. |
if (chromeos::CrasAudioHandler::IsInitialized()) |
chromeos::CrasAudioHandler::Get()->LogErrors(); |