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

Unified Diff: ui/aura/mus/window_tree_client_unittest.cc

Issue 2714763002: Change FocusSynchronizer to maintain active focus client and window. (Closed)
Patch Set: test Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/mus/window_tree_client.h ('k') | ui/aura/test/aura_test_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/mus/window_tree_client_unittest.cc
diff --git a/ui/aura/mus/window_tree_client_unittest.cc b/ui/aura/mus/window_tree_client_unittest.cc
index fbfcb94487adfe6c7a99ae05bd163d5954415e64..2643860e9feb11d97e530513b0d318f632ee3ae4 100644
--- a/ui/aura/mus/window_tree_client_unittest.cc
+++ b/ui/aura/mus/window_tree_client_unittest.cc
@@ -22,6 +22,7 @@
#include "ui/aura/client/focus_client.h"
#include "ui/aura/client/transient_window_client.h"
#include "ui/aura/mus/capture_synchronizer.h"
+#include "ui/aura/mus/focus_synchronizer.h"
#include "ui/aura/mus/property_converter.h"
#include "ui/aura/mus/window_mus.h"
#include "ui/aura/mus/window_tree_client_delegate.h"
@@ -1031,11 +1032,19 @@ TEST_F(WindowTreeClientWmTest, SetFocusFailed) {
Window child(nullptr);
child.Init(ui::LAYER_NOT_DRAWN);
root_window()->AddChild(&child);
+ // AuraTestHelper::SetUp sets the active focus client and focus client root,
+ // root_window() is assumed to have focus until we actually focus on a
+ // certain window.
+ EXPECT_EQ(WindowMus::Get(root_window()),
+ window_tree_client_impl()->focus_synchronizer()->focused_window());
child.Focus();
ASSERT_TRUE(child.HasFocus());
+ EXPECT_EQ(&child, client::GetFocusClient(&child)->GetFocusedWindow());
ASSERT_TRUE(
window_tree()->AckSingleChangeOfType(WindowTreeChangeType::FOCUS, false));
- EXPECT_EQ(nullptr, client::GetFocusClient(&child)->GetFocusedWindow());
+ // If the change failed, we fall back to the revert_value which is the
+ // current focused_window.
+ EXPECT_EQ(root_window(), client::GetFocusClient(&child)->GetFocusedWindow());
}
// Simulates a focus change, and while the focus change is in flight the server
« no previous file with comments | « ui/aura/mus/window_tree_client.h ('k') | ui/aura/test/aura_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698