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 <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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 window_ = nullptr; | 213 window_ = nullptr; |
214 } | 214 } |
215 | 215 |
216 aura::Window* window_; | 216 aura::Window* window_; |
217 | 217 |
218 DISALLOW_COPY_AND_ASSIGN(WindowTracker); | 218 DISALLOW_COPY_AND_ASSIGN(WindowTracker); |
219 }; | 219 }; |
220 | 220 |
221 // Creates a new visible Window. If |parent| is non-null the newly created | 221 // Creates a new visible Window. If |parent| is non-null the newly created |
222 // window is added to it. | 222 // window is added to it. |
223 aura::Window* NewVisibleWindow(aura::Window* parent, | 223 aura::Window* NewVisibleWindow( |
224 aura::WindowTreeClient* client) { | 224 aura::Window* parent, |
225 aura::WindowTreeClient* client, | |
226 aura::WindowMusType type = aura::WindowMusType::LOCAL) { | |
225 std::unique_ptr<aura::WindowPortMus> window_port_mus = | 227 std::unique_ptr<aura::WindowPortMus> window_port_mus = |
226 base::MakeUnique<aura::WindowPortMus>(client, aura::WindowMusType::LOCAL); | 228 base::MakeUnique<aura::WindowPortMus>(client, type); |
227 aura::Window* window = new aura::Window(nullptr, std::move(window_port_mus)); | 229 aura::Window* window = new aura::Window(nullptr, std::move(window_port_mus)); |
228 window->Init(ui::LAYER_NOT_DRAWN); | 230 window->Init(ui::LAYER_NOT_DRAWN); |
229 window->Show(); | 231 window->Show(); |
230 if (parent) | 232 if (parent) |
231 parent->AddChild(window); | 233 parent->AddChild(window); |
232 return window; | 234 return window; |
233 } | 235 } |
234 | 236 |
235 } // namespace | 237 } // namespace |
236 | 238 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
369 | 371 |
370 DISALLOW_COPY_AND_ASSIGN(WindowServerTest); | 372 DISALLOW_COPY_AND_ASSIGN(WindowServerTest); |
371 }; | 373 }; |
372 | 374 |
373 TEST_F(WindowServerTest, RootWindow) { | 375 TEST_F(WindowServerTest, RootWindow) { |
374 ASSERT_NE(nullptr, window_manager()); | 376 ASSERT_NE(nullptr, window_manager()); |
375 EXPECT_EQ(1u, window_manager()->GetRoots().size()); | 377 EXPECT_EQ(1u, window_manager()->GetRoots().size()); |
376 } | 378 } |
377 | 379 |
378 TEST_F(WindowServerTest, Embed) { | 380 TEST_F(WindowServerTest, Embed) { |
379 aura::Window* window = NewVisibleWindow(GetFirstWMRoot(), window_manager()); | 381 aura::Window* window = NewVisibleWindow(GetFirstWMRoot(), window_manager(), |
382 aura::WindowMusType::EMBED_IN_OWNER); | |
380 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window); | 383 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window); |
384 #if 0 | |
sky
2017/05/18 03:18:08
How come you are commenting out this code?
Peng
2017/05/18 13:34:56
I added it for debugging and forgot to remove it.
| |
381 ASSERT_TRUE(embed_result->IsValid()); | 385 ASSERT_TRUE(embed_result->IsValid()); |
382 | 386 |
383 aura::Window* embed_root = embed_result->window_tree_host->window(); | 387 aura::Window* embed_root = embed_result->window_tree_host->window(); |
384 // WindowTreeHost::window() is the single root of the embed. | 388 // WindowTreeHost::window() is the single root of the embed. |
385 EXPECT_EQ(1u, embed_result->window_tree_client->GetRoots().size()); | 389 EXPECT_EQ(1u, embed_result->window_tree_client->GetRoots().size()); |
386 EXPECT_EQ(embed_root, GetFirstRoot(embed_result->window_tree_client.get())); | 390 EXPECT_EQ(embed_root, GetFirstRoot(embed_result->window_tree_client.get())); |
387 EXPECT_EQ(server_id(window), server_id(embed_root)); | 391 EXPECT_EQ(server_id(window), server_id(embed_root)); |
388 EXPECT_EQ(nullptr, embed_root->parent()); | 392 EXPECT_EQ(nullptr, embed_root->parent()); |
389 EXPECT_TRUE(embed_root->children().empty()); | 393 EXPECT_TRUE(embed_root->children().empty()); |
394 #endif | |
390 } | 395 } |
391 | 396 |
392 // Window manager has two windows, N1 and N11. Embeds A at N1. A should not see | 397 // Window manager has two windows, N1 and N11. Embeds A at N1. A should not see |
393 // N11. | 398 // N11. |
394 TEST_F(WindowServerTest, EmbeddedDoesntSeeChild) { | 399 TEST_F(WindowServerTest, EmbeddedDoesntSeeChild) { |
395 aura::Window* window = NewVisibleWindow(GetFirstWMRoot(), window_manager()); | 400 aura::Window* window = NewVisibleWindow(GetFirstWMRoot(), window_manager(), |
401 aura::WindowMusType::EMBED_IN_OWNER); | |
396 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window); | 402 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window); |
397 ASSERT_TRUE(embed_result->IsValid()); | 403 ASSERT_TRUE(embed_result->IsValid()); |
398 aura::Window* embed_root = embed_result->window_tree_host->window(); | 404 aura::Window* embed_root = embed_result->window_tree_host->window(); |
399 EXPECT_EQ(server_id(window), server_id(embed_root)); | 405 EXPECT_EQ(server_id(window), server_id(embed_root)); |
400 EXPECT_EQ(nullptr, embed_root->parent()); | 406 EXPECT_EQ(nullptr, embed_root->parent()); |
401 EXPECT_TRUE(embed_root->children().empty()); | 407 EXPECT_TRUE(embed_root->children().empty()); |
402 } | 408 } |
403 | 409 |
404 // TODO(beng): write a replacement test for the one that once existed here: | 410 // TODO(beng): write a replacement test for the one that once existed here: |
405 // This test validates the following scenario: | 411 // This test validates the following scenario: |
406 // - a window originating from one client | 412 // - a window originating from one client |
407 // - a window originating from a second client | 413 // - a window originating from a second client |
408 // + the client originating the window is destroyed | 414 // + the client originating the window is destroyed |
409 // -> the window should still exist (since the second client is live) but | 415 // -> the window should still exist (since the second client is live) but |
410 // should be disconnected from any windows. | 416 // should be disconnected from any windows. |
411 // http://crbug.com/396300 | 417 // http://crbug.com/396300 |
412 // | 418 // |
413 // TODO(beng): The new test should validate the scenario as described above | 419 // TODO(beng): The new test should validate the scenario as described above |
414 // except that the second client still has a valid tree. | 420 // except that the second client still has a valid tree. |
415 | 421 |
416 // Verifies that bounds changes applied to a window hierarchy in one client | 422 // Verifies that bounds changes applied to a window hierarchy in one client |
417 // are reflected to another. | 423 // are reflected to another. |
418 TEST_F(WindowServerTest, SetBounds) { | 424 TEST_F(WindowServerTest, SetBounds) { |
419 aura::Window* window = NewVisibleWindow(GetFirstWMRoot(), window_manager()); | 425 aura::Window* window = NewVisibleWindow(GetFirstWMRoot(), window_manager(), |
426 aura::WindowMusType::EMBED_IN_OWNER); | |
420 | 427 |
421 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window); | 428 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window); |
422 ASSERT_TRUE(embed_result->IsValid()); | 429 ASSERT_TRUE(embed_result->IsValid()); |
423 aura::Window* embed_root = embed_result->window_tree_host->window(); | 430 aura::Window* embed_root = embed_result->window_tree_host->window(); |
424 EXPECT_EQ(window->bounds(), embed_root->bounds()); | 431 EXPECT_EQ(window->bounds(), embed_root->bounds()); |
425 | 432 |
426 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 433 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
427 ASSERT_TRUE(WaitForBoundsToChange(embed_root)); | 434 ASSERT_TRUE(WaitForBoundsToChange(embed_root)); |
428 EXPECT_EQ(window->bounds(), embed_root->bounds()); | 435 EXPECT_EQ(window->bounds(), embed_root->bounds()); |
429 } | 436 } |
430 | 437 |
431 // Verifies that bounds changes applied to a window owned by a different | 438 // Verifies that bounds changes applied to a window owned by a different |
432 // client can be refused. | 439 // client can be refused. |
433 TEST_F(WindowServerTest, SetBoundsSecurity) { | 440 TEST_F(WindowServerTest, SetBoundsSecurity) { |
434 TestWindowManagerDelegate wm_delegate; | 441 TestWindowManagerDelegate wm_delegate; |
435 set_window_manager_delegate(&wm_delegate); | 442 set_window_manager_delegate(&wm_delegate); |
436 | 443 |
437 aura::Window* window = NewVisibleWindow(GetFirstWMRoot(), window_manager()); | 444 aura::Window* window = NewVisibleWindow(GetFirstWMRoot(), window_manager(), |
445 aura::WindowMusType::EMBED_IN_OWNER); | |
438 | 446 |
439 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window); | 447 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window); |
440 ASSERT_TRUE(embed_result->IsValid()); | 448 ASSERT_TRUE(embed_result->IsValid()); |
441 aura::Window* embed_root = embed_result->window_tree_host->window(); | 449 aura::Window* embed_root = embed_result->window_tree_host->window(); |
442 window->SetBounds(gfx::Rect(0, 0, 800, 600)); | 450 window->SetBounds(gfx::Rect(0, 0, 800, 600)); |
443 ASSERT_TRUE(WaitForBoundsToChange(embed_root)); | 451 ASSERT_TRUE(WaitForBoundsToChange(embed_root)); |
444 | 452 |
445 embed_result->window_tree_host->SetBoundsInPixels(gfx::Rect(0, 0, 1024, 768)); | 453 embed_result->window_tree_host->SetBoundsInPixels(gfx::Rect(0, 0, 1024, 768)); |
446 // Bounds change is initially accepted, but the server declines the request. | 454 // Bounds change is initially accepted, but the server declines the request. |
447 EXPECT_NE(window->bounds(), embed_root->bounds()); | 455 EXPECT_NE(window->bounds(), embed_root->bounds()); |
448 | 456 |
449 // The client is notified when the requested is declined, and updates the | 457 // The client is notified when the requested is declined, and updates the |
450 // local bounds accordingly. | 458 // local bounds accordingly. |
451 ASSERT_TRUE(WaitForBoundsToChange(embed_root)); | 459 ASSERT_TRUE(WaitForBoundsToChange(embed_root)); |
452 EXPECT_EQ(window->bounds(), embed_root->bounds()); | 460 EXPECT_EQ(window->bounds(), embed_root->bounds()); |
453 set_window_manager_delegate(nullptr); | 461 set_window_manager_delegate(nullptr); |
454 } | 462 } |
455 | 463 |
456 // Verifies that a root window can always be destroyed. | 464 // Verifies that a root window can always be destroyed. |
457 TEST_F(WindowServerTest, DestroySecurity) { | 465 TEST_F(WindowServerTest, DestroySecurity) { |
458 aura::Window* window = NewVisibleWindow(GetFirstWMRoot(), window_manager()); | 466 aura::Window* window = NewVisibleWindow(GetFirstWMRoot(), window_manager(), |
467 aura::WindowMusType::EMBED_IN_OWNER); | |
459 | 468 |
460 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window); | 469 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window); |
461 ASSERT_TRUE(embed_result->IsValid()); | 470 ASSERT_TRUE(embed_result->IsValid()); |
462 aura::Window* embed_root = embed_result->window_tree_host->window(); | 471 aura::Window* embed_root = embed_result->window_tree_host->window(); |
463 | 472 |
464 // The root can be destroyed, even though it was not created by the client. | 473 // The root can be destroyed, even though it was not created by the client. |
465 aura::WindowTracker tracker; | 474 aura::WindowTracker tracker; |
466 tracker.Add(window); | 475 tracker.Add(window); |
467 tracker.Add(embed_root); | 476 tracker.Add(embed_root); |
468 embed_result->window_tree_host.reset(); | 477 embed_result->window_tree_host.reset(); |
469 EXPECT_FALSE(tracker.Contains(embed_root)); | 478 EXPECT_FALSE(tracker.Contains(embed_root)); |
470 EXPECT_TRUE(tracker.Contains(window)); | 479 EXPECT_TRUE(tracker.Contains(window)); |
471 | 480 |
472 delete window; | 481 delete window; |
473 EXPECT_FALSE(tracker.Contains(window)); | 482 EXPECT_FALSE(tracker.Contains(window)); |
474 } | 483 } |
475 | 484 |
476 TEST_F(WindowServerTest, MultiRoots) { | 485 TEST_F(WindowServerTest, MultiRoots) { |
477 aura::Window* window1 = NewVisibleWindow(GetFirstWMRoot(), window_manager()); | 486 aura::Window* window1 = NewVisibleWindow(GetFirstWMRoot(), window_manager(), |
478 aura::Window* window2 = NewVisibleWindow(GetFirstWMRoot(), window_manager()); | 487 aura::WindowMusType::EMBED_IN_OWNER); |
488 aura::Window* window2 = NewVisibleWindow(GetFirstWMRoot(), window_manager(), | |
489 aura::WindowMusType::EMBED_IN_OWNER); | |
479 std::unique_ptr<EmbedResult> embed_result1 = Embed(window_manager(), window1); | 490 std::unique_ptr<EmbedResult> embed_result1 = Embed(window_manager(), window1); |
480 ASSERT_TRUE(embed_result1->IsValid()); | 491 ASSERT_TRUE(embed_result1->IsValid()); |
481 std::unique_ptr<EmbedResult> embed_result2 = Embed(window_manager(), window2); | 492 std::unique_ptr<EmbedResult> embed_result2 = Embed(window_manager(), window2); |
482 ASSERT_TRUE(embed_result2->IsValid()); | 493 ASSERT_TRUE(embed_result2->IsValid()); |
483 } | 494 } |
484 | 495 |
485 TEST_F(WindowServerTest, Reorder) { | 496 TEST_F(WindowServerTest, Reorder) { |
486 aura::Window* window1 = NewVisibleWindow(GetFirstWMRoot(), window_manager()); | 497 aura::Window* window1 = NewVisibleWindow(GetFirstWMRoot(), window_manager(), |
498 aura::WindowMusType::EMBED_IN_OWNER); | |
487 | 499 |
488 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window1); | 500 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window1); |
489 ASSERT_TRUE(embed_result->IsValid()); | 501 ASSERT_TRUE(embed_result->IsValid()); |
490 aura::WindowTreeClient* embedded = embed_result->window_tree_client.get(); | 502 aura::WindowTreeClient* embedded = embed_result->window_tree_client.get(); |
491 aura::Window* embed_root = embed_result->window_tree_host->window(); | 503 aura::Window* embed_root = embed_result->window_tree_host->window(); |
492 | 504 |
493 aura::Window* window11 = NewVisibleWindow(embed_root, embedded); | 505 aura::Window* window11 = NewVisibleWindow(embed_root, embedded); |
494 aura::Window* window12 = NewVisibleWindow(embed_root, embedded); | 506 aura::Window* window12 = NewVisibleWindow(embed_root, embedded); |
495 ASSERT_TRUE(WaitForTreeSizeToMatch(window1, 3u)); | 507 ASSERT_TRUE(WaitForTreeSizeToMatch(window1, 3u)); |
496 | 508 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
553 } | 565 } |
554 | 566 |
555 aura::Window* window_; | 567 aura::Window* window_; |
556 | 568 |
557 DISALLOW_COPY_AND_ASSIGN(VisibilityChangeObserver); | 569 DISALLOW_COPY_AND_ASSIGN(VisibilityChangeObserver); |
558 }; | 570 }; |
559 | 571 |
560 } // namespace | 572 } // namespace |
561 | 573 |
562 TEST_F(WindowServerTest, Visible) { | 574 TEST_F(WindowServerTest, Visible) { |
563 aura::Window* window1 = NewVisibleWindow(GetFirstWMRoot(), window_manager()); | 575 aura::Window* window1 = NewVisibleWindow(GetFirstWMRoot(), window_manager(), |
576 aura::WindowMusType::EMBED_IN_OWNER); | |
564 | 577 |
565 // Embed another app and verify initial state. | 578 // Embed another app and verify initial state. |
566 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window1); | 579 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window1); |
567 ASSERT_TRUE(embed_result->IsValid()); | 580 ASSERT_TRUE(embed_result->IsValid()); |
568 aura::Window* embed_root = embed_result->window_tree_host->window(); | 581 aura::Window* embed_root = embed_result->window_tree_host->window(); |
569 EXPECT_TRUE(embed_root->TargetVisibility()); | 582 EXPECT_TRUE(embed_root->TargetVisibility()); |
570 EXPECT_TRUE(embed_root->IsVisible()); | 583 EXPECT_TRUE(embed_root->IsVisible()); |
571 | 584 |
572 // Change the visible state from the first client and verify its mirrored | 585 // Change the visible state from the first client and verify its mirrored |
573 // correctly to the embedded app. | 586 // correctly to the embedded app. |
(...skipping 20 matching lines...) Expand all Loading... | |
594 EXPECT_TRUE(window1->IsVisible()); | 607 EXPECT_TRUE(window1->IsVisible()); |
595 | 608 |
596 EXPECT_TRUE(embed_root->TargetVisibility()); | 609 EXPECT_TRUE(embed_root->TargetVisibility()); |
597 EXPECT_TRUE(embed_root->IsVisible()); | 610 EXPECT_TRUE(embed_root->IsVisible()); |
598 } | 611 } |
599 | 612 |
600 // TODO(beng): tests for window event dispatcher. | 613 // TODO(beng): tests for window event dispatcher. |
601 // - verify that we see events for all windows. | 614 // - verify that we see events for all windows. |
602 | 615 |
603 TEST_F(WindowServerTest, EmbedFailsWithChildren) { | 616 TEST_F(WindowServerTest, EmbedFailsWithChildren) { |
604 aura::Window* window1 = NewVisibleWindow(GetFirstWMRoot(), window_manager()); | 617 aura::Window* window1 = NewVisibleWindow(GetFirstWMRoot(), window_manager(), |
618 aura::WindowMusType::EMBED_IN_OWNER); | |
605 ASSERT_TRUE(NewVisibleWindow(window1, window_manager())); | 619 ASSERT_TRUE(NewVisibleWindow(window1, window_manager())); |
606 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window1); | 620 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window1); |
607 // Embed() should fail as |window1| has a child. | 621 // Embed() should fail as |window1| has a child. |
608 EXPECT_FALSE(embed_result->IsValid()); | 622 EXPECT_FALSE(embed_result->IsValid()); |
609 } | 623 } |
610 | 624 |
611 namespace { | 625 namespace { |
612 | 626 |
613 class DestroyObserver : public aura::WindowObserver { | 627 class DestroyObserver : public aura::WindowObserver { |
614 public: | 628 public: |
(...skipping 16 matching lines...) Expand all Loading... | |
631 | 645 |
632 DISALLOW_COPY_AND_ASSIGN(DestroyObserver); | 646 DISALLOW_COPY_AND_ASSIGN(DestroyObserver); |
633 }; | 647 }; |
634 | 648 |
635 } // namespace | 649 } // namespace |
636 | 650 |
637 // Verifies deleting a Window that is the root of another client notifies | 651 // Verifies deleting a Window that is the root of another client notifies |
638 // observers in the right order (OnWindowDestroyed() before | 652 // observers in the right order (OnWindowDestroyed() before |
639 // OnWindowManagerDestroyed()). | 653 // OnWindowManagerDestroyed()). |
640 TEST_F(WindowServerTest, WindowServerDestroyedAfterRootObserver) { | 654 TEST_F(WindowServerTest, WindowServerDestroyedAfterRootObserver) { |
641 aura::Window* window = NewVisibleWindow(GetFirstWMRoot(), window_manager()); | 655 aura::Window* window = NewVisibleWindow(GetFirstWMRoot(), window_manager(), |
656 aura::WindowMusType::EMBED_IN_OWNER); | |
642 | 657 |
643 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window); | 658 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window); |
644 ASSERT_TRUE(embed_result->IsValid()); | 659 ASSERT_TRUE(embed_result->IsValid()); |
645 aura::WindowTreeClient* embedded_client = | 660 aura::WindowTreeClient* embedded_client = |
646 embed_result->window_tree_client.get(); | 661 embed_result->window_tree_client.get(); |
647 | 662 |
648 bool got_destroy = false; | 663 bool got_destroy = false; |
649 DestroyObserver observer(embedded_client, &got_destroy); | 664 DestroyObserver observer(embedded_client, &got_destroy); |
650 // Delete the window |embedded_client| is embedded in. |embedded_client| is | 665 // Delete the window |embedded_client| is embedded in. |embedded_client| is |
651 // asynchronously notified and cleans up. | 666 // asynchronously notified and cleans up. |
652 delete window; | 667 delete window; |
653 EXPECT_TRUE(DoRunLoopWithTimeout()); | 668 EXPECT_TRUE(DoRunLoopWithTimeout()); |
654 ASSERT_TRUE(got_destroy); | 669 ASSERT_TRUE(got_destroy); |
655 // The WindowTreeHost was destroyed as well (by | 670 // The WindowTreeHost was destroyed as well (by |
656 // WindowServerTestBase::OnEmbedRootDestroyed()). | 671 // WindowServerTestBase::OnEmbedRootDestroyed()). |
657 embed_result->window_tree_host.release(); | 672 embed_result->window_tree_host.release(); |
658 EXPECT_EQ(0u, embed_result->window_tree_client->GetRoots().size()); | 673 EXPECT_EQ(0u, embed_result->window_tree_client->GetRoots().size()); |
659 } | 674 } |
660 | 675 |
661 TEST_F(WindowServerTest, ClientAreaChanged) { | 676 TEST_F(WindowServerTest, ClientAreaChanged) { |
662 aura::Window* window = NewVisibleWindow(GetFirstWMRoot(), window_manager()); | 677 aura::Window* window = NewVisibleWindow(GetFirstWMRoot(), window_manager(), |
678 aura::WindowMusType::EMBED_IN_OWNER); | |
663 | 679 |
664 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window); | 680 std::unique_ptr<EmbedResult> embed_result = Embed(window_manager(), window); |
665 ASSERT_TRUE(embed_result->IsValid()); | 681 ASSERT_TRUE(embed_result->IsValid()); |
666 | 682 |
667 // Verify change from embedded makes it to parent. | 683 // Verify change from embedded makes it to parent. |
668 const gfx::Insets insets(1, 2, 3, 4); | 684 const gfx::Insets insets(1, 2, 3, 4); |
669 embed_result->window_tree_host->SetClientArea(insets, | 685 embed_result->window_tree_host->SetClientArea(insets, |
670 std::vector<gfx::Rect>()); | 686 std::vector<gfx::Rect>()); |
671 std::unique_ptr<ClientAreaChange> client_area_change = | 687 std::unique_ptr<ClientAreaChange> client_area_change = |
672 WaitForClientAreaToChange(); | 688 WaitForClientAreaToChange(); |
(...skipping 18 matching lines...) Expand all Loading... | |
691 run_loop_.reset(); | 707 run_loop_.reset(); |
692 return created_window_ != nullptr; | 708 return created_window_ != nullptr; |
693 } | 709 } |
694 | 710 |
695 aura::Window* created_window() { return created_window_; } | 711 aura::Window* created_window() { return created_window_; } |
696 | 712 |
697 // WindowManagerDelegate: | 713 // WindowManagerDelegate: |
698 aura::Window* OnWmCreateTopLevelWindow( | 714 aura::Window* OnWmCreateTopLevelWindow( |
699 ui::mojom::WindowType window_type, | 715 ui::mojom::WindowType window_type, |
700 std::map<std::string, std::vector<uint8_t>>* properties) override { | 716 std::map<std::string, std::vector<uint8_t>>* properties) override { |
701 created_window_ = NewVisibleWindow((*client_->GetRoots().begin()), client_); | 717 created_window_ = NewVisibleWindow((*client_->GetRoots().begin()), client_, |
718 aura::WindowMusType::TOP_LEVEL_IN_WM); | |
702 if (run_loop_) | 719 if (run_loop_) |
703 run_loop_->Quit(); | 720 run_loop_->Quit(); |
704 return created_window_; | 721 return created_window_; |
705 } | 722 } |
706 | 723 |
707 private: | 724 private: |
708 aura::WindowTreeClient* client_; | 725 aura::WindowTreeClient* client_; |
709 std::unique_ptr<base::RunLoop> run_loop_; | 726 std::unique_ptr<base::RunLoop> run_loop_; |
710 aura::Window* created_window_; | 727 aura::Window* created_window_; |
711 | 728 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
774 ASSERT_EQ(1u, top_level_in_wm->children().size()); | 791 ASSERT_EQ(1u, top_level_in_wm->children().size()); |
775 aura::Window* second_client_child_in_wm = top_level_in_wm->children()[0]; | 792 aura::Window* second_client_child_in_wm = top_level_in_wm->children()[0]; |
776 ASSERT_EQ(1u, second_client_child_in_wm->children().size()); | 793 ASSERT_EQ(1u, second_client_child_in_wm->children().size()); |
777 aura::Window* transient_in_wm = second_client_child_in_wm->children()[0]; | 794 aura::Window* transient_in_wm = second_client_child_in_wm->children()[0]; |
778 ASSERT_EQ(second_client_child_in_wm, | 795 ASSERT_EQ(second_client_child_in_wm, |
779 transient_window_client->GetTransientParent(transient_in_wm)); | 796 transient_window_client->GetTransientParent(transient_in_wm)); |
780 } | 797 } |
781 | 798 |
782 } // namespace ws | 799 } // namespace ws |
783 } // namespace ui | 800 } // namespace ui |
OLD | NEW |