| 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 "base/message_loop/message_loop.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" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 mojo::InterfaceRequest<mojo::ViewManagerService> service_request, | 145 mojo::InterfaceRequest<mojo::ViewManagerService> service_request, |
| 146 mojo::ConnectionSpecificId creator_id, | 146 mojo::ConnectionSpecificId creator_id, |
| 147 const std::string& creator_url, | 147 const std::string& creator_url, |
| 148 const std::string& url, | 148 const std::string& url, |
| 149 const ViewId& root_id) override { | 149 const ViewId& root_id) override { |
| 150 scoped_ptr<ViewManagerServiceImpl> service(new ViewManagerServiceImpl( | 150 scoped_ptr<ViewManagerServiceImpl> service(new ViewManagerServiceImpl( |
| 151 connection_manager, creator_id, creator_url, url, root_id)); | 151 connection_manager, creator_id, creator_url, url, root_id)); |
| 152 last_connection_ = new TestClientConnection(service.Pass()); | 152 last_connection_ = new TestClientConnection(service.Pass()); |
| 153 return last_connection_; | 153 return last_connection_; |
| 154 } | 154 } |
| 155 ClientConnection* CreateClientConnectionForEmbedAtView( |
| 156 ConnectionManager* connection_manager, |
| 157 mojo::InterfaceRequest<mojo::ViewManagerService> service_request, |
| 158 mojo::ConnectionSpecificId creator_id, |
| 159 const std::string& creator_url, |
| 160 const ViewId& root_id, |
| 161 mojo::ViewManagerClientPtr client) override { |
| 162 NOTIMPLEMENTED(); |
| 163 return nullptr; |
| 164 } |
| 155 | 165 |
| 156 TestClientConnection* last_connection_; | 166 TestClientConnection* last_connection_; |
| 157 | 167 |
| 158 DISALLOW_COPY_AND_ASSIGN(TestConnectionManagerDelegate); | 168 DISALLOW_COPY_AND_ASSIGN(TestConnectionManagerDelegate); |
| 159 }; | 169 }; |
| 160 | 170 |
| 161 // ----------------------------------------------------------------------------- | 171 // ----------------------------------------------------------------------------- |
| 162 | 172 |
| 163 // Empty implementation of DisplayManager. | 173 // Empty implementation of DisplayManager. |
| 164 class TestDisplayManager : public DisplayManager { | 174 class TestDisplayManager : public DisplayManager { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 // 2,1 bounds=1,2 11x22 | 282 // 2,1 bounds=1,2 11x22 |
| 273 // 2,2 bounds=2,3 6x7 | 283 // 2,2 bounds=2,3 6x7 |
| 274 // 2,3 bounds=3,4 6x7 | 284 // 2,3 bounds=3,4 6x7 |
| 275 // CloneAndAnimate() is invoked for 2,2. | 285 // CloneAndAnimate() is invoked for 2,2. |
| 276 void SetUpAnimate1(ViewManagerServiceTest* test, ViewId* embed_view_id) { | 286 void SetUpAnimate1(ViewManagerServiceTest* test, ViewId* embed_view_id) { |
| 277 *embed_view_id = ViewId(test->wm_connection()->id(), 1); | 287 *embed_view_id = ViewId(test->wm_connection()->id(), 1); |
| 278 EXPECT_EQ(ERROR_CODE_NONE, test->wm_connection()->CreateView(*embed_view_id)); | 288 EXPECT_EQ(ERROR_CODE_NONE, test->wm_connection()->CreateView(*embed_view_id)); |
| 279 EXPECT_TRUE(test->wm_connection()->SetViewVisibility(*embed_view_id, true)); | 289 EXPECT_TRUE(test->wm_connection()->SetViewVisibility(*embed_view_id, true)); |
| 280 EXPECT_TRUE(test->wm_connection()->AddView(*(test->wm_connection()->root()), | 290 EXPECT_TRUE(test->wm_connection()->AddView(*(test->wm_connection()->root()), |
| 281 *embed_view_id)); | 291 *embed_view_id)); |
| 282 test->wm_connection()->Embed(std::string(), *embed_view_id, nullptr, nullptr); | 292 test->wm_connection()->EmbedUrl(std::string(), *embed_view_id, nullptr, |
| 293 nullptr); |
| 283 ViewManagerServiceImpl* connection1 = | 294 ViewManagerServiceImpl* connection1 = |
| 284 test->connection_manager()->GetConnectionWithRoot(*embed_view_id); | 295 test->connection_manager()->GetConnectionWithRoot(*embed_view_id); |
| 285 ASSERT_TRUE(connection1 != nullptr); | 296 ASSERT_TRUE(connection1 != nullptr); |
| 286 ASSERT_NE(connection1, test->wm_connection()); | 297 ASSERT_NE(connection1, test->wm_connection()); |
| 287 | 298 |
| 288 const ViewId child1(connection1->id(), 1); | 299 const ViewId child1(connection1->id(), 1); |
| 289 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child1)); | 300 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child1)); |
| 290 const ViewId child2(connection1->id(), 2); | 301 const ViewId child2(connection1->id(), 2); |
| 291 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child2)); | 302 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child2)); |
| 292 const ViewId child3(connection1->id(), 3); | 303 const ViewId child3(connection1->id(), 3); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 } | 419 } |
| 409 | 420 |
| 410 // Clone and animate on a tree with more depth. Basically that of | 421 // Clone and animate on a tree with more depth. Basically that of |
| 411 // SetUpAnimate1() but cloning 2,1. | 422 // SetUpAnimate1() but cloning 2,1. |
| 412 TEST_F(ViewManagerServiceTest, CloneAndAnimateLargerDepth) { | 423 TEST_F(ViewManagerServiceTest, CloneAndAnimateLargerDepth) { |
| 413 const ViewId embed_view_id(wm_connection()->id(), 1); | 424 const ViewId embed_view_id(wm_connection()->id(), 1); |
| 414 EXPECT_EQ(ERROR_CODE_NONE, wm_connection()->CreateView(embed_view_id)); | 425 EXPECT_EQ(ERROR_CODE_NONE, wm_connection()->CreateView(embed_view_id)); |
| 415 EXPECT_TRUE(wm_connection()->SetViewVisibility(embed_view_id, true)); | 426 EXPECT_TRUE(wm_connection()->SetViewVisibility(embed_view_id, true)); |
| 416 EXPECT_TRUE( | 427 EXPECT_TRUE( |
| 417 wm_connection()->AddView(*(wm_connection()->root()), embed_view_id)); | 428 wm_connection()->AddView(*(wm_connection()->root()), embed_view_id)); |
| 418 wm_connection()->Embed(std::string(), embed_view_id, nullptr, nullptr); | 429 wm_connection()->EmbedUrl(std::string(), embed_view_id, nullptr, nullptr); |
| 419 ViewManagerServiceImpl* connection1 = | 430 ViewManagerServiceImpl* connection1 = |
| 420 connection_manager()->GetConnectionWithRoot(embed_view_id); | 431 connection_manager()->GetConnectionWithRoot(embed_view_id); |
| 421 ASSERT_TRUE(connection1 != nullptr); | 432 ASSERT_TRUE(connection1 != nullptr); |
| 422 ASSERT_NE(connection1, wm_connection()); | 433 ASSERT_NE(connection1, wm_connection()); |
| 423 | 434 |
| 424 const ViewId child1(connection1->id(), 1); | 435 const ViewId child1(connection1->id(), 1); |
| 425 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child1)); | 436 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child1)); |
| 426 const ViewId child2(connection1->id(), 2); | 437 const ViewId child2(connection1->id(), 2); |
| 427 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child2)); | 438 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child2)); |
| 428 const ViewId child3(connection1->id(), 3); | 439 const ViewId child3(connection1->id(), 3); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 448 const ServerView* cloned_view = GetFirstCloned(v1->parent()); | 459 const ServerView* cloned_view = GetFirstCloned(v1->parent()); |
| 449 ASSERT_TRUE(cloned_view); | 460 ASSERT_TRUE(cloned_view); |
| 450 // |cloned_view| should have a child and its child should have a child. | 461 // |cloned_view| should have a child and its child should have a child. |
| 451 ASSERT_EQ(1u, cloned_view->GetChildren().size()); | 462 ASSERT_EQ(1u, cloned_view->GetChildren().size()); |
| 452 const ServerView* cloned_view_child = cloned_view->GetChildren()[0]; | 463 const ServerView* cloned_view_child = cloned_view->GetChildren()[0]; |
| 453 EXPECT_EQ(1u, cloned_view_child->GetChildren().size()); | 464 EXPECT_EQ(1u, cloned_view_child->GetChildren().size()); |
| 454 EXPECT_TRUE(cloned_view_child->id() == ClonedViewId()); | 465 EXPECT_TRUE(cloned_view_child->id() == ClonedViewId()); |
| 455 } | 466 } |
| 456 | 467 |
| 457 } // namespace view_manager | 468 } // namespace view_manager |
| OLD | NEW |