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_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| 11 #include "chrome/browser/ui/browser_tabstrip.h" |
11 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
12 #include "chrome/browser/ui/fullscreen_controller_test.h" | 13 #include "chrome/browser/ui/fullscreen_controller_test.h" |
13 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
14 #include "content/public/browser/render_view_host.h" | 15 #include "content/public/browser/render_view_host.h" |
15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
16 #include "content/public/common/url_constants.h" | 17 #include "content/public/common/url_constants.h" |
17 #include "content/public/test/test_navigation_observer.h" | 18 #include "content/public/test/test_navigation_observer.h" |
18 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
19 #include "base/mac/mac_util.h" | 20 #include "base/mac/mac_util.h" |
20 #endif | 21 #endif |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 295 |
295 #if defined(OS_MACOSX) | 296 #if defined(OS_MACOSX) |
296 // http://crbug.com/100467 | 297 // http://crbug.com/100467 |
297 IN_PROC_BROWSER_TEST_F( | 298 IN_PROC_BROWSER_TEST_F( |
298 FullscreenControllerTest, FAILS_TabEntersPresentationModeFromWindowed) { | 299 FullscreenControllerTest, FAILS_TabEntersPresentationModeFromWindowed) { |
299 ASSERT_TRUE(test_server()->Start()); | 300 ASSERT_TRUE(test_server()->Start()); |
300 | 301 |
301 AddTabAtIndexAndWait( | 302 AddTabAtIndexAndWait( |
302 0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); | 303 0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); |
303 | 304 |
304 WebContents* tab = browser()->GetActiveWebContents(); | 305 WebContents* tab = chrome::GetActiveWebContents(browser()); |
305 | 306 |
306 { | 307 { |
307 FullscreenNotificationObserver fullscreen_observer; | 308 FullscreenNotificationObserver fullscreen_observer; |
308 EXPECT_FALSE(browser()->window()->IsFullscreen()); | 309 EXPECT_FALSE(browser()->window()->IsFullscreen()); |
309 EXPECT_FALSE(browser()->window()->InPresentationMode()); | 310 EXPECT_FALSE(browser()->window()->InPresentationMode()); |
310 browser()->ToggleFullscreenModeForTab(tab, true); | 311 browser()->ToggleFullscreenModeForTab(tab, true); |
311 fullscreen_observer.Wait(); | 312 fullscreen_observer.Wait(); |
312 ASSERT_TRUE(browser()->window()->IsFullscreen()); | 313 ASSERT_TRUE(browser()->window()->IsFullscreen()); |
313 ASSERT_TRUE(browser()->window()->InPresentationMode()); | 314 ASSERT_TRUE(browser()->window()->InPresentationMode()); |
314 } | 315 } |
(...skipping 17 matching lines...) Expand all Loading... |
332 } | 333 } |
333 } | 334 } |
334 #endif | 335 #endif |
335 | 336 |
336 IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, | 337 IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, |
337 PendingMouseLockExitsOnTabSwitch) { | 338 PendingMouseLockExitsOnTabSwitch) { |
338 AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL), | 339 AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL), |
339 content::PAGE_TRANSITION_TYPED); | 340 content::PAGE_TRANSITION_TYPED); |
340 AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL), | 341 AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL), |
341 content::PAGE_TRANSITION_TYPED); | 342 content::PAGE_TRANSITION_TYPED); |
342 WebContents* tab1 = browser()->GetActiveWebContents(); | 343 WebContents* tab1 = chrome::GetActiveWebContents(browser()); |
343 | 344 |
344 // Request mouse lock. Bubble is displayed. | 345 // Request mouse lock. Bubble is displayed. |
345 RequestToLockMouse(true, false); | 346 RequestToLockMouse(true, false); |
346 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); | 347 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
347 | 348 |
348 // Activate current tab. Mouse lock bubble remains. | 349 // Activate current tab. Mouse lock bubble remains. |
349 browser()->ActivateTabAt(0, true); | 350 chrome::ActivateTabAt(browser(), 0, true); |
350 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); | 351 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
351 | 352 |
352 // Activate second tab. Mouse lock bubble clears. | 353 // Activate second tab. Mouse lock bubble clears. |
353 { | 354 { |
354 MouseLockNotificationObserver mouse_lock_observer; | 355 MouseLockNotificationObserver mouse_lock_observer; |
355 browser()->ActivateTabAt(1, true); | 356 chrome::ActivateTabAt(browser(), 1, true); |
356 mouse_lock_observer.Wait(); | 357 mouse_lock_observer.Wait(); |
357 } | 358 } |
358 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); | 359 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
359 | 360 |
360 // Now, test that closing an unrelated tab does not disturb a request. | 361 // Now, test that closing an unrelated tab does not disturb a request. |
361 | 362 |
362 // Request mouse lock. Bubble is displayed. | 363 // Request mouse lock. Bubble is displayed. |
363 RequestToLockMouse(true, false); | 364 RequestToLockMouse(true, false); |
364 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); | 365 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
365 | 366 |
366 // Close first tab while second active. Mouse lock bubble remains. | 367 // Close first tab while second active. Mouse lock bubble remains. |
367 browser()->CloseTabContents(tab1); | 368 chrome::CloseWebContents(browser(), tab1); |
368 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); | 369 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
369 } | 370 } |
370 | 371 |
371 IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, | 372 IN_PROC_BROWSER_TEST_F(FullscreenControllerTest, |
372 PendingMouseLockExitsOnTabClose) { | 373 PendingMouseLockExitsOnTabClose) { |
373 // Add more tabs. | 374 // Add more tabs. |
374 AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL), | 375 AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL), |
375 content::PAGE_TRANSITION_TYPED); | 376 content::PAGE_TRANSITION_TYPED); |
376 AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL), | 377 AddTabAtIndexAndWait(0, GURL(chrome::kAboutBlankURL), |
377 content::PAGE_TRANSITION_TYPED); | 378 content::PAGE_TRANSITION_TYPED); |
378 | 379 |
379 // Request mouse lock. Bubble is displayed. | 380 // Request mouse lock. Bubble is displayed. |
380 RequestToLockMouse(true, false); | 381 RequestToLockMouse(true, false); |
381 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); | 382 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); |
382 | 383 |
383 // Close tab. Bubble is cleared. | 384 // Close tab. Bubble is cleared. |
384 { | 385 { |
385 MouseLockNotificationObserver mouse_lock_observer; | 386 MouseLockNotificationObserver mouse_lock_observer; |
386 chrome::CloseTab(browser()); | 387 chrome::CloseTab(browser()); |
387 mouse_lock_observer.Wait(); | 388 mouse_lock_observer.Wait(); |
388 } | 389 } |
389 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); | 390 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); |
390 } | 391 } |
OLD | NEW |