Chromium Code Reviews| 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..e9e5303c63094388eb260e840406f3409068af99 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,57 @@ 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, |
|
yzshen1
2012/06/22 22:18:04
nit: it might be useful to also test another case:
scheib
2012/06/22 22:27:16
Done.
Acutlaly, there were already two tabs in th
|
| + PendingMouseLockExitsOnTabClose) { |
| + 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()); |
| +} |