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

Side by Side Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 2044743002: Remove unused argument from WebContentsImpl::IsFullscreenForCurrentTab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 <stdint.h> 5 #include <stdint.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 const GURL url("http://www.google.com"); 1530 const GURL url("http://www.google.com");
1531 controller().LoadURL( 1531 controller().LoadURL(
1532 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 1532 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
1533 int entry_id = controller().GetPendingEntry()->GetUniqueID(); 1533 int entry_id = controller().GetPendingEntry()->GetUniqueID();
1534 contents()->GetMainFrame()->PrepareForCommit(); 1534 contents()->GetMainFrame()->PrepareForCommit();
1535 contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url, 1535 contents()->TestDidNavigate(orig_rfh, 1, entry_id, true, url,
1536 ui::PAGE_TRANSITION_TYPED); 1536 ui::PAGE_TRANSITION_TYPED);
1537 EXPECT_EQ(orig_rfh, contents()->GetMainFrame()); 1537 EXPECT_EQ(orig_rfh, contents()->GetMainFrame());
1538 1538
1539 // Toggle fullscreen mode on (as if initiated via IPC from renderer). 1539 // Toggle fullscreen mode on (as if initiated via IPC from renderer).
1540 EXPECT_FALSE(contents()->IsFullscreenForCurrentTab(test_rvh()->GetWidget())); 1540 EXPECT_FALSE(contents()->IsFullscreenForCurrentTab());
1541 EXPECT_FALSE(fake_delegate.IsFullscreenForTabOrPending(contents())); 1541 EXPECT_FALSE(fake_delegate.IsFullscreenForTabOrPending(contents()));
1542 orig_rfh->OnMessageReceived( 1542 orig_rfh->OnMessageReceived(
1543 FrameHostMsg_ToggleFullscreen(orig_rfh->GetRoutingID(), true)); 1543 FrameHostMsg_ToggleFullscreen(orig_rfh->GetRoutingID(), true));
1544 EXPECT_TRUE(contents()->IsFullscreenForCurrentTab(test_rvh()->GetWidget())); 1544 EXPECT_TRUE(contents()->IsFullscreenForCurrentTab());
1545 EXPECT_TRUE(fake_delegate.IsFullscreenForTabOrPending(contents())); 1545 EXPECT_TRUE(fake_delegate.IsFullscreenForTabOrPending(contents()));
1546 1546
1547 // Navigate to a new site. 1547 // Navigate to a new site.
1548 const GURL url2("http://www.yahoo.com"); 1548 const GURL url2("http://www.yahoo.com");
1549 controller().LoadURL( 1549 controller().LoadURL(
1550 url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 1550 url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
1551 entry_id = controller().GetPendingEntry()->GetUniqueID(); 1551 entry_id = controller().GetPendingEntry()->GetUniqueID();
1552 contents()->GetMainFrame()->PrepareForCommit(); 1552 contents()->GetMainFrame()->PrepareForCommit();
1553 TestRenderFrameHost* const pending_rfh = contents()->GetPendingMainFrame(); 1553 TestRenderFrameHost* const pending_rfh = contents()->GetPendingMainFrame();
1554 contents()->TestDidNavigate(pending_rfh, 1, entry_id, true, url2, 1554 contents()->TestDidNavigate(pending_rfh, 1, entry_id, true, url2,
1555 ui::PAGE_TRANSITION_TYPED); 1555 ui::PAGE_TRANSITION_TYPED);
1556 1556
1557 // Confirm fullscreen has exited. 1557 // Confirm fullscreen has exited.
1558 EXPECT_FALSE(contents()->IsFullscreenForCurrentTab(test_rvh()->GetWidget())); 1558 EXPECT_FALSE(contents()->IsFullscreenForCurrentTab());
1559 EXPECT_FALSE(fake_delegate.IsFullscreenForTabOrPending(contents())); 1559 EXPECT_FALSE(fake_delegate.IsFullscreenForTabOrPending(contents()));
1560 1560
1561 contents()->SetDelegate(nullptr); 1561 contents()->SetDelegate(nullptr);
1562 } 1562 }
1563 1563
1564 // Tests that fullscreen is exited throughout the object hierarchy when 1564 // Tests that fullscreen is exited throughout the object hierarchy when
1565 // instructing NavigationController to GoBack() or GoForward(). 1565 // instructing NavigationController to GoBack() or GoForward().
1566 TEST_F(WebContentsImplTest, HistoryNavigationExitsFullscreen) { 1566 TEST_F(WebContentsImplTest, HistoryNavigationExitsFullscreen) {
1567 FakeFullscreenDelegate fake_delegate; 1567 FakeFullscreenDelegate fake_delegate;
1568 contents()->SetDelegate(&fake_delegate); 1568 contents()->SetDelegate(&fake_delegate);
(...skipping 14 matching lines...) Expand all
1583 controller().LoadURL( 1583 controller().LoadURL(
1584 url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 1584 url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
1585 entry_id = controller().GetPendingEntry()->GetUniqueID(); 1585 entry_id = controller().GetPendingEntry()->GetUniqueID();
1586 orig_rfh->PrepareForCommit(); 1586 orig_rfh->PrepareForCommit();
1587 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); 1587 EXPECT_FALSE(contents()->CrossProcessNavigationPending());
1588 contents()->TestDidNavigate(orig_rfh, 2, entry_id, true, url2, 1588 contents()->TestDidNavigate(orig_rfh, 2, entry_id, true, url2,
1589 ui::PAGE_TRANSITION_TYPED); 1589 ui::PAGE_TRANSITION_TYPED);
1590 EXPECT_EQ(orig_rfh, contents()->GetMainFrame()); 1590 EXPECT_EQ(orig_rfh, contents()->GetMainFrame());
1591 1591
1592 // Sanity-check: Confirm we're not starting out in fullscreen mode. 1592 // Sanity-check: Confirm we're not starting out in fullscreen mode.
1593 EXPECT_FALSE(contents()->IsFullscreenForCurrentTab(test_rvh()->GetWidget())); 1593 EXPECT_FALSE(contents()->IsFullscreenForCurrentTab());
1594 EXPECT_FALSE(fake_delegate.IsFullscreenForTabOrPending(contents())); 1594 EXPECT_FALSE(fake_delegate.IsFullscreenForTabOrPending(contents()));
1595 1595
1596 for (int i = 0; i < 2; ++i) { 1596 for (int i = 0; i < 2; ++i) {
1597 // Toggle fullscreen mode on (as if initiated via IPC from renderer). 1597 // Toggle fullscreen mode on (as if initiated via IPC from renderer).
1598 orig_rfh->OnMessageReceived( 1598 orig_rfh->OnMessageReceived(
1599 FrameHostMsg_ToggleFullscreen(orig_rfh->GetRoutingID(), true)); 1599 FrameHostMsg_ToggleFullscreen(orig_rfh->GetRoutingID(), true));
1600 EXPECT_TRUE(contents()->IsFullscreenForCurrentTab(test_rvh()->GetWidget())); 1600 EXPECT_TRUE(contents()->IsFullscreenForCurrentTab());
1601 EXPECT_TRUE(fake_delegate.IsFullscreenForTabOrPending(contents())); 1601 EXPECT_TRUE(fake_delegate.IsFullscreenForTabOrPending(contents()));
1602 1602
1603 // Navigate backward (or forward). 1603 // Navigate backward (or forward).
1604 if (i == 0) 1604 if (i == 0)
1605 controller().GoBack(); 1605 controller().GoBack();
1606 else 1606 else
1607 controller().GoForward(); 1607 controller().GoForward();
1608 entry_id = controller().GetPendingEntry()->GetUniqueID(); 1608 entry_id = controller().GetPendingEntry()->GetUniqueID();
1609 orig_rfh->PrepareForCommit(); 1609 orig_rfh->PrepareForCommit();
1610 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); 1610 EXPECT_FALSE(contents()->CrossProcessNavigationPending());
1611 EXPECT_EQ(orig_rfh, contents()->GetMainFrame()); 1611 EXPECT_EQ(orig_rfh, contents()->GetMainFrame());
1612 contents()->TestDidNavigate(orig_rfh, i + 1, entry_id, false, url, 1612 contents()->TestDidNavigate(orig_rfh, i + 1, entry_id, false, url,
1613 ui::PAGE_TRANSITION_FORWARD_BACK); 1613 ui::PAGE_TRANSITION_FORWARD_BACK);
1614 orig_rfh->SimulateNavigationStop(); 1614 orig_rfh->SimulateNavigationStop();
1615 1615
1616 // Confirm fullscreen has exited. 1616 // Confirm fullscreen has exited.
1617 EXPECT_FALSE( 1617 EXPECT_FALSE(contents()->IsFullscreenForCurrentTab());
1618 contents()->IsFullscreenForCurrentTab(test_rvh()->GetWidget()));
1619 EXPECT_FALSE(fake_delegate.IsFullscreenForTabOrPending(contents())); 1618 EXPECT_FALSE(fake_delegate.IsFullscreenForTabOrPending(contents()));
1620 } 1619 }
1621 1620
1622 contents()->SetDelegate(nullptr); 1621 contents()->SetDelegate(nullptr);
1623 } 1622 }
1624 1623
1625 TEST_F(WebContentsImplTest, TerminateHidesValidationMessage) { 1624 TEST_F(WebContentsImplTest, TerminateHidesValidationMessage) {
1626 FakeValidationMessageDelegate fake_delegate; 1625 FakeValidationMessageDelegate fake_delegate;
1627 contents()->SetDelegate(&fake_delegate); 1626 contents()->SetDelegate(&fake_delegate);
1628 EXPECT_FALSE(fake_delegate.hide_validation_message_was_called()); 1627 EXPECT_FALSE(fake_delegate.hide_validation_message_was_called());
(...skipping 18 matching lines...) Expand all
1647 // Navigate to a site. 1646 // Navigate to a site.
1648 const GURL url("http://www.google.com"); 1647 const GURL url("http://www.google.com");
1649 controller().LoadURL( 1648 controller().LoadURL(
1650 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 1649 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
1651 int entry_id = controller().GetPendingEntry()->GetUniqueID(); 1650 int entry_id = controller().GetPendingEntry()->GetUniqueID();
1652 main_test_rfh()->PrepareForCommit(); 1651 main_test_rfh()->PrepareForCommit();
1653 contents()->TestDidNavigate(contents()->GetMainFrame(), 1, entry_id, true, 1652 contents()->TestDidNavigate(contents()->GetMainFrame(), 1, entry_id, true,
1654 url, ui::PAGE_TRANSITION_TYPED); 1653 url, ui::PAGE_TRANSITION_TYPED);
1655 1654
1656 // Toggle fullscreen mode on (as if initiated via IPC from renderer). 1655 // Toggle fullscreen mode on (as if initiated via IPC from renderer).
1657 EXPECT_FALSE(contents()->IsFullscreenForCurrentTab(test_rvh()->GetWidget())); 1656 EXPECT_FALSE(contents()->IsFullscreenForCurrentTab());
1658 EXPECT_FALSE(fake_delegate.IsFullscreenForTabOrPending(contents())); 1657 EXPECT_FALSE(fake_delegate.IsFullscreenForTabOrPending(contents()));
1659 contents()->GetMainFrame()->OnMessageReceived(FrameHostMsg_ToggleFullscreen( 1658 contents()->GetMainFrame()->OnMessageReceived(FrameHostMsg_ToggleFullscreen(
1660 contents()->GetMainFrame()->GetRoutingID(), true)); 1659 contents()->GetMainFrame()->GetRoutingID(), true));
1661 EXPECT_TRUE(contents()->IsFullscreenForCurrentTab(test_rvh()->GetWidget())); 1660 EXPECT_TRUE(contents()->IsFullscreenForCurrentTab());
1662 EXPECT_TRUE(fake_delegate.IsFullscreenForTabOrPending(contents())); 1661 EXPECT_TRUE(fake_delegate.IsFullscreenForTabOrPending(contents()));
1663 1662
1664 // Crash the renderer. 1663 // Crash the renderer.
1665 main_test_rfh()->GetProcess()->SimulateCrash(); 1664 main_test_rfh()->GetProcess()->SimulateCrash();
1666 1665
1667 // Confirm fullscreen has exited. 1666 // Confirm fullscreen has exited.
1668 EXPECT_FALSE(contents()->IsFullscreenForCurrentTab(test_rvh()->GetWidget())); 1667 EXPECT_FALSE(contents()->IsFullscreenForCurrentTab());
1669 EXPECT_FALSE(fake_delegate.IsFullscreenForTabOrPending(contents())); 1668 EXPECT_FALSE(fake_delegate.IsFullscreenForTabOrPending(contents()));
1670 1669
1671 contents()->SetDelegate(nullptr); 1670 contents()->SetDelegate(nullptr);
1672 } 1671 }
1673 1672
1674 //////////////////////////////////////////////////////////////////////////////// 1673 ////////////////////////////////////////////////////////////////////////////////
1675 // Interstitial Tests 1674 // Interstitial Tests
1676 //////////////////////////////////////////////////////////////////////////////// 1675 ////////////////////////////////////////////////////////////////////////////////
1677 1676
1678 // Test navigating to a page (with the navigation initiated from the browser, 1677 // Test navigating to a page (with the navigation initiated from the browser,
(...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after
3461 // An automatic navigation. 3460 // An automatic navigation.
3462 contents()->GetMainFrame()->SendNavigateWithModificationCallback( 3461 contents()->GetMainFrame()->SendNavigateWithModificationCallback(
3463 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); 3462 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture));
3464 3463
3465 EXPECT_EQ(1u, dialog_manager.reset_count()); 3464 EXPECT_EQ(1u, dialog_manager.reset_count());
3466 3465
3467 contents()->SetJavaScriptDialogManagerForTesting(nullptr); 3466 contents()->SetJavaScriptDialogManagerForTesting(nullptr);
3468 } 3467 }
3469 3468
3470 } // namespace content 3469 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/public/browser/screen_orientation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698