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

Side by Side Diff: components/mus/ws/window_manager_client_unittest.cc

Issue 1906623003: Convert //components/mus from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 class TestWindowManagerDelegate : public WindowManagerDelegate { 45 class TestWindowManagerDelegate : public WindowManagerDelegate {
46 public: 46 public:
47 TestWindowManagerDelegate() {} 47 TestWindowManagerDelegate() {}
48 ~TestWindowManagerDelegate() override {} 48 ~TestWindowManagerDelegate() override {}
49 49
50 // WindowManagerDelegate: 50 // WindowManagerDelegate:
51 void SetWindowManagerClient(WindowManagerClient* client) override {} 51 void SetWindowManagerClient(WindowManagerClient* client) override {}
52 bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override { 52 bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override {
53 return false; 53 return false;
54 } 54 }
55 bool OnWmSetProperty(Window* window, 55 bool OnWmSetProperty(
56 const std::string& name, 56 Window* window,
57 scoped_ptr<std::vector<uint8_t>>* new_data) override { 57 const std::string& name,
58 std::unique_ptr<std::vector<uint8_t>>* new_data) override {
58 return true; 59 return true;
59 } 60 }
60 Window* OnWmCreateTopLevelWindow( 61 Window* OnWmCreateTopLevelWindow(
61 std::map<std::string, std::vector<uint8_t>>* properties) override { 62 std::map<std::string, std::vector<uint8_t>>* properties) override {
62 return nullptr; 63 return nullptr;
63 } 64 }
64 void OnAccelerator(uint32_t id, const ui::Event& event) override {} 65 void OnAccelerator(uint32_t id, const ui::Event& event) override {}
65 66
66 private: 67 private:
67 DISALLOW_COPY_AND_ASSIGN(TestWindowManagerDelegate); 68 DISALLOW_COPY_AND_ASSIGN(TestWindowManagerDelegate);
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 WindowTreeConnection* connection; 324 WindowTreeConnection* connection;
324 }; 325 };
325 326
326 void EmbedCallbackImpl(bool result) { 327 void EmbedCallbackImpl(bool result) {
327 embed_details_->callback_run = true; 328 embed_details_->callback_run = true;
328 embed_details_->result = result; 329 embed_details_->result = result;
329 if (embed_details_->waiting && (!result || embed_details_->connection)) 330 if (embed_details_->waiting && (!result || embed_details_->connection))
330 EXPECT_TRUE(WindowServerTestBase::QuitRunLoop()); 331 EXPECT_TRUE(WindowServerTestBase::QuitRunLoop());
331 } 332 }
332 333
333 scoped_ptr<EmbedDetails> embed_details_; 334 std::unique_ptr<EmbedDetails> embed_details_;
334 335
335 DISALLOW_COPY_AND_ASSIGN(WindowServerTest); 336 DISALLOW_COPY_AND_ASSIGN(WindowServerTest);
336 }; 337 };
337 338
338 TEST_F(WindowServerTest, RootWindow) { 339 TEST_F(WindowServerTest, RootWindow) {
339 ASSERT_NE(nullptr, window_manager()); 340 ASSERT_NE(nullptr, window_manager());
340 EXPECT_EQ(1u, window_manager()->GetRoots().size()); 341 EXPECT_EQ(1u, window_manager()->GetRoots().size());
341 } 342 }
342 343
343 TEST_F(WindowServerTest, Embed) { 344 TEST_F(WindowServerTest, Embed) {
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 std::map<std::string, std::vector<uint8_t>>* properties) override { 1133 std::map<std::string, std::vector<uint8_t>>* properties) override {
1133 created_window_ = connection_->NewWindow(properties); 1134 created_window_ = connection_->NewWindow(properties);
1134 (*connection_->GetRoots().begin())->AddChild(created_window_); 1135 (*connection_->GetRoots().begin())->AddChild(created_window_);
1135 if (run_loop_) 1136 if (run_loop_)
1136 run_loop_->Quit(); 1137 run_loop_->Quit();
1137 return created_window_; 1138 return created_window_;
1138 } 1139 }
1139 1140
1140 private: 1141 private:
1141 WindowTreeConnection* connection_; 1142 WindowTreeConnection* connection_;
1142 scoped_ptr<base::RunLoop> run_loop_; 1143 std::unique_ptr<base::RunLoop> run_loop_;
1143 Window* created_window_; 1144 Window* created_window_;
1144 1145
1145 DISALLOW_COPY_AND_ASSIGN(EstablishConnectionViaFactoryDelegate); 1146 DISALLOW_COPY_AND_ASSIGN(EstablishConnectionViaFactoryDelegate);
1146 }; 1147 };
1147 1148
1148 TEST_F(WindowServerTest, EstablishConnectionViaFactory) { 1149 TEST_F(WindowServerTest, EstablishConnectionViaFactory) {
1149 EstablishConnectionViaFactoryDelegate delegate(window_manager()); 1150 EstablishConnectionViaFactoryDelegate delegate(window_manager());
1150 set_window_manager_delegate(&delegate); 1151 set_window_manager_delegate(&delegate);
1151 scoped_ptr<WindowTreeConnection> second_connection( 1152 std::unique_ptr<WindowTreeConnection> second_connection(
1152 WindowTreeConnection::Create(this, connector())); 1153 WindowTreeConnection::Create(this, connector()));
1153 Window* window_in_second_connection = 1154 Window* window_in_second_connection =
1154 second_connection->NewTopLevelWindow(nullptr); 1155 second_connection->NewTopLevelWindow(nullptr);
1155 ASSERT_TRUE(window_in_second_connection); 1156 ASSERT_TRUE(window_in_second_connection);
1156 ASSERT_TRUE(second_connection->GetRoots().count(window_in_second_connection) > 1157 ASSERT_TRUE(second_connection->GetRoots().count(window_in_second_connection) >
1157 0); 1158 0);
1158 // Wait for the window to appear in the wm. 1159 // Wait for the window to appear in the wm.
1159 ASSERT_TRUE(delegate.QuitOnCreate()); 1160 ASSERT_TRUE(delegate.QuitOnCreate());
1160 1161
1161 Window* window_in_wm = delegate.created_window(); 1162 Window* window_in_wm = delegate.created_window();
1162 ASSERT_TRUE(window_in_wm); 1163 ASSERT_TRUE(window_in_wm);
1163 1164
1164 // Change the bounds in the wm, and make sure the child sees it. 1165 // Change the bounds in the wm, and make sure the child sees it.
1165 window_in_wm->SetBounds(gfx::Rect(1, 11, 12, 101)); 1166 window_in_wm->SetBounds(gfx::Rect(1, 11, 12, 101));
1166 ASSERT_TRUE(WaitForBoundsToChange(window_in_second_connection)); 1167 ASSERT_TRUE(WaitForBoundsToChange(window_in_second_connection));
1167 EXPECT_EQ(gfx::Rect(1, 11, 12, 101), window_in_second_connection->bounds()); 1168 EXPECT_EQ(gfx::Rect(1, 11, 12, 101), window_in_second_connection->bounds());
1168 } 1169 }
1169 1170
1170 } // namespace ws 1171 } // namespace ws
1171 } // namespace mus 1172 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/user_display_manager_unittest.cc ('k') | components/mus/ws/window_manager_factory_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698