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

Unified Diff: ui/views/corewm/focus_controller_unittest.cc

Issue 23892006: Allows focus to change when capture held (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/views/corewm/focus_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/corewm/focus_controller_unittest.cc
diff --git a/ui/views/corewm/focus_controller_unittest.cc b/ui/views/corewm/focus_controller_unittest.cc
index 62062f875c496e32e77d28ed2954f50fa2711bc6..55791be929b4473b8a7efad4b1c5516eb9f20774 100644
--- a/ui/views/corewm/focus_controller_unittest.cc
+++ b/ui/views/corewm/focus_controller_unittest.cc
@@ -268,7 +268,8 @@ class FocusControllerTestBase : public aura::test::AuraTestBase {
return aura::client::GetFocusClient(root_window())->GetFocusedWindow();
}
int GetFocusedWindowId() {
- return GetFocusedWindow()->id();
+ aura::Window* focused_window = GetFocusedWindow();
+ return focused_window ? focused_window->id() : -1;
}
void ActivateWindow(aura::Window* window) {
aura::client::GetActivationClient(root_window())->ActivateWindow(window);
@@ -303,6 +304,7 @@ class FocusControllerTestBase : public aura::test::AuraTestBase {
virtual void ShiftFocusOnActivationDueToHide() {}
virtual void NoShiftActiveOnActivation() {}
virtual void NoFocusChangeOnClickOnCaptureWindow() {}
+ virtual void ChangeFocusWhenNothingFocusedAndCaptured() {}
private:
scoped_ptr<FocusController> focus_controller_;
@@ -598,6 +600,24 @@ class FocusControllerDirectTestBase : public FocusControllerTestBase {
aura::client::GetCaptureClient(root_window())->ReleaseCapture(w2);
}
+ // Verifies focus change is honored while capture held.
+ virtual void ChangeFocusWhenNothingFocusedAndCaptured() OVERRIDE {
+ scoped_ptr<aura::client::DefaultCaptureClient> capture_client(
+ new aura::client::DefaultCaptureClient(root_window()));
+ aura::Window* w1 = root_window()->GetChildById(1);
+ aura::client::GetCaptureClient(root_window())->SetCapture(w1);
+
+ EXPECT_EQ(-1, GetActiveWindowId());
+ EXPECT_EQ(-1, GetFocusedWindowId());
+
+ FocusWindowById(1);
+
+ EXPECT_EQ(1, GetActiveWindowId());
+ EXPECT_EQ(1, GetFocusedWindowId());
+
+ aura::client::GetCaptureClient(root_window())->ReleaseCapture(w1);
+ }
+
private:
DISALLOW_COPY_AND_ASSIGN(FocusControllerDirectTestBase);
};
@@ -996,5 +1016,8 @@ DIRECT_FOCUS_CHANGE_TESTS(NoShiftActiveOnActivation);
// Clicking on a window which has capture should not result in a focus change.
DIRECT_FOCUS_CHANGE_TESTS(NoFocusChangeOnClickOnCaptureWindow);
+FOCUS_CONTROLLER_TEST(FocusControllerApiTest,
+ ChangeFocusWhenNothingFocusedAndCaptured);
+
} // namespace corewm
} // namespace views
« no previous file with comments | « ui/views/corewm/focus_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698