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

Unified Diff: chrome/browser/ui/fullscreen_controller_browsertest.cc

Issue 10642008: Exit mouse lock permision prompt on tab switch or close. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Feedback addressed. Created 8 years, 6 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 | « chrome/browser/ui/fullscreen_controller.cc ('k') | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/fullscreen_controller_browsertest.cc
diff --git a/chrome/browser/ui/fullscreen_controller_browsertest.cc b/chrome/browser/ui/fullscreen_controller_browsertest.cc
index f35dd2f2efd5832accd5565cd2f6a90a413d9529..c42d372f3b84fd0d48f5b67e636d06b589ae1bdd 100644
--- a/chrome/browser/ui/fullscreen_controller_browsertest.cc
+++ b/chrome/browser/ui/fullscreen_controller_browsertest.cc
@@ -13,6 +13,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
+#include "content/public/test/test_navigation_observer.h"
#if defined(OS_MACOSX)
#include "base/mac/mac_util.h"
#endif
@@ -339,3 +340,60 @@ IN_PROC_BROWSER_TEST_F(
}
}
#endif
+
+IN_PROC_BROWSER_TEST_F(FullscreenControllerTest,
+ PendingMouseLockExitsOnTabSwitch) {
+ AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL),
+ content::PAGE_TRANSITION_TYPED);
+ WebContents* tab2 = browser()->GetActiveWebContents();
+ AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL),
+ content::PAGE_TRANSITION_TYPED);
+ WebContents* tab1 = browser()->GetActiveWebContents();
+
+ // Request mouse lock. Bubble is displayed.
+ RequestToLockMouse(tab1, true, false);
+ ASSERT_TRUE(IsFullscreenBubbleDisplayed());
+
+ // Activate current tab. Mouse lock bubble remains.
+ browser()->ActivateTabAt(0, true);
+ ASSERT_TRUE(IsFullscreenBubbleDisplayed());
+
+ // Activate tab2. Mouse lock bubble clears.
+ {
+ MouseLockNotificationObserver mouse_lock_observer;
+ browser()->ActivateTabAt(1, true);
+ mouse_lock_observer.Wait();
+ }
+ ASSERT_FALSE(IsFullscreenBubbleDisplayed());
+
+ // Now, test that closing an unrelated tab does not disturb a request.
+
+ // Request mouse lock. Bubble is displayed.
+ RequestToLockMouse(tab2, true, false);
+ ASSERT_TRUE(IsFullscreenBubbleDisplayed());
+
+ // Close tab1. Mouse lock bubble remains.
+ browser()->CloseTabContents(tab1);
+ ASSERT_TRUE(IsFullscreenBubbleDisplayed());
+}
+
+IN_PROC_BROWSER_TEST_F(FullscreenControllerTest,
+ PendingMouseLockExitsOnTabClose) {
+ // Add more tabs.
+ AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL),
+ content::PAGE_TRANSITION_TYPED);
+ AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL),
+ content::PAGE_TRANSITION_TYPED);
+
+ // Request mouse lock. Bubble is displayed.
+ RequestToLockMouse(browser()->GetActiveWebContents(), true, false);
+ ASSERT_TRUE(IsFullscreenBubbleDisplayed());
+
+ // Close tab. Bubble is cleared.
+ {
+ MouseLockNotificationObserver mouse_lock_observer;
+ browser()->CloseTab();
+ mouse_lock_observer.Wait();
+ }
+ ASSERT_FALSE(IsFullscreenBubbleDisplayed());
+}
« no previous file with comments | « chrome/browser/ui/fullscreen_controller.cc ('k') | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698