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

Side by Side Diff: ui/aura/mus/window_tree_client_unittest.cc

Issue 2512783005: Fix //third_party/cec to not disable -Wunused-function. (Closed)
Patch Set: Rebase Created 4 years 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 | « ui/aura/mus/window_tree_client.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/aura/mus/window_tree_client.h" 5 #include "ui/aura/mus/window_tree_client.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 return WindowMus::Get(window)->server_id(); 51 return WindowMus::Get(window)->server_id();
52 } 52 }
53 53
54 void SetWindowVisibility(Window* window, bool visible) { 54 void SetWindowVisibility(Window* window, bool visible) {
55 if (visible) 55 if (visible)
56 window->Show(); 56 window->Show();
57 else 57 else
58 window->Hide(); 58 window->Hide();
59 } 59 }
60 60
61 Window* GetFirstRoot(WindowTreeClient* client) {
62 return client->GetRoots().empty() ? nullptr : *client->GetRoots().begin();
63 }
64
65 bool IsWindowHostVisible(Window* window) { 61 bool IsWindowHostVisible(Window* window) {
66 return window->GetRootWindow()->GetHost()->compositor()->IsVisible(); 62 return window->GetRootWindow()->GetHost()->compositor()->IsVisible();
67 } 63 }
68 64
69 // Register some test window properties for aura/mus conversion. 65 // Register some test window properties for aura/mus conversion.
70 void RegisterTestProperties(PropertyConverter* converter) { 66 void RegisterTestProperties(PropertyConverter* converter) {
71 converter->RegisterProperty(kTestPropertyKey1, kTestPropertyServerKey1); 67 converter->RegisterProperty(kTestPropertyKey1, kTestPropertyServerKey1);
72 converter->RegisterProperty(kTestPropertyKey2, kTestPropertyServerKey2); 68 converter->RegisterProperty(kTestPropertyKey2, kTestPropertyServerKey2);
73 converter->RegisterProperty(kTestPropertyKey3, kTestPropertyServerKey3); 69 converter->RegisterProperty(kTestPropertyKey3, kTestPropertyServerKey3);
74 } 70 }
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 ASSERT_TRUE(window_tree()->AckSingleChangeOfType( 430 ASSERT_TRUE(window_tree()->AckSingleChangeOfType(
435 WindowTreeChangeType::VISIBLE, false)); 431 WindowTreeChangeType::VISIBLE, false));
436 EXPECT_EQ(server_changed_visible, root_window()->TargetVisibility()); 432 EXPECT_EQ(server_changed_visible, root_window()->TargetVisibility());
437 433
438 // Simulate server changing back to original visible. Should take immediately. 434 // Simulate server changing back to original visible. Should take immediately.
439 window_tree_client()->OnWindowVisibilityChanged(server_id(root_window()), 435 window_tree_client()->OnWindowVisibilityChanged(server_id(root_window()),
440 original_visible); 436 original_visible);
441 EXPECT_EQ(original_visible, root_window()->TargetVisibility()); 437 EXPECT_EQ(original_visible, root_window()->TargetVisibility());
442 } 438 }
443 439
444 /*
445 // Verifies |is_modal| is reverted if the server replied that the change failed.
446 TEST_F(WindowTreeClientWmTest, SetModalFailed) {
447 WindowTreeSetup setup;
448 Window* root = GetFirstRoot();
449 ASSERT_TRUE(root);
450 EXPECT_FALSE(root->is_modal());
451 root->SetModal();
452 uint32_t change_id;
453 ASSERT_TRUE(window_tree()->GetAndClearChangeId(&change_id));
454 EXPECT_TRUE(root->is_modal());
455 window_tree_client()->OnChangeCompleted(change_id, false);
456 EXPECT_FALSE(root->is_modal());
457 }
458 */
459
460 namespace { 440 namespace {
461 441
462 class InputEventBasicTestWindowDelegate : public test::TestWindowDelegate { 442 class InputEventBasicTestWindowDelegate : public test::TestWindowDelegate {
463 public: 443 public:
464 static uint32_t constexpr kEventId = 1; 444 static uint32_t constexpr kEventId = 1;
465 445
466 explicit InputEventBasicTestWindowDelegate(TestWindowTree* test_window_tree) 446 explicit InputEventBasicTestWindowDelegate(TestWindowTree* test_window_tree)
467 : test_window_tree_(test_window_tree) {} 447 : test_window_tree_(test_window_tree) {}
468 ~InputEventBasicTestWindowDelegate() override {} 448 ~InputEventBasicTestWindowDelegate() override {}
469 449
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 window1.Init(ui::LAYER_NOT_DRAWN); 1335 window1.Init(ui::LAYER_NOT_DRAWN);
1356 Window* window2 = new Window(nullptr); 1336 Window* window2 = new Window(nullptr);
1357 window2->Init(ui::LAYER_NOT_DRAWN); 1337 window2->Init(ui::LAYER_NOT_DRAWN);
1358 window1.AddChild(window2); 1338 window1.AddChild(window2);
1359 window_tree()->AckAllChanges(); 1339 window_tree()->AckAllChanges();
1360 window_tree_client()->OnWindowDeleted(server_id(window2)); 1340 window_tree_client()->OnWindowDeleted(server_id(window2));
1361 EXPECT_FALSE(window_tree()->has_change()); 1341 EXPECT_FALSE(window_tree()->has_change());
1362 } 1342 }
1363 1343
1364 } // namespace aura 1344 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/window_tree_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698