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

Side by Side Diff: chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc

Issue 325443002: Move about://-related constants from //content to //url (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Android ifx Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/command_line.h" 5 #include "base/command_line.h"
6 #include "build/build_config.h" 6 #include "build/build_config.h"
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_tabstrip.h" 8 #include "chrome/browser/ui/browser_tabstrip.h"
9 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" 9 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
10 #include "chrome/browser/ui/fullscreen/fullscreen_controller_state_test.h" 10 #include "chrome/browser/ui/fullscreen/fullscreen_controller_state_test.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // Tests all states with all permutations of multiple events to detect lingering 319 // Tests all states with all permutations of multiple events to detect lingering
320 // state issues that would bleed over to other states. 320 // state issues that would bleed over to other states.
321 // I.E. for each state test all combinations of events E1, E2, E3. 321 // I.E. for each state test all combinations of events E1, E2, E3.
322 // 322 //
323 // This produces coverage for event sequences that may happen normally but 323 // This produces coverage for event sequences that may happen normally but
324 // would not be exposed by traversing to each state via TransitionToState(). 324 // would not be exposed by traversing to each state via TransitionToState().
325 // TransitionToState() always takes the same path even when multiple paths 325 // TransitionToState() always takes the same path even when multiple paths
326 // exist. 326 // exist.
327 TEST_F(FullscreenControllerStateUnitTest, TransitionsForEachState) { 327 TEST_F(FullscreenControllerStateUnitTest, TransitionsForEachState) {
328 // A tab is needed for tab fullscreen. 328 // A tab is needed for tab fullscreen.
329 AddTab(browser(), GURL(content::kAboutBlankURL)); 329 AddTab(browser(), GURL(url::kAboutBlankURL));
330 TestTransitionsForEachState(); 330 TestTransitionsForEachState();
331 // Progress of test can be examined via LOG(INFO) << GetAndClearDebugLog(); 331 // Progress of test can be examined via LOG(INFO) << GetAndClearDebugLog();
332 } 332 }
333 333
334 334
335 // Individual tests for each pair of state and event --------------------------- 335 // Individual tests for each pair of state and event ---------------------------
336 336
337 #define TEST_EVENT(state, event) \ 337 #define TEST_EVENT(state, event) \
338 TEST_F(FullscreenControllerStateUnitTest, state##__##event) { \ 338 TEST_F(FullscreenControllerStateUnitTest, state##__##event) { \
339 AddTab(browser(), GURL(content::kAboutBlankURL)); \ 339 AddTab(browser(), GURL(url::kAboutBlankURL)); \
340 ASSERT_NO_FATAL_FAILURE(TestStateAndEvent(state, event)) \ 340 ASSERT_NO_FATAL_FAILURE(TestStateAndEvent(state, event)) \
341 << GetAndClearDebugLog(); \ 341 << GetAndClearDebugLog(); \
342 } 342 }
343 // Progress of tests can be examined by inserting the following line: 343 // Progress of tests can be examined by inserting the following line:
344 // LOG(INFO) << GetAndClearDebugLog(); } 344 // LOG(INFO) << GetAndClearDebugLog(); }
345 345
346 #include "chrome/browser/ui/fullscreen/fullscreen_controller_state_tests.h" 346 #include "chrome/browser/ui/fullscreen/fullscreen_controller_state_tests.h"
347 347
348 348
349 // Specific one-off tests for known issues ------------------------------------- 349 // Specific one-off tests for known issues -------------------------------------
350 350
351 // TODO(scheib) Toggling Tab fullscreen while pending Tab or 351 // TODO(scheib) Toggling Tab fullscreen while pending Tab or
352 // Browser fullscreen is broken currently http://crbug.com/154196 352 // Browser fullscreen is broken currently http://crbug.com/154196
353 TEST_F(FullscreenControllerStateUnitTest, 353 TEST_F(FullscreenControllerStateUnitTest,
354 DISABLED_ToggleTabWhenPendingBrowser) { 354 DISABLED_ToggleTabWhenPendingBrowser) {
355 // Only possible without reentrancy. 355 // Only possible without reentrancy.
356 if (FullscreenControllerStateTest::IsWindowFullscreenStateChangedReentrant()) 356 if (FullscreenControllerStateTest::IsWindowFullscreenStateChangedReentrant())
357 return; 357 return;
358 AddTab(browser(), GURL(content::kAboutBlankURL)); 358 AddTab(browser(), GURL(url::kAboutBlankURL));
359 ASSERT_NO_FATAL_FAILURE( 359 ASSERT_NO_FATAL_FAILURE(
360 TransitionToState(STATE_TO_BROWSER_FULLSCREEN_NO_CHROME)) 360 TransitionToState(STATE_TO_BROWSER_FULLSCREEN_NO_CHROME))
361 << GetAndClearDebugLog(); 361 << GetAndClearDebugLog();
362 362
363 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)) << GetAndClearDebugLog(); 363 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)) << GetAndClearDebugLog();
364 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_FALSE)) << GetAndClearDebugLog(); 364 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_FALSE)) << GetAndClearDebugLog();
365 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)) << GetAndClearDebugLog(); 365 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)) << GetAndClearDebugLog();
366 } 366 }
367 367
368 // TODO(scheib) Toggling Tab fullscreen while pending Tab or 368 // TODO(scheib) Toggling Tab fullscreen while pending Tab or
369 // Browser fullscreen is broken currently http://crbug.com/154196 369 // Browser fullscreen is broken currently http://crbug.com/154196
370 TEST_F(FullscreenControllerStateUnitTest, DISABLED_ToggleTabWhenPendingTab) { 370 TEST_F(FullscreenControllerStateUnitTest, DISABLED_ToggleTabWhenPendingTab) {
371 // Only possible without reentrancy. 371 // Only possible without reentrancy.
372 if (FullscreenControllerStateTest::IsWindowFullscreenStateChangedReentrant()) 372 if (FullscreenControllerStateTest::IsWindowFullscreenStateChangedReentrant())
373 return; 373 return;
374 AddTab(browser(), GURL(content::kAboutBlankURL)); 374 AddTab(browser(), GURL(url::kAboutBlankURL));
375 ASSERT_NO_FATAL_FAILURE( 375 ASSERT_NO_FATAL_FAILURE(
376 TransitionToState(STATE_TO_TAB_FULLSCREEN)) 376 TransitionToState(STATE_TO_TAB_FULLSCREEN))
377 << GetAndClearDebugLog(); 377 << GetAndClearDebugLog();
378 378
379 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)) << GetAndClearDebugLog(); 379 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)) << GetAndClearDebugLog();
380 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_FALSE)) << GetAndClearDebugLog(); 380 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_FALSE)) << GetAndClearDebugLog();
381 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)) << GetAndClearDebugLog(); 381 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)) << GetAndClearDebugLog();
382 } 382 }
383 383
384 // Debugging utility: Display the transition tables. Intentionally disabled 384 // Debugging utility: Display the transition tables. Intentionally disabled
(...skipping 25 matching lines...) Expand all
410 output << "\n\nAll transitions:"; 410 output << "\n\nAll transitions:";
411 output << GetStateTransitionsAsString(); 411 output << GetStateTransitionsAsString();
412 LOG(INFO) << output.str(); 412 LOG(INFO) << output.str();
413 } 413 }
414 414
415 // Test that the fullscreen exit bubble is closed by 415 // Test that the fullscreen exit bubble is closed by
416 // WindowFullscreenStateChanged() if fullscreen is exited via BrowserWindow. 416 // WindowFullscreenStateChanged() if fullscreen is exited via BrowserWindow.
417 // This currently occurs when an extension exits fullscreen via changing the 417 // This currently occurs when an extension exits fullscreen via changing the
418 // browser bounds. 418 // browser bounds.
419 TEST_F(FullscreenControllerStateUnitTest, ExitFullscreenViaBrowserWindow) { 419 TEST_F(FullscreenControllerStateUnitTest, ExitFullscreenViaBrowserWindow) {
420 AddTab(browser(), GURL(content::kAboutBlankURL)); 420 AddTab(browser(), GURL(url::kAboutBlankURL));
421 ASSERT_TRUE(InvokeEvent(TOGGLE_FULLSCREEN)); 421 ASSERT_TRUE(InvokeEvent(TOGGLE_FULLSCREEN));
422 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)); 422 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE));
423 ASSERT_TRUE(browser()->window()->IsFullscreen()); 423 ASSERT_TRUE(browser()->window()->IsFullscreen());
424 // Exit fullscreen without going through fullscreen controller. 424 // Exit fullscreen without going through fullscreen controller.
425 browser()->window()->ExitFullscreen(); 425 browser()->window()->ExitFullscreen();
426 ChangeWindowFullscreenState(); 426 ChangeWindowFullscreenState();
427 EXPECT_EQ(FEB_TYPE_NONE, 427 EXPECT_EQ(FEB_TYPE_NONE,
428 browser()->fullscreen_controller()->GetFullscreenExitBubbleType()); 428 browser()->fullscreen_controller()->GetFullscreenExitBubbleType());
429 } 429 }
430 430
431 // Test that switching tabs takes the browser out of tab fullscreen. 431 // Test that switching tabs takes the browser out of tab fullscreen.
432 TEST_F(FullscreenControllerStateUnitTest, ExitTabFullscreenViaSwitchingTab) { 432 TEST_F(FullscreenControllerStateUnitTest, ExitTabFullscreenViaSwitchingTab) {
433 AddTab(browser(), GURL(content::kAboutBlankURL)); 433 AddTab(browser(), GURL(url::kAboutBlankURL));
434 AddTab(browser(), GURL(content::kAboutBlankURL)); 434 AddTab(browser(), GURL(url::kAboutBlankURL));
435 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)); 435 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE));
436 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)); 436 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE));
437 ASSERT_TRUE(browser()->window()->IsFullscreen()); 437 ASSERT_TRUE(browser()->window()->IsFullscreen());
438 438
439 browser()->tab_strip_model()->SelectNextTab(); 439 browser()->tab_strip_model()->SelectNextTab();
440 ChangeWindowFullscreenState(); 440 ChangeWindowFullscreenState();
441 EXPECT_FALSE(browser()->window()->IsFullscreen()); 441 EXPECT_FALSE(browser()->window()->IsFullscreen());
442 } 442 }
443 443
444 // Test that switching tabs via detaching the active tab (which is in tab 444 // Test that switching tabs via detaching the active tab (which is in tab
445 // fullscreen) takes the browser out of tab fullscreen. This case can 445 // fullscreen) takes the browser out of tab fullscreen. This case can
446 // occur if the user is in both tab fullscreen and immersive browser fullscreen. 446 // occur if the user is in both tab fullscreen and immersive browser fullscreen.
447 TEST_F(FullscreenControllerStateUnitTest, ExitTabFullscreenViaDetachingTab) { 447 TEST_F(FullscreenControllerStateUnitTest, ExitTabFullscreenViaDetachingTab) {
448 AddTab(browser(), GURL(content::kAboutBlankURL)); 448 AddTab(browser(), GURL(url::kAboutBlankURL));
449 AddTab(browser(), GURL(content::kAboutBlankURL)); 449 AddTab(browser(), GURL(url::kAboutBlankURL));
450 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)); 450 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE));
451 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)); 451 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE));
452 ASSERT_TRUE(browser()->window()->IsFullscreen()); 452 ASSERT_TRUE(browser()->window()->IsFullscreen());
453 453
454 scoped_ptr<content::WebContents> web_contents( 454 scoped_ptr<content::WebContents> web_contents(
455 browser()->tab_strip_model()->DetachWebContentsAt(0)); 455 browser()->tab_strip_model()->DetachWebContentsAt(0));
456 ChangeWindowFullscreenState(); 456 ChangeWindowFullscreenState();
457 EXPECT_FALSE(browser()->window()->IsFullscreen()); 457 EXPECT_FALSE(browser()->window()->IsFullscreen());
458 } 458 }
459 459
460 // Test that replacing the web contents for a tab which is in tab fullscreen 460 // Test that replacing the web contents for a tab which is in tab fullscreen
461 // takes the browser out of tab fullscreen. This can occur if the user 461 // takes the browser out of tab fullscreen. This can occur if the user
462 // navigates to a prerendered page from a page which is tab fullscreen. 462 // navigates to a prerendered page from a page which is tab fullscreen.
463 TEST_F(FullscreenControllerStateUnitTest, ExitTabFullscreenViaReplacingTab) { 463 TEST_F(FullscreenControllerStateUnitTest, ExitTabFullscreenViaReplacingTab) {
464 AddTab(browser(), GURL(content::kAboutBlankURL)); 464 AddTab(browser(), GURL(url::kAboutBlankURL));
465 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)); 465 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE));
466 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)); 466 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE));
467 ASSERT_TRUE(browser()->window()->IsFullscreen()); 467 ASSERT_TRUE(browser()->window()->IsFullscreen());
468 468
469 content::WebContents* new_web_contents = content::WebContents::Create( 469 content::WebContents* new_web_contents = content::WebContents::Create(
470 content::WebContents::CreateParams(profile())); 470 content::WebContents::CreateParams(profile()));
471 scoped_ptr<content::WebContents> old_web_contents( 471 scoped_ptr<content::WebContents> old_web_contents(
472 browser()->tab_strip_model()->ReplaceWebContentsAt( 472 browser()->tab_strip_model()->ReplaceWebContentsAt(
473 0, new_web_contents)); 473 0, new_web_contents));
474 ChangeWindowFullscreenState(); 474 ChangeWindowFullscreenState();
475 EXPECT_FALSE(browser()->window()->IsFullscreen()); 475 EXPECT_FALSE(browser()->window()->IsFullscreen());
476 } 476 }
477 477
478 // Tests that, in a browser configured for Fullscreen-Within-Tab mode, 478 // Tests that, in a browser configured for Fullscreen-Within-Tab mode,
479 // fullscreening a screen-captured tab will NOT cause any fullscreen state 479 // fullscreening a screen-captured tab will NOT cause any fullscreen state
480 // change to the browser window. Furthermore, the test switches between tabs to 480 // change to the browser window. Furthermore, the test switches between tabs to
481 // confirm a captured tab will be resized by FullscreenController to the capture 481 // confirm a captured tab will be resized by FullscreenController to the capture
482 // video resolution once the widget is detached from the UI. 482 // video resolution once the widget is detached from the UI.
483 // 483 //
484 // See 'FullscreenWithinTab Note' in fullscreen_controller.h. 484 // See 'FullscreenWithinTab Note' in fullscreen_controller.h.
485 TEST_F(FullscreenControllerStateUnitTest, OneCapturedFullscreenedTab) { 485 TEST_F(FullscreenControllerStateUnitTest, OneCapturedFullscreenedTab) {
486 content::WebContentsDelegate* const wc_delegate = 486 content::WebContentsDelegate* const wc_delegate =
487 static_cast<content::WebContentsDelegate*>(browser()); 487 static_cast<content::WebContentsDelegate*>(browser());
488 if (!wc_delegate->EmbedsFullscreenWidget()) { 488 if (!wc_delegate->EmbedsFullscreenWidget()) {
489 LOG(WARNING) << "Skipping test since fullscreen-within-tab is disabled."; 489 LOG(WARNING) << "Skipping test since fullscreen-within-tab is disabled.";
490 return; 490 return;
491 } 491 }
492 492
493 AddTab(browser(), GURL(content::kAboutBlankURL)); 493 AddTab(browser(), GURL(url::kAboutBlankURL));
494 AddTab(browser(), GURL(content::kAboutBlankURL)); 494 AddTab(browser(), GURL(url::kAboutBlankURL));
495 content::WebContents* const first_tab = 495 content::WebContents* const first_tab =
496 browser()->tab_strip_model()->GetWebContentsAt(0); 496 browser()->tab_strip_model()->GetWebContentsAt(0);
497 content::WebContents* const second_tab = 497 content::WebContents* const second_tab =
498 browser()->tab_strip_model()->GetWebContentsAt(1); 498 browser()->tab_strip_model()->GetWebContentsAt(1);
499 499
500 // Activate the first tab and tell its WebContents it is being captured. 500 // Activate the first tab and tell its WebContents it is being captured.
501 browser()->tab_strip_model()->ActivateTabAt(0, true); 501 browser()->tab_strip_model()->ActivateTabAt(0, true);
502 const gfx::Size kCaptureSize(1280, 720); 502 const gfx::Size kCaptureSize(1280, 720);
503 first_tab->IncrementCapturerCount(kCaptureSize); 503 first_tab->IncrementCapturerCount(kCaptureSize);
504 ASSERT_FALSE(browser()->window()->IsFullscreen()); 504 ASSERT_FALSE(browser()->window()->IsFullscreen());
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 // 550 //
551 // See 'FullscreenWithinTab Note' in fullscreen_controller.h. 551 // See 'FullscreenWithinTab Note' in fullscreen_controller.h.
552 TEST_F(FullscreenControllerStateUnitTest, TwoFullscreenedTabsOneCaptured) { 552 TEST_F(FullscreenControllerStateUnitTest, TwoFullscreenedTabsOneCaptured) {
553 content::WebContentsDelegate* const wc_delegate = 553 content::WebContentsDelegate* const wc_delegate =
554 static_cast<content::WebContentsDelegate*>(browser()); 554 static_cast<content::WebContentsDelegate*>(browser());
555 if (!wc_delegate->EmbedsFullscreenWidget()) { 555 if (!wc_delegate->EmbedsFullscreenWidget()) {
556 LOG(WARNING) << "Skipping test since fullscreen-within-tab is disabled."; 556 LOG(WARNING) << "Skipping test since fullscreen-within-tab is disabled.";
557 return; 557 return;
558 } 558 }
559 559
560 AddTab(browser(), GURL(content::kAboutBlankURL)); 560 AddTab(browser(), GURL(url::kAboutBlankURL));
561 AddTab(browser(), GURL(content::kAboutBlankURL)); 561 AddTab(browser(), GURL(url::kAboutBlankURL));
562 content::WebContents* const first_tab = 562 content::WebContents* const first_tab =
563 browser()->tab_strip_model()->GetWebContentsAt(0); 563 browser()->tab_strip_model()->GetWebContentsAt(0);
564 content::WebContents* const second_tab = 564 content::WebContents* const second_tab =
565 browser()->tab_strip_model()->GetWebContentsAt(1); 565 browser()->tab_strip_model()->GetWebContentsAt(1);
566 566
567 // Start capturing the first tab, fullscreen it, then switch to the second tab 567 // Start capturing the first tab, fullscreen it, then switch to the second tab
568 // and fullscreen that. The second tab will cause the browser window to 568 // and fullscreen that. The second tab will cause the browser window to
569 // expand to fill the screen. 569 // expand to fill the screen.
570 browser()->tab_strip_model()->ActivateTabAt(0, true); 570 browser()->tab_strip_model()->ActivateTabAt(0, true);
571 const gfx::Size kCaptureSize(1280, 720); 571 const gfx::Size kCaptureSize(1280, 720);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 // See 'FullscreenWithinTab Note' in fullscreen_controller.h. 611 // See 'FullscreenWithinTab Note' in fullscreen_controller.h.
612 TEST_F(FullscreenControllerStateUnitTest, 612 TEST_F(FullscreenControllerStateUnitTest,
613 BackgroundCapturedTabExitsFullscreen) { 613 BackgroundCapturedTabExitsFullscreen) {
614 content::WebContentsDelegate* const wc_delegate = 614 content::WebContentsDelegate* const wc_delegate =
615 static_cast<content::WebContentsDelegate*>(browser()); 615 static_cast<content::WebContentsDelegate*>(browser());
616 if (!wc_delegate->EmbedsFullscreenWidget()) { 616 if (!wc_delegate->EmbedsFullscreenWidget()) {
617 LOG(WARNING) << "Skipping test since fullscreen-within-tab is disabled."; 617 LOG(WARNING) << "Skipping test since fullscreen-within-tab is disabled.";
618 return; 618 return;
619 } 619 }
620 620
621 AddTab(browser(), GURL(content::kAboutBlankURL)); 621 AddTab(browser(), GURL(url::kAboutBlankURL));
622 AddTab(browser(), GURL(content::kAboutBlankURL)); 622 AddTab(browser(), GURL(url::kAboutBlankURL));
623 content::WebContents* const first_tab = 623 content::WebContents* const first_tab =
624 browser()->tab_strip_model()->GetWebContentsAt(0); 624 browser()->tab_strip_model()->GetWebContentsAt(0);
625 content::WebContents* const second_tab = 625 content::WebContents* const second_tab =
626 browser()->tab_strip_model()->GetWebContentsAt(1); 626 browser()->tab_strip_model()->GetWebContentsAt(1);
627 627
628 // Start capturing the first tab, fullscreen it, then switch to the second tab 628 // Start capturing the first tab, fullscreen it, then switch to the second tab
629 // and fullscreen that. The second tab will cause the browser window to 629 // and fullscreen that. The second tab will cause the browser window to
630 // expand to fill the screen. 630 // expand to fill the screen.
631 browser()->tab_strip_model()->ActivateTabAt(0, true); 631 browser()->tab_strip_model()->ActivateTabAt(0, true);
632 const gfx::Size kCaptureSize(1280, 720); 632 const gfx::Size kCaptureSize(1280, 720);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 // See 'FullscreenWithinTab Note' in fullscreen_controller.h. 670 // See 'FullscreenWithinTab Note' in fullscreen_controller.h.
671 TEST_F(FullscreenControllerStateUnitTest, 671 TEST_F(FullscreenControllerStateUnitTest,
672 OneCapturedTabFullscreenedBeforeBrowserFullscreen) { 672 OneCapturedTabFullscreenedBeforeBrowserFullscreen) {
673 content::WebContentsDelegate* const wc_delegate = 673 content::WebContentsDelegate* const wc_delegate =
674 static_cast<content::WebContentsDelegate*>(browser()); 674 static_cast<content::WebContentsDelegate*>(browser());
675 if (!wc_delegate->EmbedsFullscreenWidget()) { 675 if (!wc_delegate->EmbedsFullscreenWidget()) {
676 LOG(WARNING) << "Skipping test since fullscreen-within-tab is disabled."; 676 LOG(WARNING) << "Skipping test since fullscreen-within-tab is disabled.";
677 return; 677 return;
678 } 678 }
679 679
680 AddTab(browser(), GURL(content::kAboutBlankURL)); 680 AddTab(browser(), GURL(url::kAboutBlankURL));
681 content::WebContents* const tab = 681 content::WebContents* const tab =
682 browser()->tab_strip_model()->GetWebContentsAt(0); 682 browser()->tab_strip_model()->GetWebContentsAt(0);
683 683
684 // Start capturing the tab and fullscreen it. The state of the browser window 684 // Start capturing the tab and fullscreen it. The state of the browser window
685 // should remain unchanged. 685 // should remain unchanged.
686 browser()->tab_strip_model()->ActivateTabAt(0, true); 686 browser()->tab_strip_model()->ActivateTabAt(0, true);
687 const gfx::Size kCaptureSize(1280, 720); 687 const gfx::Size kCaptureSize(1280, 720);
688 tab->IncrementCapturerCount(kCaptureSize); 688 tab->IncrementCapturerCount(kCaptureSize);
689 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)); 689 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE));
690 EXPECT_TRUE(wc_delegate->IsFullscreenForTabOrPending(tab)); 690 EXPECT_TRUE(wc_delegate->IsFullscreenForTabOrPending(tab));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 // See 'FullscreenWithinTab Note' in fullscreen_controller.h. 724 // See 'FullscreenWithinTab Note' in fullscreen_controller.h.
725 TEST_F(FullscreenControllerStateUnitTest, 725 TEST_F(FullscreenControllerStateUnitTest,
726 CapturedFullscreenedTabTransferredBetweenBrowserWindows) { 726 CapturedFullscreenedTabTransferredBetweenBrowserWindows) {
727 content::WebContentsDelegate* const wc_delegate = 727 content::WebContentsDelegate* const wc_delegate =
728 static_cast<content::WebContentsDelegate*>(browser()); 728 static_cast<content::WebContentsDelegate*>(browser());
729 if (!wc_delegate->EmbedsFullscreenWidget()) { 729 if (!wc_delegate->EmbedsFullscreenWidget()) {
730 LOG(WARNING) << "Skipping test since fullscreen-within-tab is disabled."; 730 LOG(WARNING) << "Skipping test since fullscreen-within-tab is disabled.";
731 return; 731 return;
732 } 732 }
733 733
734 AddTab(browser(), GURL(content::kAboutBlankURL)); 734 AddTab(browser(), GURL(url::kAboutBlankURL));
735 AddTab(browser(), GURL(content::kAboutBlankURL)); 735 AddTab(browser(), GURL(url::kAboutBlankURL));
736 content::WebContents* const tab = 736 content::WebContents* const tab =
737 browser()->tab_strip_model()->GetWebContentsAt(0); 737 browser()->tab_strip_model()->GetWebContentsAt(0);
738 738
739 // Activate the first tab and tell its WebContents it is being captured. 739 // Activate the first tab and tell its WebContents it is being captured.
740 browser()->tab_strip_model()->ActivateTabAt(0, true); 740 browser()->tab_strip_model()->ActivateTabAt(0, true);
741 const gfx::Size kCaptureSize(1280, 720); 741 const gfx::Size kCaptureSize(1280, 720);
742 tab->IncrementCapturerCount(kCaptureSize); 742 tab->IncrementCapturerCount(kCaptureSize);
743 ASSERT_FALSE(browser()->window()->IsFullscreen()); 743 ASSERT_FALSE(browser()->window()->IsFullscreen());
744 ASSERT_FALSE(wc_delegate->IsFullscreenForTabOrPending(tab)); 744 ASSERT_FALSE(wc_delegate->IsFullscreenForTabOrPending(tab));
745 ASSERT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending()); 745 ASSERT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending());
746 746
747 // Enter tab fullscreen. Since the tab is being captured, the browser window 747 // Enter tab fullscreen. Since the tab is being captured, the browser window
748 // should not expand to fill the screen. 748 // should not expand to fill the screen.
749 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)); 749 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE));
750 EXPECT_FALSE(browser()->window()->IsFullscreen()); 750 EXPECT_FALSE(browser()->window()->IsFullscreen());
751 EXPECT_TRUE(wc_delegate->IsFullscreenForTabOrPending(tab)); 751 EXPECT_TRUE(wc_delegate->IsFullscreenForTabOrPending(tab));
752 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending()); 752 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending());
753 753
754 // Create the second browser window. 754 // Create the second browser window.
755 const scoped_ptr<BrowserWindow> second_browser_window(CreateBrowserWindow()); 755 const scoped_ptr<BrowserWindow> second_browser_window(CreateBrowserWindow());
756 const scoped_ptr<Browser> second_browser(CreateBrowser( 756 const scoped_ptr<Browser> second_browser(CreateBrowser(
757 browser()->profile(), 757 browser()->profile(),
758 browser()->type(), 758 browser()->type(),
759 false, 759 false,
760 browser()->host_desktop_type(), 760 browser()->host_desktop_type(),
761 second_browser_window.get())); 761 second_browser_window.get()));
762 AddTab(second_browser.get(), GURL(content::kAboutBlankURL)); 762 AddTab(second_browser.get(), GURL(url::kAboutBlankURL));
763 content::WebContentsDelegate* const second_wc_delegate = 763 content::WebContentsDelegate* const second_wc_delegate =
764 static_cast<content::WebContentsDelegate*>(second_browser.get()); 764 static_cast<content::WebContentsDelegate*>(second_browser.get());
765 765
766 // Detach the tab from the first browser window and attach it to the second. 766 // Detach the tab from the first browser window and attach it to the second.
767 // The tab should remain in fullscreen mode and neither browser window should 767 // The tab should remain in fullscreen mode and neither browser window should
768 // have expanded. It is correct for both FullscreenControllers to agree the 768 // have expanded. It is correct for both FullscreenControllers to agree the
769 // tab is in fullscreen mode. 769 // tab is in fullscreen mode.
770 browser()->tab_strip_model()->DetachWebContentsAt(0); 770 browser()->tab_strip_model()->DetachWebContentsAt(0);
771 second_browser->tab_strip_model()-> 771 second_browser->tab_strip_model()->
772 InsertWebContentsAt(0, tab, TabStripModel::ADD_ACTIVE); 772 InsertWebContentsAt(0, tab, TabStripModel::ADD_ACTIVE);
(...skipping 24 matching lines...) Expand all
797 EXPECT_FALSE(browser()->window()->IsFullscreen()); 797 EXPECT_FALSE(browser()->window()->IsFullscreen());
798 EXPECT_FALSE(wc_delegate->IsFullscreenForTabOrPending(tab)); 798 EXPECT_FALSE(wc_delegate->IsFullscreenForTabOrPending(tab));
799 EXPECT_FALSE(second_wc_delegate->IsFullscreenForTabOrPending(tab)); 799 EXPECT_FALSE(second_wc_delegate->IsFullscreenForTabOrPending(tab));
800 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending()); 800 EXPECT_FALSE(GetFullscreenController()->IsWindowFullscreenForTabOrPending());
801 EXPECT_FALSE(second_browser->fullscreen_controller()-> 801 EXPECT_FALSE(second_browser->fullscreen_controller()->
802 IsWindowFullscreenForTabOrPending()); 802 IsWindowFullscreenForTabOrPending());
803 803
804 // Required tear-down specific to this test. 804 // Required tear-down specific to this test.
805 second_browser->tab_strip_model()->CloseAllTabs(); 805 second_browser->tab_strip_model()->CloseAllTabs();
806 } 806 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698