Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "mojo/common/common_type_converters.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "mojo/converters/geometry/geometry_type_converters.h" | 9 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 10 #include "mojo/public/interfaces/application/service_provider.mojom.h" | 10 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
| 11 #include "mojo/services/public/cpp/view_manager/types.h" | 11 #include "mojo/services/public/cpp/view_manager/types.h" |
| 12 #include "mojo/services/public/cpp/view_manager/util.h" | 12 #include "mojo/services/public/cpp/view_manager/util.h" |
| 13 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" | 13 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
| 14 #include "mojo/services/public/interfaces/window_manager/window_manager.mojom.h" | 14 #include "mojo/services/public/interfaces/window_manager/window_manager.mojom.h" |
| 15 #include "mojo/services/public/interfaces/window_manager/window_manager_internal .mojom.h" | 15 #include "mojo/services/public/interfaces/window_manager/window_manager_internal .mojom.h" |
| 16 #include "mojo/services/view_manager/client_connection.h" | 16 #include "mojo/services/view_manager/client_connection.h" |
| 17 #include "mojo/services/view_manager/connection_manager.h" | 17 #include "mojo/services/view_manager/connection_manager.h" |
| 18 #include "mojo/services/view_manager/connection_manager_delegate.h" | 18 #include "mojo/services/view_manager/connection_manager_delegate.h" |
| 19 #include "mojo/services/view_manager/display_manager.h" | 19 #include "mojo/services/view_manager/display_manager.h" |
| 20 #include "mojo/services/view_manager/ids.h" | 20 #include "mojo/services/view_manager/ids.h" |
| 21 #include "mojo/services/view_manager/server_view.h" | |
| 21 #include "mojo/services/view_manager/test_change_tracker.h" | 22 #include "mojo/services/view_manager/test_change_tracker.h" |
| 22 #include "mojo/services/view_manager/view_manager_service_impl.h" | 23 #include "mojo/services/view_manager/view_manager_service_impl.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 24 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
| 25 | 26 |
| 26 namespace mojo { | 27 namespace mojo { |
| 27 namespace service { | 28 namespace service { |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 // ----------------------------------------------------------------------------- | 31 // ----------------------------------------------------------------------------- |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 TestViewManagerClient client_; | 107 TestViewManagerClient client_; |
| 107 | 108 |
| 108 DISALLOW_COPY_AND_ASSIGN(TestClientConnection); | 109 DISALLOW_COPY_AND_ASSIGN(TestClientConnection); |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 // ----------------------------------------------------------------------------- | 112 // ----------------------------------------------------------------------------- |
| 112 | 113 |
| 113 // Empty implementation of ConnectionManagerDelegate. | 114 // Empty implementation of ConnectionManagerDelegate. |
| 114 class TestConnectionManagerDelegate : public ConnectionManagerDelegate { | 115 class TestConnectionManagerDelegate : public ConnectionManagerDelegate { |
| 115 public: | 116 public: |
| 116 TestConnectionManagerDelegate() : last_client_(nullptr) {} | 117 TestConnectionManagerDelegate() : last_connection_(nullptr) {} |
| 117 ~TestConnectionManagerDelegate() override {} | 118 ~TestConnectionManagerDelegate() override {} |
| 118 | 119 |
| 119 // TestViewManagerClient that was created by the last | 120 TestViewManagerClient* last_client() { |
| 120 // CreateClientConnectionForEmbedAtView() call. | 121 return last_connection_ ? last_connection_->client() : nullptr; |
| 121 TestViewManagerClient* last_client() { return last_client_; } | 122 } |
| 123 | |
| 124 TestClientConnection* last_connection() { return last_connection_; } | |
| 122 | 125 |
| 123 private: | 126 private: |
| 124 // ConnectionManagerDelegate: | 127 // ConnectionManagerDelegate: |
| 125 void OnLostConnectionToWindowManager() override {} | 128 void OnLostConnectionToWindowManager() override {} |
| 126 | 129 |
| 127 ClientConnection* CreateClientConnectionForEmbedAtView( | 130 ClientConnection* CreateClientConnectionForEmbedAtView( |
| 128 ConnectionManager* connection_manager, | 131 ConnectionManager* connection_manager, |
| 129 ConnectionSpecificId creator_id, | 132 ConnectionSpecificId creator_id, |
| 130 const std::string& creator_url, | 133 const std::string& creator_url, |
| 131 const std::string& url, | 134 const std::string& url, |
| 132 const ViewId& root_id) override { | 135 const ViewId& root_id) override { |
| 133 scoped_ptr<ViewManagerServiceImpl> service(new ViewManagerServiceImpl( | 136 scoped_ptr<ViewManagerServiceImpl> service(new ViewManagerServiceImpl( |
| 134 connection_manager, creator_id, creator_url, url, root_id)); | 137 connection_manager, creator_id, creator_url, url, root_id)); |
| 135 TestClientConnection* connection = new TestClientConnection(service.Pass()); | 138 last_connection_ = new TestClientConnection(service.Pass()); |
| 136 last_client_ = connection->client(); | 139 return last_connection_; |
| 137 return connection; | |
| 138 } | 140 } |
| 139 | 141 |
| 140 TestViewManagerClient* last_client_; | 142 TestClientConnection* last_connection_; |
| 141 | 143 |
| 142 DISALLOW_COPY_AND_ASSIGN(TestConnectionManagerDelegate); | 144 DISALLOW_COPY_AND_ASSIGN(TestConnectionManagerDelegate); |
| 143 }; | 145 }; |
| 144 | 146 |
| 145 // ----------------------------------------------------------------------------- | 147 // ----------------------------------------------------------------------------- |
| 146 | 148 |
| 147 // Empty implementation of DisplayManager. | 149 // Empty implementation of DisplayManager. |
| 148 class TestDisplayManager : public DisplayManager { | 150 class TestDisplayManager : public DisplayManager { |
| 149 public: | 151 public: |
| 150 TestDisplayManager() {} | 152 TestDisplayManager() {} |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 179 | 181 |
| 180 } // namespace | 182 } // namespace |
| 181 | 183 |
| 182 // ----------------------------------------------------------------------------- | 184 // ----------------------------------------------------------------------------- |
| 183 | 185 |
| 184 class ViewManagerServiceTest : public testing::Test { | 186 class ViewManagerServiceTest : public testing::Test { |
| 185 public: | 187 public: |
| 186 ViewManagerServiceTest() : wm_client_(nullptr) {} | 188 ViewManagerServiceTest() : wm_client_(nullptr) {} |
| 187 ~ViewManagerServiceTest() override {} | 189 ~ViewManagerServiceTest() override {} |
| 188 | 190 |
| 191 // ViewManagerServiceImpl for the window manager. | |
| 192 ViewManagerServiceImpl* wm_connection() { | |
| 193 return connection_manager_->GetConnection(1); | |
| 194 } | |
| 195 | |
| 196 TestViewManagerClient* last_view_manager_client() { | |
| 197 return delegate_.last_client(); | |
| 198 } | |
| 199 | |
| 200 TestClientConnection* last_client_connection() { | |
| 201 return delegate_.last_connection(); | |
| 202 } | |
| 203 | |
| 204 ConnectionManager* connection_manager() { return connection_manager_.get(); } | |
| 205 | |
| 206 TestViewManagerClient* wm_client() { return wm_client_; } | |
| 207 | |
| 189 protected: | 208 protected: |
| 190 // testing::Test: | 209 // testing::Test: |
| 191 void SetUp() override { | 210 void SetUp() override { |
| 192 connection_manager_.reset(new ConnectionManager( | 211 connection_manager_.reset(new ConnectionManager( |
| 193 &delegate_, scoped_ptr<DisplayManager>(new TestDisplayManager), | 212 &delegate_, scoped_ptr<DisplayManager>(new TestDisplayManager), |
| 194 &wm_internal_)); | 213 &wm_internal_)); |
| 195 | |
| 196 scoped_ptr<ViewManagerServiceImpl> service(new ViewManagerServiceImpl( | 214 scoped_ptr<ViewManagerServiceImpl> service(new ViewManagerServiceImpl( |
| 197 connection_manager_.get(), kInvalidConnectionId, std::string(), | 215 connection_manager_.get(), kInvalidConnectionId, std::string(), |
| 198 std::string("mojo:window_manager"), RootViewId())); | 216 std::string("mojo:window_manager"), RootViewId())); |
| 199 scoped_ptr<TestClientConnection> client_connection( | 217 scoped_ptr<TestClientConnection> client_connection( |
| 200 new TestClientConnection(service.Pass())); | 218 new TestClientConnection(service.Pass())); |
| 201 wm_client_ = client_connection->client(); | 219 wm_client_ = client_connection->client(); |
| 220 ASSERT_TRUE(wm_client_ != nullptr); | |
| 202 connection_manager_->SetWindowManagerClientConnection( | 221 connection_manager_->SetWindowManagerClientConnection( |
| 203 client_connection.Pass()); | 222 client_connection.Pass()); |
| 204 } | 223 ASSERT_TRUE(wm_connection() != nullptr); |
| 205 | 224 ASSERT_TRUE(wm_connection()->root() != nullptr); |
| 206 // ViewManagerServiceImpl for the window manager. | 225 } |
| 207 ViewManagerServiceImpl* wm_connection() { | 226 |
| 208 return connection_manager_->GetConnection(1); | 227 private: |
| 209 } | |
| 210 | |
| 211 // TestViewManagerClient that is used for the WM connection. | 228 // TestViewManagerClient that is used for the WM connection. |
| 212 TestViewManagerClient* wm_client_; | 229 TestViewManagerClient* wm_client_; |
| 213 | 230 |
| 214 private: | |
| 215 TestWindowManagerInternal wm_internal_; | 231 TestWindowManagerInternal wm_internal_; |
| 216 TestConnectionManagerDelegate delegate_; | 232 TestConnectionManagerDelegate delegate_; |
| 217 scoped_ptr<ConnectionManager> connection_manager_; | 233 scoped_ptr<ConnectionManager> connection_manager_; |
| 234 base::MessageLoop message_loop_; | |
| 218 | 235 |
| 219 DISALLOW_COPY_AND_ASSIGN(ViewManagerServiceTest); | 236 DISALLOW_COPY_AND_ASSIGN(ViewManagerServiceTest); |
| 220 }; | 237 }; |
| 221 | 238 |
| 222 TEST_F(ViewManagerServiceTest, Basic) { | 239 const ServerView* GetFirstCloned(const ServerView* view) { |
|
msw
2014/11/18 23:37:43
nit: move to anon namespace above?
sky
2014/11/19 00:49:40
I placed it here to reinforce it's for the clone t
msw
2014/11/19 01:27:51
Acknowledged.
| |
| 223 wm_connection()->CreateView(ViewId(wm_connection()->id(), 1)); | 240 for (const ServerView* child : view->GetChildren()) { |
| 224 ASSERT_EQ(1u, wm_client_->tracker()->changes()->size()); | 241 if (child->id() == ClonedViewId()) |
| 242 return child; | |
| 243 } | |
| 244 return nullptr; | |
| 245 } | |
| 246 | |
| 247 // Provides common setup for animation tests. Creates the following views: | |
| 248 // 0,1 (the root, provided by view manager) | |
| 249 // 1,1 | |
|
msw
2014/11/18 23:37:43
nit: annotate this view (this comment block is gre
sky
2014/11/19 00:49:40
Done.
| |
| 250 // 2,1 bounds=1,2 11x22 | |
| 251 // 2,2 bounds=2,3 6x7 | |
| 252 // 2,3 bounds=3,4 6x7 | |
| 253 // CloneAndAnimate() is invoked for 2,2. | |
| 254 void SetUpAnimate1(ViewManagerServiceTest* test, ViewId* embed_view_id) { | |
|
msw
2014/11/18 23:37:43
ditto nit: move to anon namespace above? (nix '1'
sky
2014/11/19 00:49:40
Same comment about wanting to keep it close to ani
| |
| 255 *embed_view_id = ViewId(test->wm_connection()->id(), 1); | |
| 256 EXPECT_EQ(ERROR_CODE_NONE, test->wm_connection()->CreateView(*embed_view_id)); | |
| 257 EXPECT_TRUE(test->wm_connection()->AddView(*(test->wm_connection()->root()), | |
| 258 *embed_view_id)); | |
| 259 EXPECT_TRUE(test->wm_connection()->Embed( | |
| 260 std::string(), *embed_view_id, InterfaceRequest<ServiceProvider>())); | |
|
msw
2014/11/18 23:37:43
For my clarity, is this embedding a connection wit
sky
2014/11/19 00:49:40
Depends upon what you mean by nothing on the other
msw
2014/11/19 01:27:51
Acknowledged.
| |
| 261 ViewManagerServiceImpl* connection1 = | |
| 262 test->connection_manager()->GetConnectionWithRoot(*embed_view_id); | |
|
msw
2014/11/18 23:37:43
Harking back to my confusion about view manager co
sky
2014/11/19 00:49:40
And my overloading of 'connection'. I made it wors
| |
| 263 ASSERT_TRUE(connection1 != nullptr); | |
| 264 ASSERT_NE(connection1, test->wm_connection()); | |
| 265 | |
| 266 const ViewId child1(connection1->id(), 1); | |
| 267 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child1)); | |
| 268 const ViewId child2(connection1->id(), 2); | |
| 269 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child2)); | |
| 270 const ViewId child3(connection1->id(), 3); | |
| 271 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child3)); | |
| 272 | |
| 273 ServerView* v1 = connection1->GetView(child1); | |
| 274 v1->SetBounds(gfx::Rect(1, 2, 11, 22)); | |
| 275 ServerView* v2 = connection1->GetView(child2); | |
| 276 v2->SetBounds(gfx::Rect(2, 3, 6, 7)); | |
| 277 ServerView* v3 = connection1->GetView(child3); | |
| 278 v3->SetBounds(gfx::Rect(3, 4, 6, 7)); | |
| 279 | |
| 280 EXPECT_TRUE(connection1->AddView(*embed_view_id, child1)); | |
| 281 EXPECT_TRUE(connection1->AddView(child1, child2)); | |
| 282 EXPECT_TRUE(connection1->AddView(child2, child3)); | |
| 283 | |
| 284 TestViewManagerClient* connection1_client = test->last_view_manager_client(); | |
| 285 connection1_client->tracker()->changes()->clear(); | |
| 286 test->wm_client()->tracker()->changes()->clear(); | |
| 287 EXPECT_TRUE(test->connection_manager()->CloneAndAnimate(child2)); | |
| 288 EXPECT_TRUE(connection1_client->tracker()->changes()->empty()); | |
| 289 EXPECT_TRUE(test->wm_client()->tracker()->changes()->empty()); | |
| 290 | |
| 291 // We cloned v2. The cloned view ends up as a sibling of it. | |
| 292 const ServerView* cloned_view = GetFirstCloned(connection1->GetView(child1)); | |
| 293 ASSERT_TRUE(cloned_view); | |
| 294 // |cloned_view| should have one and only one cloned child (corresponds to | |
| 295 // |child3|). | |
| 296 ASSERT_EQ(1u, cloned_view->GetChildren().size()); | |
| 297 EXPECT_TRUE(cloned_view->GetChildren()[0]->id() == ClonedViewId()); | |
| 298 | |
| 299 // Cloned views should match the bounds of the view they were cloned from. | |
| 300 EXPECT_EQ(gfx::Rect(2, 3, 6, 7), cloned_view->bounds()); | |
|
msw
2014/11/18 23:37:43
nit: compare to v2 and v3 bounds instead of copied
sky
2014/11/19 00:49:40
Done.
| |
| 301 EXPECT_EQ(gfx::Rect(3, 4, 6, 7), cloned_view->GetChildren()[0]->bounds()); | |
| 302 } | |
| 303 | |
| 304 TEST_F(ViewManagerServiceTest, ConnectionsCantSeeClonedViews) { | |
| 305 ViewId embed_view_id; | |
| 306 EXPECT_NO_FATAL_FAILURE(SetUpAnimate1(this, &embed_view_id)); | |
| 307 | |
| 308 ViewManagerServiceImpl* connection1 = | |
| 309 connection_manager()->GetConnectionWithRoot(embed_view_id); | |
| 310 | |
| 311 const ViewId child1(connection1->id(), 1); | |
| 312 const ViewId child2(connection1->id(), 2); | |
| 313 const ViewId child3(connection1->id(), 3); | |
| 314 | |
| 315 // Verify the root doesn't see any cloned views. | |
|
msw
2014/11/18 23:37:43
Should this check GetFirstCloned() on the results
sky
2014/11/19 00:49:40
I'm not sure I get what you're asking. SetUpAnimat
msw
2014/11/19 01:27:51
Ah, so really this is a test that *just the vector
sky
2014/11/19 03:28:17
You got it. GetViewTree is what is passed to clien
msw
2014/11/19 18:18:29
I feel like the name of the test and comments here
sky
2014/11/19 18:34:53
This isn't really interesting as cloned views aren
msw
2014/11/19 18:47:24
That, combined with my new understanding (clients
| |
| 316 std::vector<const ServerView*> views; | |
| 317 wm_connection()->GetViewTree(*wm_connection()->root(), &views); | |
| 318 ASSERT_EQ(5u, views.size()); | |
| 319 ASSERT_TRUE(views[0]->id() == *wm_connection()->root()); | |
| 320 ASSERT_TRUE(views[1]->id() == embed_view_id); | |
| 321 ASSERT_TRUE(views[2]->id() == child1); | |
| 322 ASSERT_TRUE(views[3]->id() == child2); | |
| 323 ASSERT_TRUE(views[4]->id() == child3); | |
| 324 | |
| 325 // Verify connection1 doesn't see any cloned views. | |
| 326 std::vector<const ServerView*> v1_views; | |
| 327 connection1->GetViewTree(embed_view_id, &v1_views); | |
| 328 ASSERT_EQ(4u, v1_views.size()); | |
| 329 ASSERT_TRUE(v1_views[0]->id() == embed_view_id); | |
| 330 ASSERT_TRUE(v1_views[1]->id() == child1); | |
| 331 ASSERT_TRUE(v1_views[2]->id() == child2); | |
| 332 ASSERT_TRUE(v1_views[3]->id() == child3); | |
| 333 } | |
| 334 | |
| 335 TEST_F(ViewManagerServiceTest, ClonedViewsPromotedOnConnectionClose) { | |
| 336 ViewId embed_view_id; | |
| 337 EXPECT_NO_FATAL_FAILURE(SetUpAnimate1(this, &embed_view_id)); | |
| 338 | |
| 339 // Destroy connection1, which should force the cloned view to become a child | |
| 340 // of where it was embedded (the embedded view still exists). | |
| 341 connection_manager()->OnConnectionError(last_client_connection()); | |
| 342 | |
| 343 ServerView* embed_view = wm_connection()->GetView(embed_view_id); | |
| 344 ASSERT_TRUE(embed_view != nullptr); | |
| 345 const ServerView* cloned_view = GetFirstCloned(embed_view); | |
| 346 ASSERT_TRUE(cloned_view); | |
| 347 ASSERT_EQ(1u, cloned_view->GetChildren().size()); | |
| 348 EXPECT_TRUE(cloned_view->GetChildren()[0]->id() == ClonedViewId()); | |
| 349 | |
| 350 // Because the cloned view changed parents it's bounds should have changed. | |
|
msw
2014/11/18 23:37:43
nit: "its" without apostrophe.
sky
2014/11/19 00:49:40
Done.
| |
| 351 EXPECT_EQ(gfx::Rect(3, 5, 6, 7), cloned_view->bounds()); | |
| 352 // The bounds of the cloned child should not have changed though. | |
| 353 EXPECT_EQ(gfx::Rect(3, 4, 6, 7), cloned_view->GetChildren()[0]->bounds()); | |
| 354 } | |
| 355 | |
| 356 TEST_F(ViewManagerServiceTest, ClonedViewsPromotedOnHide) { | |
| 357 ViewId embed_view_id; | |
| 358 EXPECT_NO_FATAL_FAILURE(SetUpAnimate1(this, &embed_view_id)); | |
| 359 | |
| 360 ViewManagerServiceImpl* connection1 = | |
| 361 connection_manager()->GetConnectionWithRoot(embed_view_id); | |
| 362 | |
| 363 // Hide the parent of the cloned view, should force the cloned view to become | |
|
msw
2014/11/18 23:37:43
nit: view, which should
sky
2014/11/19 00:49:40
Done.
| |
| 364 // a sibling of the parent. | |
| 365 const ServerView* view_to_hide = | |
| 366 connection1->GetView(ViewId(connection1->id(), 1)); | |
| 367 ASSERT_TRUE(connection1->SetViewVisibility(view_to_hide->id(), false)); | |
| 368 | |
| 369 const ServerView* cloned_view = GetFirstCloned(view_to_hide->parent()); | |
| 370 ASSERT_TRUE(cloned_view); | |
| 371 ASSERT_EQ(1u, cloned_view->GetChildren().size()); | |
| 372 EXPECT_TRUE(cloned_view->GetChildren()[0]->id() == ClonedViewId()); | |
| 373 EXPECT_EQ(2u, cloned_view->parent()->GetChildren().size()); | |
| 374 EXPECT_TRUE(cloned_view->parent()->GetChildren()[1] == cloned_view); | |
| 375 } | |
| 376 | |
| 377 // Clone and animate on tree with more depth. Basicly that of SetUpAnimate1() | |
|
msw
2014/11/18 23:37:43
nit: "a tree", also "Basically"
sky
2014/11/19 00:49:40
Done.
| |
| 378 // but cloning 2,1. | |
| 379 TEST_F(ViewManagerServiceTest, CloneAndAnimateLargerDepth) { | |
| 380 const ViewId embed_view_id(wm_connection()->id(), 1); | |
|
msw
2014/11/18 23:37:43
nit: Should SetUpAnimate1 be split into two steps?
sky
2014/11/19 00:49:40
I kind of like it this way, but I of course may ch
msw
2014/11/19 01:27:51
Acknowledged.
| |
| 381 EXPECT_EQ(ERROR_CODE_NONE, wm_connection()->CreateView(embed_view_id)); | |
| 382 EXPECT_TRUE( | |
| 383 wm_connection()->AddView(*(wm_connection()->root()), embed_view_id)); | |
| 384 EXPECT_TRUE(wm_connection()->Embed(std::string(), embed_view_id, | |
| 385 InterfaceRequest<ServiceProvider>())); | |
| 386 ViewManagerServiceImpl* connection1 = | |
| 387 connection_manager()->GetConnectionWithRoot(embed_view_id); | |
| 388 ASSERT_TRUE(connection1 != nullptr); | |
| 389 ASSERT_NE(connection1, wm_connection()); | |
| 390 | |
| 391 const ViewId child1(connection1->id(), 1); | |
| 392 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child1)); | |
| 393 const ViewId child2(connection1->id(), 2); | |
| 394 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child2)); | |
| 395 const ViewId child3(connection1->id(), 3); | |
| 396 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child3)); | |
| 397 | |
| 398 ServerView* v1 = connection1->GetView(child1); | |
| 399 | |
| 400 EXPECT_TRUE(connection1->AddView(embed_view_id, child1)); | |
| 401 EXPECT_TRUE(connection1->AddView(child1, child2)); | |
| 402 EXPECT_TRUE(connection1->AddView(child2, child3)); | |
| 403 | |
| 404 TestViewManagerClient* connection1_client = last_view_manager_client(); | |
| 405 connection1_client->tracker()->changes()->clear(); | |
| 406 wm_client()->tracker()->changes()->clear(); | |
| 407 EXPECT_TRUE(connection_manager()->CloneAndAnimate(child1)); | |
| 408 EXPECT_TRUE(connection1_client->tracker()->changes()->empty()); | |
| 409 EXPECT_TRUE(wm_client()->tracker()->changes()->empty()); | |
| 410 | |
| 411 // We cloned v1. The cloned view ends up as a sibling of it. | |
| 412 const ServerView* cloned_view = GetFirstCloned(v1->parent()); | |
| 413 ASSERT_TRUE(cloned_view); | |
| 414 // |cloned_view| should have a child and it's child should have a child. | |
|
msw
2014/11/18 23:37:43
nit: "its" without apostrophe.
sky
2014/11/19 00:49:40
Done.
| |
| 415 ASSERT_EQ(1u, cloned_view->GetChildren().size()); | |
| 416 const ServerView* cloned_view_child = cloned_view->GetChildren()[0]; | |
| 417 EXPECT_EQ(1u, cloned_view_child->GetChildren().size()); | |
|
msw
2014/11/18 23:37:43
nit: ensure the cloned_view_child has ClonedViewId
sky
2014/11/19 00:49:40
Done.
| |
| 225 } | 418 } |
| 226 | 419 |
| 227 } // namespace service | 420 } // namespace service |
| 228 } // namespace mojo | 421 } // namespace mojo |
| OLD | NEW |