Revert 168224 - Update V8 to version 3.15.4.
[chromium-blink-merge.git] / chrome / browser / ui / fullscreen / fullscreen_controller_browsertest.cc
blobc9da148956a9d12f9713286d30c67df28f296469
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/compiler_specific.h"
6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_commands.h"
9 #include "chrome/browser/ui/browser_tabstrip.h"
10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
12 #include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h"
13 #include "chrome/test/base/ui_test_utils.h"
14 #include "content/public/browser/render_view_host.h"
15 #include "content/public/browser/web_contents.h"
16 #include "content/public/common/url_constants.h"
17 #include "content/public/test/test_navigation_observer.h"
18 #if defined(OS_MACOSX)
19 #include "base/mac/mac_util.h"
20 #endif
22 using chrome::kAboutBlankURL;
23 using content::WebContents;
24 using content::PAGE_TRANSITION_TYPED;
26 class FullscreenControllerBrowserTest: public FullscreenControllerTest {
29 IN_PROC_BROWSER_TEST_F(FullscreenControllerTest,
30 PendingMouseLockExitsOnTabSwitch) {
31 AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED);
32 AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED);
33 WebContents* tab1 = chrome::GetActiveWebContents(browser());
35 // Request mouse lock. Bubble is displayed.
36 RequestToLockMouse(true, false);
37 ASSERT_TRUE(IsFullscreenBubbleDisplayed());
39 // Activate current tab. Mouse lock bubble remains.
40 chrome::ActivateTabAt(browser(), 0, true);
41 ASSERT_TRUE(IsFullscreenBubbleDisplayed());
43 // Activate second tab. Mouse lock bubble clears.
45 MouseLockNotificationObserver mouse_lock_observer;
46 chrome::ActivateTabAt(browser(), 1, true);
47 mouse_lock_observer.Wait();
49 ASSERT_FALSE(IsFullscreenBubbleDisplayed());
51 // Now, test that closing an unrelated tab does not disturb a request.
53 // Request mouse lock. Bubble is displayed.
54 RequestToLockMouse(true, false);
55 ASSERT_TRUE(IsFullscreenBubbleDisplayed());
57 // Close first tab while second active. Mouse lock bubble remains.
58 chrome::CloseWebContents(browser(), tab1);
59 ASSERT_TRUE(IsFullscreenBubbleDisplayed());
62 IN_PROC_BROWSER_TEST_F(FullscreenControllerTest,
63 PendingMouseLockExitsOnTabClose) {
64 // Add more tabs.
65 AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED);
66 AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED);
68 // Request mouse lock. Bubble is displayed.
69 RequestToLockMouse(true, false);
70 ASSERT_TRUE(IsFullscreenBubbleDisplayed());
72 // Close tab. Bubble is cleared.
74 MouseLockNotificationObserver mouse_lock_observer;
75 chrome::CloseTab(browser());
76 mouse_lock_observer.Wait();
78 ASSERT_FALSE(IsFullscreenBubbleDisplayed());