summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_commands_unittest.cc
diff options
context:
space:
mode:
authornasko@chromium.org <nasko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-18 19:10:18 +0000
committernasko@chromium.org <nasko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-18 19:10:18 +0000
commite022aca953e7090d865ad2766602e6975e33fc42 (patch)
tree0739686c02292015e78363fc185e2be65df429e9 /chrome/browser/browser_commands_unittest.cc
parent52a1cc300a1b9354a6888cbe3533def2225d59ea (diff)
downloadchromium_src-e022aca953e7090d865ad2766602e6975e33fc42.zip
chromium_src-e022aca953e7090d865ad2766602e6975e33fc42.tar.gz
chromium_src-e022aca953e7090d865ad2766602e6975e33fc42.tar.bz2
Move BrowserCommandsTest to new WebContents URL API
Converting BrowserCommandsTest to use GetLastCommittedURL instead of GetURL. BUG=237908 Review URL: https://chromiumcodereview.appspot.com/18569005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_commands_unittest.cc')
-rw-r--r--chrome/browser/browser_commands_unittest.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/chrome/browser/browser_commands_unittest.cc b/chrome/browser/browser_commands_unittest.cc
index 298b488..22d83d5 100644
--- a/chrome/browser/browser_commands_unittest.cc
+++ b/chrome/browser/browser_commands_unittest.cc
@@ -167,15 +167,17 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) {
EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
ASSERT_EQ(2, browser()->tab_strip_model()->count());
- // The original tab should be unchanged.
WebContents* zeroth = browser()->tab_strip_model()->GetWebContentsAt(0);
- EXPECT_EQ(url2, zeroth->GetURL());
+ WebContents* first = browser()->tab_strip_model()->GetWebContentsAt(1);
+
+ // The original tab should be unchanged.
+ EXPECT_EQ(url2, zeroth->GetLastCommittedURL());
EXPECT_TRUE(zeroth->GetController().CanGoBack());
EXPECT_FALSE(zeroth->GetController().CanGoForward());
- // The new tab should be like the first one but navigated back.
- WebContents* first = browser()->tab_strip_model()->GetWebContentsAt(1);
- EXPECT_EQ(url1, browser()->tab_strip_model()->GetWebContentsAt(1)->GetURL());
+ // The new tab should be like the first one but navigated back. Since we
+ // didn't wait for the load to complete, we can't use GetLastCommittedURL.
+ EXPECT_EQ(url1, first->GetActiveURL());
EXPECT_FALSE(first->GetController().CanGoBack());
EXPECT_TRUE(first->GetController().CanGoForward());
@@ -190,7 +192,7 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) {
chrome::GoForward(browser(), NEW_BACKGROUND_TAB);
// The previous tab should be unchanged and still in the foreground.
- EXPECT_EQ(url1, first->GetURL());
+ EXPECT_EQ(url1, first->GetLastCommittedURL());
EXPECT_FALSE(first->GetController().CanGoBack());
EXPECT_TRUE(first->GetController().CanGoForward());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
@@ -198,7 +200,9 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) {
// There should be a new tab navigated forward.
ASSERT_EQ(3, browser()->tab_strip_model()->count());
WebContents* second = browser()->tab_strip_model()->GetWebContentsAt(2);
- EXPECT_EQ(url2, second->GetURL());
+ // Since we didn't wait for load to complete, we can't use
+ // GetLastCommittedURL.
+ EXPECT_EQ(url2, second->GetActiveURL());
EXPECT_TRUE(second->GetController().CanGoBack());
EXPECT_FALSE(second->GetController().CanGoForward());
@@ -210,7 +214,8 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) {
chrome::GoBack(browser(), NEW_FOREGROUND_TAB);
ASSERT_EQ(3, browser()->tab_strip_model()->active_index());
ASSERT_EQ(url1,
- browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
+ browser()->tab_strip_model()->GetActiveWebContents()->
+ GetActiveURL());
// Same thing again for forward.
// TODO(brettw) bug 11055: see the comment above about why we need this.
@@ -219,6 +224,6 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) {
chrome::GoForward(browser(), NEW_FOREGROUND_TAB);
ASSERT_EQ(4, browser()->tab_strip_model()->active_index());
ASSERT_EQ(url2,
- browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
+ browser()->tab_strip_model()->GetActiveWebContents()->
+ GetActiveURL());
}
-