| 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 "mojo/services/view_manager/public/cpp/view_manager.h" | 5 #include "mojo/services/view_manager/public/cpp/view_manager.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "mojo/application_manager/application_manager.h" | 10 #include "mojo/application_manager/application_manager.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 void QuitRunLoop() { | 42 void QuitRunLoop() { |
| 43 current_run_loop->Quit(); | 43 current_run_loop->Quit(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 class ConnectApplicationLoader : public ApplicationLoader, | 46 class ConnectApplicationLoader : public ApplicationLoader, |
| 47 public ApplicationDelegate, | 47 public ApplicationDelegate, |
| 48 public ViewManagerDelegate { | 48 public ViewManagerDelegate { |
| 49 public: | 49 public: |
| 50 typedef base::Callback<void(ViewManager*, View*)> LoadedCallback; | 50 typedef base::Callback<void(View*)> LoadedCallback; |
| 51 | 51 |
| 52 explicit ConnectApplicationLoader(const LoadedCallback& callback) | 52 explicit ConnectApplicationLoader(const LoadedCallback& callback) |
| 53 : callback_(callback) {} | 53 : callback_(callback) {} |
| 54 ~ConnectApplicationLoader() override {} | 54 ~ConnectApplicationLoader() override {} |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 // Overridden from ApplicationDelegate: | 57 // Overridden from ApplicationDelegate: |
| 58 void Initialize(ApplicationImpl* app) override { | 58 void Initialize(ApplicationImpl* app) override { |
| 59 view_manager_client_factory_.reset( | 59 view_manager_client_factory_.reset( |
| 60 new ViewManagerClientFactory(app->shell(), this)); | 60 new ViewManagerClientFactory(app->shell(), this)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 73 | 73 |
| 74 void OnApplicationError(ApplicationManager* manager, | 74 void OnApplicationError(ApplicationManager* manager, |
| 75 const GURL& url) override {} | 75 const GURL& url) override {} |
| 76 | 76 |
| 77 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { | 77 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { |
| 78 connection->AddService(view_manager_client_factory_.get()); | 78 connection->AddService(view_manager_client_factory_.get()); |
| 79 return true; | 79 return true; |
| 80 } | 80 } |
| 81 | 81 |
| 82 // Overridden from ViewManagerDelegate: | 82 // Overridden from ViewManagerDelegate: |
| 83 void OnEmbed(ViewManager* view_manager, | 83 void OnEmbed(View* root, |
| 84 View* root, | |
| 85 ServiceProviderImpl* exported_services, | 84 ServiceProviderImpl* exported_services, |
| 86 scoped_ptr<ServiceProvider> imported_services) override { | 85 scoped_ptr<ServiceProvider> imported_services) override { |
| 87 callback_.Run(view_manager, root); | 86 callback_.Run(root); |
| 88 } | 87 } |
| 89 void OnViewManagerDisconnected(ViewManager* view_manager) override {} | 88 void OnViewManagerDisconnected(ViewManager* view_manager) override {} |
| 90 | 89 |
| 91 ScopedVector<ApplicationImpl> apps_; | 90 ScopedVector<ApplicationImpl> apps_; |
| 92 LoadedCallback callback_; | 91 LoadedCallback callback_; |
| 93 scoped_ptr<ViewManagerClientFactory> view_manager_client_factory_; | 92 scoped_ptr<ViewManagerClientFactory> view_manager_client_factory_; |
| 94 | 93 |
| 95 DISALLOW_COPY_AND_ASSIGN(ConnectApplicationLoader); | 94 DISALLOW_COPY_AND_ASSIGN(ConnectApplicationLoader); |
| 96 }; | 95 }; |
| 97 | 96 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 ViewManagerTest() | 266 ViewManagerTest() |
| 268 : connect_loop_(NULL), | 267 : connect_loop_(NULL), |
| 269 loaded_view_manager_(NULL), | 268 loaded_view_manager_(NULL), |
| 270 window_manager_(NULL), | 269 window_manager_(NULL), |
| 271 commit_count_(0) {} | 270 commit_count_(0) {} |
| 272 | 271 |
| 273 protected: | 272 protected: |
| 274 ViewManager* window_manager() { return window_manager_; } | 273 ViewManager* window_manager() { return window_manager_; } |
| 275 | 274 |
| 276 View* CreateViewInParent(View* parent) { | 275 View* CreateViewInParent(View* parent) { |
| 277 ViewManager* parent_manager = ViewPrivate(parent).view_manager(); | 276 ViewManager* parent_manager = parent->view_manager(); |
| 278 View* view = View::Create(parent_manager); | 277 View* view = parent_manager->CreateView(); |
| 279 view->SetVisible(true); | 278 view->SetVisible(true); |
| 280 parent->AddChild(view); | 279 parent->AddChild(view); |
| 281 return view; | 280 return view; |
| 282 } | 281 } |
| 283 | 282 |
| 284 // Embeds another version of the test app @ view. | 283 // Embeds another version of the test app @ view. |
| 285 ViewManager* Embed(ViewManager* view_manager, View* view) { | 284 ViewManager* Embed(ViewManager* view_manager, View* view) { |
| 286 DCHECK_EQ(view_manager, ViewPrivate(view).view_manager()); | 285 DCHECK_EQ(view_manager, view->view_manager()); |
| 287 view->Embed(kEmbeddedApp1URL); | 286 view->Embed(kEmbeddedApp1URL); |
| 288 RunRunLoop(); | 287 RunRunLoop(); |
| 289 return GetLoadedViewManager(); | 288 return GetLoadedViewManager(); |
| 290 } | 289 } |
| 291 | 290 |
| 292 ViewManager* GetLoadedViewManager() { | 291 ViewManager* GetLoadedViewManager() { |
| 293 ViewManager* view_manager = loaded_view_manager_; | 292 ViewManager* view_manager = loaded_view_manager_; |
| 294 loaded_view_manager_ = NULL; | 293 loaded_view_manager_ = NULL; |
| 295 return view_manager; | 294 return view_manager; |
| 296 } | 295 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 310 new ConnectApplicationLoader(ready_callback)), | 309 new ConnectApplicationLoader(ready_callback)), |
| 311 GURL(kWindowManagerURL)); | 310 GURL(kWindowManagerURL)); |
| 312 test_helper_.SetLoaderForURL( | 311 test_helper_.SetLoaderForURL( |
| 313 scoped_ptr<ApplicationLoader>( | 312 scoped_ptr<ApplicationLoader>( |
| 314 new ConnectApplicationLoader(ready_callback)), | 313 new ConnectApplicationLoader(ready_callback)), |
| 315 GURL(kEmbeddedApp1URL)); | 314 GURL(kEmbeddedApp1URL)); |
| 316 | 315 |
| 317 // TODO(sky): resolve this. Need to establish initial connection. | 316 // TODO(sky): resolve this. Need to establish initial connection. |
| 318 } | 317 } |
| 319 | 318 |
| 320 void OnViewManagerLoaded(ViewManager* view_manager, View* root) { | 319 void OnViewManagerLoaded(View* root) { |
| 321 loaded_view_manager_ = view_manager; | 320 loaded_view_manager_ = root->view_manager(); |
| 322 connect_loop_->Quit(); | 321 connect_loop_->Quit(); |
| 323 } | 322 } |
| 324 | 323 |
| 325 void RunRunLoop() { | 324 void RunRunLoop() { |
| 326 base::RunLoop run_loop; | 325 base::RunLoop run_loop; |
| 327 connect_loop_ = &run_loop; | 326 connect_loop_ = &run_loop; |
| 328 connect_loop_->Run(); | 327 connect_loop_->Run(); |
| 329 connect_loop_ = NULL; | 328 connect_loop_ = NULL; |
| 330 } | 329 } |
| 331 | 330 |
| 332 base::RunLoop* connect_loop_; | 331 base::RunLoop* connect_loop_; |
| 333 shell::ShellTestHelper test_helper_; | 332 shell::ShellTestHelper test_helper_; |
| 334 // Used to receive the most recent view manager loaded by an embed action. | 333 // Used to receive the most recent view manager loaded by an embed action. |
| 335 ViewManager* loaded_view_manager_; | 334 ViewManager* loaded_view_manager_; |
| 336 // The View Manager connection held by the window manager (app running at the | 335 // The View Manager connection held by the window manager (app running at the |
| 337 // root view). | 336 // root view). |
| 338 ViewManager* window_manager_; | 337 ViewManager* window_manager_; |
| 339 int commit_count_; | 338 int commit_count_; |
| 340 | 339 |
| 341 DISALLOW_COPY_AND_ASSIGN(ViewManagerTest); | 340 DISALLOW_COPY_AND_ASSIGN(ViewManagerTest); |
| 342 }; | 341 }; |
| 343 | 342 |
| 344 // TODO(sky): all of these tests are disabled as each test triggers running | 343 // TODO(sky): all of these tests are disabled as each test triggers running |
| 345 // ViewsInit, which tries to register the same set of paths with the | 344 // ViewsInit, which tries to register the same set of paths with the |
| 346 // PathService, triggering a DCHECK. | 345 // PathService, triggering a DCHECK. |
| 347 TEST_F(ViewManagerTest, DISABLED_SetUp) {} | 346 TEST_F(ViewManagerTest, DISABLED_SetUp) {} |
| 348 | 347 |
| 349 TEST_F(ViewManagerTest, DISABLED_Embed) { | 348 TEST_F(ViewManagerTest, DISABLED_Embed) { |
| 350 View* view = View::Create(window_manager()); | 349 View* view = window_manager()->CreateView(); |
| 351 view->SetVisible(true); | 350 view->SetVisible(true); |
| 352 window_manager()->GetRoot()->AddChild(view); | 351 window_manager()->GetRoot()->AddChild(view); |
| 353 ViewManager* embedded = Embed(window_manager(), view); | 352 ViewManager* embedded = Embed(window_manager(), view); |
| 354 EXPECT_TRUE(NULL != embedded); | 353 EXPECT_TRUE(NULL != embedded); |
| 355 | 354 |
| 356 View* view_in_embedded = embedded->GetRoot(); | 355 View* view_in_embedded = embedded->GetRoot(); |
| 357 EXPECT_EQ(view->parent(), window_manager()->GetRoot()); | 356 EXPECT_EQ(view->parent(), window_manager()->GetRoot()); |
| 358 EXPECT_EQ(NULL, view_in_embedded->parent()); | 357 EXPECT_EQ(NULL, view_in_embedded->parent()); |
| 359 } | 358 } |
| 360 | 359 |
| 361 // Window manager has two views, N1 and N11. Embeds A at N1. A should not see | 360 // Window manager has two views, N1 and N11. Embeds A at N1. A should not see |
| 362 // N11. | 361 // N11. |
| 363 // TODO(sky): Update client lib to match server. | 362 // TODO(sky): Update client lib to match server. |
| 364 TEST_F(ViewManagerTest, DISABLED_EmbeddedDoesntSeeChild) { | 363 TEST_F(ViewManagerTest, DISABLED_EmbeddedDoesntSeeChild) { |
| 365 View* view = View::Create(window_manager()); | 364 View* view = window_manager()->CreateView(); |
| 366 view->SetVisible(true); | 365 view->SetVisible(true); |
| 367 window_manager()->GetRoot()->AddChild(view); | 366 window_manager()->GetRoot()->AddChild(view); |
| 368 View* nested = View::Create(window_manager()); | 367 View* nested = window_manager()->CreateView(); |
| 369 nested->SetVisible(true); | 368 nested->SetVisible(true); |
| 370 view->AddChild(nested); | 369 view->AddChild(nested); |
| 371 | 370 |
| 372 ViewManager* embedded = Embed(window_manager(), view); | 371 ViewManager* embedded = Embed(window_manager(), view); |
| 373 EXPECT_EQ(embedded->GetRoot()->children().front()->id(), | 372 EXPECT_EQ(embedded->GetRoot()->children().front()->id(), |
| 374 nested->id()); | 373 nested->id()); |
| 375 EXPECT_TRUE(embedded->GetRoot()->children().empty()); | 374 EXPECT_TRUE(embedded->GetRoot()->children().empty()); |
| 376 EXPECT_TRUE(nested->parent() == NULL); | 375 EXPECT_TRUE(nested->parent() == NULL); |
| 377 } | 376 } |
| 378 | 377 |
| 379 // http://crbug.com/396300 | 378 // http://crbug.com/396300 |
| 380 TEST_F(ViewManagerTest, DISABLED_ViewManagerDestroyed_CleanupView) { | 379 TEST_F(ViewManagerTest, DISABLED_ViewManagerDestroyed_CleanupView) { |
| 381 View* view = View::Create(window_manager()); | 380 View* view = window_manager()->CreateView(); |
| 382 view->SetVisible(true); | 381 view->SetVisible(true); |
| 383 window_manager()->GetRoot()->AddChild(view); | 382 window_manager()->GetRoot()->AddChild(view); |
| 384 ViewManager* embedded = Embed(window_manager(), view); | 383 ViewManager* embedded = Embed(window_manager(), view); |
| 385 | 384 |
| 386 Id view_id = view->id(); | 385 Id view_id = view->id(); |
| 387 | 386 |
| 388 UnloadApplication(GURL(kWindowManagerURL)); | 387 UnloadApplication(GURL(kWindowManagerURL)); |
| 389 | 388 |
| 390 std::set<Id> views; | 389 std::set<Id> views; |
| 391 views.insert(view_id); | 390 views.insert(view_id); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 402 // -> the view should still exist (since the second connection is live) but | 401 // -> the view should still exist (since the second connection is live) but |
| 403 // should be disconnected from any views. | 402 // should be disconnected from any views. |
| 404 // http://crbug.com/396300 | 403 // http://crbug.com/396300 |
| 405 // | 404 // |
| 406 // TODO(beng): The new test should validate the scenario as described above | 405 // TODO(beng): The new test should validate the scenario as described above |
| 407 // except that the second connection still has a valid tree. | 406 // except that the second connection still has a valid tree. |
| 408 | 407 |
| 409 // Verifies that bounds changes applied to a view hierarchy in one connection | 408 // Verifies that bounds changes applied to a view hierarchy in one connection |
| 410 // are reflected to another. | 409 // are reflected to another. |
| 411 TEST_F(ViewManagerTest, DISABLED_SetBounds) { | 410 TEST_F(ViewManagerTest, DISABLED_SetBounds) { |
| 412 View* view = View::Create(window_manager()); | 411 View* view = window_manager()->CreateView(); |
| 413 view->SetVisible(true); | 412 view->SetVisible(true); |
| 414 window_manager()->GetRoot()->AddChild(view); | 413 window_manager()->GetRoot()->AddChild(view); |
| 415 ViewManager* embedded = Embed(window_manager(), view); | 414 ViewManager* embedded = Embed(window_manager(), view); |
| 416 | 415 |
| 417 View* view_in_embedded = embedded->GetViewById(view->id()); | 416 View* view_in_embedded = embedded->GetViewById(view->id()); |
| 418 EXPECT_EQ(view->bounds(), view_in_embedded->bounds()); | 417 EXPECT_EQ(view->bounds(), view_in_embedded->bounds()); |
| 419 | 418 |
| 420 Rect rect; | 419 Rect rect; |
| 421 rect.width = rect.height = 100; | 420 rect.width = rect.height = 100; |
| 422 view->SetBounds(rect); | 421 view->SetBounds(rect); |
| 423 EXPECT_NE(view->bounds(), view_in_embedded->bounds()); | 422 EXPECT_NE(view->bounds(), view_in_embedded->bounds()); |
| 424 WaitForBoundsToChange(view_in_embedded); | 423 WaitForBoundsToChange(view_in_embedded); |
| 425 EXPECT_EQ(view->bounds(), view_in_embedded->bounds()); | 424 EXPECT_EQ(view->bounds(), view_in_embedded->bounds()); |
| 426 } | 425 } |
| 427 | 426 |
| 428 // Verifies that bounds changes applied to a view owned by a different | 427 // Verifies that bounds changes applied to a view owned by a different |
| 429 // connection are refused. | 428 // connection are refused. |
| 430 TEST_F(ViewManagerTest, DISABLED_SetBoundsSecurity) { | 429 TEST_F(ViewManagerTest, DISABLED_SetBoundsSecurity) { |
| 431 View* view = View::Create(window_manager()); | 430 View* view = window_manager()->CreateView(); |
| 432 view->SetVisible(true); | 431 view->SetVisible(true); |
| 433 window_manager()->GetRoot()->AddChild(view); | 432 window_manager()->GetRoot()->AddChild(view); |
| 434 ViewManager* embedded = Embed(window_manager(), view); | 433 ViewManager* embedded = Embed(window_manager(), view); |
| 435 | 434 |
| 436 View* view_in_embedded = embedded->GetViewById(view->id()); | 435 View* view_in_embedded = embedded->GetViewById(view->id()); |
| 437 Rect rect; | 436 Rect rect; |
| 438 rect.width = 800; | 437 rect.width = 800; |
| 439 rect.height = 600; | 438 rect.height = 600; |
| 440 view->SetBounds(rect); | 439 view->SetBounds(rect); |
| 441 WaitForBoundsToChange(view_in_embedded); | 440 WaitForBoundsToChange(view_in_embedded); |
| 442 | 441 |
| 443 rect.width = 1024; | 442 rect.width = 1024; |
| 444 rect.height = 768; | 443 rect.height = 768; |
| 445 view_in_embedded->SetBounds(rect); | 444 view_in_embedded->SetBounds(rect); |
| 446 // Bounds change should have been rejected. | 445 // Bounds change should have been rejected. |
| 447 EXPECT_EQ(view->bounds(), view_in_embedded->bounds()); | 446 EXPECT_EQ(view->bounds(), view_in_embedded->bounds()); |
| 448 } | 447 } |
| 449 | 448 |
| 450 // Verifies that a view can only be destroyed by the connection that created it. | 449 // Verifies that a view can only be destroyed by the connection that created it. |
| 451 TEST_F(ViewManagerTest, DISABLED_DestroySecurity) { | 450 TEST_F(ViewManagerTest, DISABLED_DestroySecurity) { |
| 452 View* view = View::Create(window_manager()); | 451 View* view = window_manager()->CreateView(); |
| 453 view->SetVisible(true); | 452 view->SetVisible(true); |
| 454 window_manager()->GetRoot()->AddChild(view); | 453 window_manager()->GetRoot()->AddChild(view); |
| 455 ViewManager* embedded = Embed(window_manager(), view); | 454 ViewManager* embedded = Embed(window_manager(), view); |
| 456 | 455 |
| 457 View* view_in_embedded = embedded->GetViewById(view->id()); | 456 View* view_in_embedded = embedded->GetViewById(view->id()); |
| 458 | 457 |
| 459 ViewTracker tracker2(view_in_embedded); | 458 ViewTracker tracker2(view_in_embedded); |
| 460 view_in_embedded->Destroy(); | 459 view_in_embedded->Destroy(); |
| 461 // View should not have been destroyed. | 460 // View should not have been destroyed. |
| 462 EXPECT_TRUE(tracker2.is_valid()); | 461 EXPECT_TRUE(tracker2.is_valid()); |
| 463 | 462 |
| 464 ViewTracker tracker1(view); | 463 ViewTracker tracker1(view); |
| 465 view->Destroy(); | 464 view->Destroy(); |
| 466 EXPECT_FALSE(tracker1.is_valid()); | 465 EXPECT_FALSE(tracker1.is_valid()); |
| 467 } | 466 } |
| 468 | 467 |
| 469 TEST_F(ViewManagerTest, DISABLED_MultiRoots) { | 468 TEST_F(ViewManagerTest, DISABLED_MultiRoots) { |
| 470 View* view1 = View::Create(window_manager()); | 469 View* view1 = window_manager()->CreateView(); |
| 471 view1->SetVisible(true); | 470 view1->SetVisible(true); |
| 472 window_manager()->GetRoot()->AddChild(view1); | 471 window_manager()->GetRoot()->AddChild(view1); |
| 473 View* view2 = View::Create(window_manager()); | 472 View* view2 = window_manager()->CreateView(); |
| 474 view2->SetVisible(true); | 473 view2->SetVisible(true); |
| 475 window_manager()->GetRoot()->AddChild(view2); | 474 window_manager()->GetRoot()->AddChild(view2); |
| 476 ViewManager* embedded1 = Embed(window_manager(), view1); | 475 ViewManager* embedded1 = Embed(window_manager(), view1); |
| 477 ViewManager* embedded2 = Embed(window_manager(), view2); | 476 ViewManager* embedded2 = Embed(window_manager(), view2); |
| 478 EXPECT_EQ(embedded1, embedded2); | 477 EXPECT_EQ(embedded1, embedded2); |
| 479 } | 478 } |
| 480 | 479 |
| 481 TEST_F(ViewManagerTest, DISABLED_EmbeddingIdentity) { | 480 TEST_F(ViewManagerTest, DISABLED_EmbeddingIdentity) { |
| 482 View* view = View::Create(window_manager()); | 481 View* view = window_manager()->CreateView(); |
| 483 view->SetVisible(true); | 482 view->SetVisible(true); |
| 484 window_manager()->GetRoot()->AddChild(view); | 483 window_manager()->GetRoot()->AddChild(view); |
| 485 ViewManager* embedded = Embed(window_manager(), view); | 484 ViewManager* embedded = Embed(window_manager(), view); |
| 486 EXPECT_EQ(kWindowManagerURL, embedded->GetEmbedderURL()); | 485 EXPECT_EQ(kWindowManagerURL, embedded->GetEmbedderURL()); |
| 487 } | 486 } |
| 488 | 487 |
| 489 TEST_F(ViewManagerTest, DISABLED_Reorder) { | 488 TEST_F(ViewManagerTest, DISABLED_Reorder) { |
| 490 View* view1 = View::Create(window_manager()); | 489 View* view1 = window_manager()->CreateView(); |
| 491 view1->SetVisible(true); | 490 view1->SetVisible(true); |
| 492 window_manager()->GetRoot()->AddChild(view1); | 491 window_manager()->GetRoot()->AddChild(view1); |
| 493 | 492 |
| 494 ViewManager* embedded = Embed(window_manager(), view1); | 493 ViewManager* embedded = Embed(window_manager(), view1); |
| 495 | 494 |
| 496 View* view11 = View::Create(embedded); | 495 View* view11 = embedded->CreateView(); |
| 497 view11->SetVisible(true); | 496 view11->SetVisible(true); |
| 498 embedded->GetRoot()->AddChild(view11); | 497 embedded->GetRoot()->AddChild(view11); |
| 499 View* view12 = View::Create(embedded); | 498 View* view12 = embedded->CreateView(); |
| 500 view12->SetVisible(true); | 499 view12->SetVisible(true); |
| 501 embedded->GetRoot()->AddChild(view12); | 500 embedded->GetRoot()->AddChild(view12); |
| 502 | 501 |
| 503 View* view1_in_wm = window_manager()->GetViewById(view1->id()); | 502 View* view1_in_wm = window_manager()->GetViewById(view1->id()); |
| 504 | 503 |
| 505 { | 504 { |
| 506 WaitForTreeSizeToMatch(view1, 2u); | 505 WaitForTreeSizeToMatch(view1, 2u); |
| 507 view11->MoveToFront(); | 506 view11->MoveToFront(); |
| 508 WaitForOrderChange(window_manager(), | 507 WaitForOrderChange(window_manager(), |
| 509 window_manager()->GetViewById(view11->id())); | 508 window_manager()->GetViewById(view11->id())); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 } | 542 } |
| 544 | 543 |
| 545 View* view_; | 544 View* view_; |
| 546 | 545 |
| 547 DISALLOW_COPY_AND_ASSIGN(VisibilityChangeObserver); | 546 DISALLOW_COPY_AND_ASSIGN(VisibilityChangeObserver); |
| 548 }; | 547 }; |
| 549 | 548 |
| 550 } // namespace | 549 } // namespace |
| 551 | 550 |
| 552 TEST_F(ViewManagerTest, DISABLED_Visible) { | 551 TEST_F(ViewManagerTest, DISABLED_Visible) { |
| 553 View* view1 = View::Create(window_manager()); | 552 View* view1 = window_manager()->CreateView(); |
| 554 view1->SetVisible(true); | 553 view1->SetVisible(true); |
| 555 window_manager()->GetRoot()->AddChild(view1); | 554 window_manager()->GetRoot()->AddChild(view1); |
| 556 | 555 |
| 557 // Embed another app and verify initial state. | 556 // Embed another app and verify initial state. |
| 558 ViewManager* embedded = Embed(window_manager(), view1); | 557 ViewManager* embedded = Embed(window_manager(), view1); |
| 559 ASSERT_NE(nullptr, embedded->GetRoot()); | 558 ASSERT_NE(nullptr, embedded->GetRoot()); |
| 560 View* embedded_root = embedded->GetRoot(); | 559 View* embedded_root = embedded->GetRoot(); |
| 561 EXPECT_TRUE(embedded_root->visible()); | 560 EXPECT_TRUE(embedded_root->visible()); |
| 562 EXPECT_TRUE(embedded_root->IsDrawn()); | 561 EXPECT_TRUE(embedded_root->IsDrawn()); |
| 563 | 562 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 } | 605 } |
| 607 | 606 |
| 608 View* view_; | 607 View* view_; |
| 609 | 608 |
| 610 DISALLOW_COPY_AND_ASSIGN(DrawnChangeObserver); | 609 DISALLOW_COPY_AND_ASSIGN(DrawnChangeObserver); |
| 611 }; | 610 }; |
| 612 | 611 |
| 613 } // namespace | 612 } // namespace |
| 614 | 613 |
| 615 TEST_F(ViewManagerTest, DISABLED_Drawn) { | 614 TEST_F(ViewManagerTest, DISABLED_Drawn) { |
| 616 View* view1 = View::Create(window_manager()); | 615 View* view1 = window_manager()->CreateView(); |
| 617 view1->SetVisible(true); | 616 view1->SetVisible(true); |
| 618 window_manager()->GetRoot()->AddChild(view1); | 617 window_manager()->GetRoot()->AddChild(view1); |
| 619 | 618 |
| 620 // Embed another app and verify initial state. | 619 // Embed another app and verify initial state. |
| 621 ViewManager* embedded = Embed(window_manager(), view1); | 620 ViewManager* embedded = Embed(window_manager(), view1); |
| 622 ASSERT_NE(nullptr, embedded->GetRoot()); | 621 ASSERT_NE(nullptr, embedded->GetRoot()); |
| 623 View* embedded_root = embedded->GetRoot(); | 622 View* embedded_root = embedded->GetRoot(); |
| 624 EXPECT_TRUE(embedded_root->visible()); | 623 EXPECT_TRUE(embedded_root->visible()); |
| 625 EXPECT_TRUE(embedded_root->IsDrawn()); | 624 EXPECT_TRUE(embedded_root->IsDrawn()); |
| 626 | 625 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 644 | 643 |
| 645 // TODO(beng): tests for focus: | 644 // TODO(beng): tests for focus: |
| 646 // - focus between two views known to a connection | 645 // - focus between two views known to a connection |
| 647 // - focus between views unknown to one of the connections. | 646 // - focus between views unknown to one of the connections. |
| 648 // - focus between views unknown to either connection. | 647 // - focus between views unknown to either connection. |
| 649 | 648 |
| 650 // TODO(sky): need test of root being destroyed with existing views. See | 649 // TODO(sky): need test of root being destroyed with existing views. See |
| 651 // 434555 for specific case. | 650 // 434555 for specific case. |
| 652 | 651 |
| 653 } // namespace mojo | 652 } // namespace mojo |
| OLD | NEW |