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

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

Issue 1864113002: Fixes problems with drawn state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: parentdrawn and merge 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
« no previous file with comments | « components/mus/ws/window_tree_client_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 519
520 // The binding should be paused until the wm acks the change. 520 // The binding should be paused until the wm acks the change.
521 uint32_t wm_change_id = 0u; 521 uint32_t wm_change_id = 0u;
522 ASSERT_TRUE(wm_internal.did_call_create_top_level_window(&wm_change_id)); 522 ASSERT_TRUE(wm_internal.did_call_create_top_level_window(&wm_change_id));
523 EXPECT_TRUE(child_binding->is_paused()); 523 EXPECT_TRUE(child_binding->is_paused());
524 524
525 // Create the window for |embed_window_id2_in_child|. 525 // Create the window for |embed_window_id2_in_child|.
526 const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2); 526 const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2);
527 EXPECT_TRUE( 527 EXPECT_TRUE(
528 wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties())); 528 wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties()));
529 EXPECT_TRUE(wm_tree()->SetWindowVisibility(embed_window_id2, true));
529 EXPECT_TRUE(wm_tree()->AddWindow(FirstRootId(wm_tree()), embed_window_id2)); 530 EXPECT_TRUE(wm_tree()->AddWindow(FirstRootId(wm_tree()), embed_window_id2));
530 531
531 // Ack the change, which should resume the binding. 532 // Ack the change, which should resume the binding.
533 child_binding->client()->tracker()->changes()->clear();
532 static_cast<mojom::WindowManagerClient*>(wm_tree()) 534 static_cast<mojom::WindowManagerClient*>(wm_tree())
533 ->OnWmCreatedTopLevelWindow(wm_change_id, embed_window_id2.id); 535 ->OnWmCreatedTopLevelWindow(wm_change_id, embed_window_id2.id);
534 EXPECT_FALSE(child_binding->is_paused()); 536 EXPECT_FALSE(child_binding->is_paused());
535 EXPECT_EQ("TopLevelCreated id=17 window_id=" + 537 EXPECT_EQ("TopLevelCreated id=17 window_id=" +
536 WindowIdToString( 538 WindowIdToString(
537 WindowIdFromTransportId(embed_window_id2_in_child.id)), 539 WindowIdFromTransportId(embed_window_id2_in_child.id)) +
540 " drawn=true",
538 SingleChangeToDescription( 541 SingleChangeToDescription(
539 *child_binding->client()->tracker()->changes())); 542 *child_binding->client()->tracker()->changes()));
540 child_binding->client()->tracker()->changes()->clear(); 543 child_binding->client()->tracker()->changes()->clear();
541 544
542 // Change the visibility of the window from the owner and make sure the 545 // Change the visibility of the window from the owner and make sure the
543 // client sees the right id. 546 // client sees the right id.
544 ServerWindow* embed_window = wm_tree()->GetWindowByClientId(embed_window_id2); 547 ServerWindow* embed_window = wm_tree()->GetWindowByClientId(embed_window_id2);
545 ASSERT_TRUE(embed_window); 548 ASSERT_TRUE(embed_window);
549 EXPECT_TRUE(embed_window->visible());
550 ASSERT_TRUE(wm_tree()->SetWindowVisibility(
551 ClientWindowIdForWindow(wm_tree(), embed_window), false));
546 EXPECT_FALSE(embed_window->visible()); 552 EXPECT_FALSE(embed_window->visible());
547 ASSERT_TRUE(wm_tree()->SetWindowVisibility(
548 ClientWindowIdForWindow(wm_tree(), embed_window), true));
549 EXPECT_TRUE(embed_window->visible());
550 EXPECT_EQ("VisibilityChanged window=" + 553 EXPECT_EQ("VisibilityChanged window=" +
551 WindowIdToString( 554 WindowIdToString(
552 WindowIdFromTransportId(embed_window_id2_in_child.id)) + 555 WindowIdFromTransportId(embed_window_id2_in_child.id)) +
553 " visible=true", 556 " visible=false",
554 SingleChangeToDescription( 557 SingleChangeToDescription(
555 *child_binding->client()->tracker()->changes())); 558 *child_binding->client()->tracker()->changes()));
556 559
557 // Set the visibility from the child using the client assigned id. 560 // Set the visibility from the child using the client assigned id.
558 ASSERT_TRUE( 561 ASSERT_TRUE(child_tree->SetWindowVisibility(embed_window_id2_in_child, true));
559 child_tree->SetWindowVisibility(embed_window_id2_in_child, false)); 562 EXPECT_TRUE(embed_window->visible());
560 EXPECT_FALSE(embed_window->visible());
561 } 563 }
562 564
563 // Tests that setting capture only works while an input event is being 565 // Tests that setting capture only works while an input event is being
564 // processed, and the only the capture window can release capture. 566 // processed, and the only the capture window can release capture.
565 TEST_F(WindowTreeTest, ExplicitSetCapture) { 567 TEST_F(WindowTreeTest, ExplicitSetCapture) {
566 TestWindowTreeClient* embed_connection = nullptr; 568 TestWindowTreeClient* embed_connection = nullptr;
567 WindowTree* tree = nullptr; 569 WindowTree* tree = nullptr;
568 ServerWindow* window = nullptr; 570 ServerWindow* window = nullptr;
569 EXPECT_NO_FATAL_FAILURE( 571 EXPECT_NO_FATAL_FAILURE(
570 SetupEventTargeting(&embed_connection, &tree, &window)); 572 SetupEventTargeting(&embed_connection, &tree, &window));
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 836
835 // Make |w3| child of |w1|. This should release capture as |w3| is now blocked 837 // Make |w3| child of |w1|. This should release capture as |w3| is now blocked
836 // by a modal window. 838 // by a modal window.
837 ASSERT_TRUE(tree->AddWindow(w1_id, w3_id)); 839 ASSERT_TRUE(tree->AddWindow(w1_id, w3_id));
838 EXPECT_EQ(nullptr, GetCaptureWindow(display)); 840 EXPECT_EQ(nullptr, GetCaptureWindow(display));
839 } 841 }
840 842
841 } // namespace test 843 } // namespace test
842 } // namespace ws 844 } // namespace ws
843 } // namespace mus 845 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/window_tree_client_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698