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

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

Issue 2454973003: Wires up modality for aura-mus (Closed)
Patch Set: more tests Created 4 years, 1 month 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') | ui/aura/test/mus/test_window_tree.h » ('j') | 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 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 capture_recorder.reset_capture_captured_count(); 1041 capture_recorder.reset_capture_captured_count();
1042 1042
1043 // Changes originating from server should notify observers too. 1043 // Changes originating from server should notify observers too.
1044 window_tree_client()->OnCaptureChanged(server_id(&child2), 0); 1044 window_tree_client()->OnCaptureChanged(server_id(&child2), 0);
1045 EXPECT_EQ(1, capture_recorder.capture_changed_count()); 1045 EXPECT_EQ(1, capture_recorder.capture_changed_count());
1046 EXPECT_EQ(child2_id, capture_recorder.last_gained_capture_window_id()); 1046 EXPECT_EQ(child2_id, capture_recorder.last_gained_capture_window_id());
1047 EXPECT_EQ(0, capture_recorder.last_lost_capture_window_id()); 1047 EXPECT_EQ(0, capture_recorder.last_lost_capture_window_id());
1048 capture_recorder.reset_capture_captured_count(); 1048 capture_recorder.reset_capture_captured_count();
1049 } 1049 }
1050 1050
1051 TEST_F(WindowTreeClientClientTest, ModalFail) {
1052 Window window(nullptr);
1053 window.Init(ui::LAYER_NOT_DRAWN);
1054 window.SetProperty(client::kModalKey, ui::MODAL_TYPE_WINDOW);
1055 // Make sure server was told about it, and have the server say it failed.
1056 ASSERT_TRUE(
1057 window_tree()->AckSingleChangeOfType(WindowTreeChangeType::MODAL, false));
1058 // Type should be back to MODAL_TYPE_NONE as the server didn't accept the
1059 // change.
1060 EXPECT_EQ(ui::MODAL_TYPE_NONE, window.GetProperty(client::kModalKey));
1061 // There should be no more modal changes.
1062 EXPECT_FALSE(
1063 window_tree()->AckSingleChangeOfType(WindowTreeChangeType::MODAL, false));
1064 }
1065
1066 TEST_F(WindowTreeClientClientTest, ModalSuccess) {
1067 Window window(nullptr);
1068 window.Init(ui::LAYER_NOT_DRAWN);
1069 window.SetProperty(client::kModalKey, ui::MODAL_TYPE_WINDOW);
1070 // Ack change as succeeding.
1071 ASSERT_TRUE(
1072 window_tree()->AckSingleChangeOfType(WindowTreeChangeType::MODAL, true));
1073 EXPECT_EQ(ui::MODAL_TYPE_WINDOW, window.GetProperty(client::kModalKey));
1074 // There should be no more modal changes.
1075 EXPECT_FALSE(
1076 window_tree()->AckSingleChangeOfType(WindowTreeChangeType::MODAL, false));
1077 }
1078
1051 } // namespace aura 1079 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/window_tree_client.cc ('k') | ui/aura/test/mus/test_window_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698