Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Unified Diff: ui/aura/test/test_screen.cc

Issue 2445163002: Make aura work with mus (Closed)
Patch Set: NON_EXPORTED_BASE_CLASS Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/test/test_screen.h ('k') | ui/aura/window_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/test/test_screen.cc
diff --git a/ui/aura/test/test_screen.cc b/ui/aura/test/test_screen.cc
index f19137c6dc5e3e675e1171ab4c42aa24dda6b905..4bfb697e9b33be7fd4d9a54d8eef3eff32a8e14b 100644
--- a/ui/aura/test/test_screen.cc
+++ b/ui/aura/test/test_screen.cc
@@ -8,6 +8,8 @@
#include "base/logging.h"
#include "ui/aura/env.h"
+#include "ui/aura/mus/window_tree_client.h"
+#include "ui/aura/test/mus/window_tree_client_private.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_tree_host.h"
@@ -29,11 +31,13 @@ bool IsRotationPortrait(display::Display::Rotation rotation) {
} // namespace
// static
-TestScreen* TestScreen::Create(const gfx::Size& size) {
+TestScreen* TestScreen::Create(const gfx::Size& size,
+ WindowTreeClient* window_tree_client) {
const gfx::Size kDefaultSize(800, 600);
// Use (0,0) because the desktop aura tests are executed in
// native environment where the display's origin is (0,0).
- return new TestScreen(gfx::Rect(size.IsEmpty() ? kDefaultSize : size));
+ return new TestScreen(gfx::Rect(size.IsEmpty() ? kDefaultSize : size),
+ window_tree_client);
}
TestScreen::~TestScreen() {
@@ -41,7 +45,12 @@ TestScreen::~TestScreen() {
WindowTreeHost* TestScreen::CreateHostForPrimaryDisplay() {
DCHECK(!host_);
- host_ = WindowTreeHost::Create(gfx::Rect(display_.GetSizeInPixel()));
+ if (window_tree_client_) {
+ host_ = WindowTreeClientPrivate(window_tree_client_)
+ .CallWmNewDisplayAdded(display_);
+ } else {
+ host_ = WindowTreeHost::Create(gfx::Rect(display_.GetSizeInPixel()));
+ }
// Some tests don't correctly manage window focus/activation states.
// Makes sure InputMethod is default focused so that IME basics can work.
host_->GetInputMethod()->OnFocus();
@@ -167,9 +176,9 @@ void TestScreen::AddObserver(display::DisplayObserver* observer) {}
void TestScreen::RemoveObserver(display::DisplayObserver* observer) {}
-TestScreen::TestScreen(const gfx::Rect& screen_bounds)
- : host_(NULL),
- ui_scale_(1.0f) {
+TestScreen::TestScreen(const gfx::Rect& screen_bounds,
+ WindowTreeClient* window_tree_client)
+ : host_(nullptr), ui_scale_(1.0f), window_tree_client_(window_tree_client) {
static int64_t synthesized_display_id = 2000;
display_.set_id(synthesized_display_id++);
display_.SetScaleAndBounds(1.0f, screen_bounds);
« no previous file with comments | « ui/aura/test/test_screen.h ('k') | ui/aura/window_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698