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

Side by Side Diff: components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc

Issue 1811913004: mus: Allow SetModal to fail gracefully (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed constructor/destructor Created 4 years, 9 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/public/cpp/tests/test_window_tree.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 "components/mus/public/cpp/lib/window_tree_client_impl.h" 5 #include "components/mus/public/cpp/lib/window_tree_client_impl.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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 // most recent visible from server. 331 // most recent visible from server.
332 setup.window_tree_client()->OnChangeCompleted(change_id, false); 332 setup.window_tree_client()->OnChangeCompleted(change_id, false);
333 EXPECT_EQ(server_changed_visible, root->visible()); 333 EXPECT_EQ(server_changed_visible, root->visible());
334 334
335 // Simulate server changing back to original visible. Should take immediately. 335 // Simulate server changing back to original visible. Should take immediately.
336 setup.window_tree_client()->OnWindowVisibilityChanged(root->id(), 336 setup.window_tree_client()->OnWindowVisibilityChanged(root->id(),
337 original_visible); 337 original_visible);
338 EXPECT_EQ(original_visible, root->visible()); 338 EXPECT_EQ(original_visible, root->visible());
339 } 339 }
340 340
341 // Verifies |is_modal| is reverted if the server replied that the change failed.
342 TEST_F(WindowTreeClientImplTest, SetModalFailed) {
343 WindowTreeSetup setup;
344 Window* root = setup.GetFirstRoot();
345 ASSERT_TRUE(root);
346 EXPECT_FALSE(root->is_modal());
347 root->SetModal();
348 uint32_t change_id;
349 ASSERT_TRUE(setup.window_tree()->GetAndClearChangeId(&change_id));
350 EXPECT_TRUE(root->is_modal());
351 setup.window_tree_client()->OnChangeCompleted(change_id, false);
352 EXPECT_FALSE(root->is_modal());
353 }
354
341 TEST_F(WindowTreeClientImplTest, InputEventBasic) { 355 TEST_F(WindowTreeClientImplTest, InputEventBasic) {
342 WindowTreeSetup setup; 356 WindowTreeSetup setup;
343 Window* root = setup.GetFirstRoot(); 357 Window* root = setup.GetFirstRoot();
344 ASSERT_TRUE(root); 358 ASSERT_TRUE(root);
345 359
346 TestInputEventHandler event_handler; 360 TestInputEventHandler event_handler;
347 root->set_input_event_handler(&event_handler); 361 root->set_input_event_handler(&event_handler);
348 362
349 scoped_ptr<ui::Event> ui_event( 363 scoped_ptr<ui::Event> ui_event(
350 new ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), 364 new ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(),
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 818
805 setup.window_tree_client()->OnChangeCompleted(change_id2, false); 819 setup.window_tree_client()->OnChangeCompleted(change_id2, false);
806 EXPECT_FALSE(child->HasCapture()); 820 EXPECT_FALSE(child->HasCapture());
807 EXPECT_TRUE(root->HasCapture()); 821 EXPECT_TRUE(root->HasCapture());
808 822
809 setup.window_tree_client()->OnLostCapture(root->id()); 823 setup.window_tree_client()->OnLostCapture(root->id());
810 EXPECT_FALSE(root->HasCapture()); 824 EXPECT_FALSE(root->HasCapture());
811 } 825 }
812 826
813 } // namespace mus 827 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/public/cpp/tests/test_window_tree.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698