OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/content_settings/host_content_settings_map.h" | 7 #include "chrome/browser/content_settings/host_content_settings_map.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
11 #include "chrome/browser/ui/fullscreen_controller_test.h" | 11 #include "chrome/browser/ui/fullscreen_controller_test.h" |
12 #include "chrome/test/base/ui_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
13 #include "content/public/browser/render_view_host.h" | 13 #include "content/public/browser/render_view_host.h" |
14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 #include "content/public/common/url_constants.h" | 15 #include "content/public/common/url_constants.h" |
| 16 #include "content/public/test/test_navigation_observer.h" |
16 #if defined(OS_MACOSX) | 17 #if defined(OS_MACOSX) |
17 #include "base/mac/mac_util.h" | 18 #include "base/mac/mac_util.h" |
18 #endif | 19 #endif |
19 | 20 |
20 using content::WebContents; | 21 using content::WebContents; |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 const FilePath::CharType* kSimpleFile = FILE_PATH_LITERAL("simple.html"); | 25 const FilePath::CharType* kSimpleFile = FILE_PATH_LITERAL("simple.html"); |
25 | 26 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 // Test that tab fullscreen mode doesn't make presentation mode the default | 333 // Test that tab fullscreen mode doesn't make presentation mode the default |
333 // on Lion. | 334 // on Lion. |
334 FullscreenNotificationObserver fullscreen_observer; | 335 FullscreenNotificationObserver fullscreen_observer; |
335 browser()->ToggleFullscreenMode(); | 336 browser()->ToggleFullscreenMode(); |
336 fullscreen_observer.Wait(); | 337 fullscreen_observer.Wait(); |
337 ASSERT_TRUE(browser()->window()->IsFullscreen()); | 338 ASSERT_TRUE(browser()->window()->IsFullscreen()); |
338 ASSERT_FALSE(browser()->window()->InPresentationMode()); | 339 ASSERT_FALSE(browser()->window()->InPresentationMode()); |
339 } | 340 } |
340 } | 341 } |
341 #endif | 342 #endif |
| 343 |
| 344 IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, |
| 345 PendingMouseLockExitsOnTabSwitch) { |
| 346 AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL), |
| 347 content::PAGE_TRANSITION_TYPED); |
| 348 WebContents* tab2 = browser()->GetActiveWebContents(); |
| 349 AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL), |
| 350 content::PAGE_TRANSITION_TYPED); |
| 351 WebContents* tab1 = browser()->GetActiveWebContents(); |
| 352 |
| 353 // Request mouse lock. Bubble is displayed. |
| 354 RequestToLockMouse(tab1, true, false); |
| 355 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
| 356 |
| 357 // Activate current tab. Mouse lock bubble remains. |
| 358 browser()->ActivateTabAt(0, true); |
| 359 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
| 360 |
| 361 // Activate tab2. Mouse lock bubble clears. |
| 362 { |
| 363 MouseLockNotificationObserver mouse_lock_observer; |
| 364 browser()->ActivateTabAt(1, true); |
| 365 mouse_lock_observer.Wait(); |
| 366 } |
| 367 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
| 368 |
| 369 // Now, test that closing an unrelated tab does not disturb a request. |
| 370 |
| 371 // Request mouse lock. Bubble is displayed. |
| 372 RequestToLockMouse(tab2, true, false); |
| 373 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
| 374 |
| 375 // Close tab1. Mouse lock bubble remains. |
| 376 browser()->CloseTabContents(tab1); |
| 377 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
| 378 } |
| 379 |
| 380 IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, |
| 381 PendingMouseLockExitsOnTabClose) { |
| 382 // Add more tabs. |
| 383 AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL), |
| 384 content::PAGE_TRANSITION_TYPED); |
| 385 AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL), |
| 386 content::PAGE_TRANSITION_TYPED); |
| 387 |
| 388 // Request mouse lock. Bubble is displayed. |
| 389 RequestToLockMouse(browser()->GetActiveWebContents(), true, false); |
| 390 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
| 391 |
| 392 // Close tab. Bubble is cleared. |
| 393 { |
| 394 MouseLockNotificationObserver mouse_lock_observer; |
| 395 browser()->CloseTab(); |
| 396 mouse_lock_observer.Wait(); |
| 397 } |
| 398 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
| 399 } |
OLD | NEW |