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

Unified Diff: services/ui/ws/test_utils.cc

Issue 2497303002: Fix ws::Display initialization order. (Closed)
Patch Set: Fix use after move in test. Created 4 years, 1 month 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 | « services/ui/ws/test_utils.h ('k') | services/ui/ws/user_display_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/test_utils.cc
diff --git a/services/ui/ws/test_utils.cc b/services/ui/ws/test_utils.cc
index d72ba01dc60c27a5b9ee7f5666dce31de83969bc..23d538ee46aa60bf80b7cba0aba6b9bfe0cb5c20 100644
--- a/services/ui/ws/test_utils.cc
+++ b/services/ui/ws/test_utils.cc
@@ -40,7 +40,9 @@ class TestPlatformDisplay : public PlatformDisplay {
~TestPlatformDisplay() override {}
// PlatformDisplay:
- void Init(PlatformDisplayDelegate* delegate) override {}
+ void Init(PlatformDisplayDelegate* delegate) override {
+ delegate->OnAcceleratedWidgetAvailable();
+ }
int64_t GetId() const override { return id_; }
void SetViewportSize(const gfx::Size& size) override {}
void SetTitle(const base::string16& title) override {}
@@ -99,10 +101,11 @@ TestPlatformDisplayFactory::TestPlatformDisplayFactory(
TestPlatformDisplayFactory::~TestPlatformDisplayFactory() {}
-PlatformDisplay* TestPlatformDisplayFactory::CreatePlatformDisplay() {
+std::unique_ptr<PlatformDisplay>
+TestPlatformDisplayFactory::CreatePlatformDisplay() {
bool is_primary = (next_display_id_ == kFirstDisplayId);
- return new TestPlatformDisplay(next_display_id_++, is_primary,
- cursor_storage_);
+ return base::MakeUnique<TestPlatformDisplay>(next_display_id_++, is_primary,
+ cursor_storage_);
}
// TestFrameGeneratorDelegate -------------------------------------------------
@@ -412,8 +415,8 @@ void TestWindowServerDelegate::CreateDisplays(int num_displays) {
Display* TestWindowServerDelegate::AddDisplay() {
// Display manages its own lifetime.
- Display* display = new Display(window_server_, PlatformDisplayInitParams());
- display->Init(nullptr);
+ Display* display = new Display(window_server_);
+ display->Init(PlatformDisplayInitParams(), nullptr);
return display;
}
@@ -457,12 +460,11 @@ WindowServerTestHelper::~WindowServerTestHelper() {
// WindowEventTargetingHelper ------------------------------------------------
-WindowEventTargetingHelper::WindowEventTargetingHelper()
- : wm_client_(nullptr), display_binding_(nullptr), display_(nullptr) {
- PlatformDisplayInitParams display_init_params;
- display_ = new Display(window_server(), display_init_params);
+WindowEventTargetingHelper::WindowEventTargetingHelper() {
+ display_ = new Display(window_server());
display_binding_ = new TestDisplayBinding(window_server());
- display_->Init(base::WrapUnique(display_binding_));
+ display_->Init(PlatformDisplayInitParams(),
+ base::WrapUnique(display_binding_));
wm_client_ = ws_test_helper_.window_server_delegate()->last_client();
wm_client_->tracker()->changes()->clear();
}
« no previous file with comments | « services/ui/ws/test_utils.h ('k') | services/ui/ws/user_display_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698