summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chromecast/browser/cast_browser_main_parts.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/chromecast/browser/cast_browser_main_parts.cc b/chromecast/browser/cast_browser_main_parts.cc
index 8cdbc63..7c64a67 100644
--- a/chromecast/browser/cast_browser_main_parts.cc
+++ b/chromecast/browser/cast_browser_main_parts.cc
@@ -42,6 +42,11 @@
#include "net/android/network_change_notifier_factory_android.h"
#endif
+#if defined(USE_AURA)
+#include "ui/aura/test/test_screen.h"
+#include "ui/gfx/screen.h"
+#endif
+
namespace {
#if !defined(OS_ANDROID)
@@ -239,6 +244,16 @@ int CastBrowserMainParts::PreCreateThreads() {
if (!base::CreateDirectory(home_dir))
return 1;
#endif
+
+#if defined(USE_AURA)
+ // Screen can (and should) exist even with no displays connected. Its presence
+ // is assumed as an interface to access display information, e.g. from metrics
+ // code. See CastContentWindow::CreateWindowTree for update when resolution
+ // is available.
+ DCHECK(!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE));
+ gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE,
+ aura::TestScreen::Create(gfx::Size(0, 0)));
+#endif
return 0;
}