| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 | 469 |
| 470 std::vector<GURL> urls(GetHistoryContents()); | 470 std::vector<GURL> urls(GetHistoryContents()); |
| 471 ASSERT_EQ(2u, urls.size()); | 471 ASSERT_EQ(2u, urls.size()); |
| 472 ASSERT_EQ(target, urls[0]); | 472 ASSERT_EQ(target, urls[0]); |
| 473 ASSERT_EQ(form, urls[1]); | 473 ASSERT_EQ(form, urls[1]); |
| 474 } | 474 } |
| 475 | 475 |
| 476 // Verify history shortcut opens only one history tab per window. Also, make | 476 // Verify history shortcut opens only one history tab per window. Also, make |
| 477 // sure that existing history tab is activated. | 477 // sure that existing history tab is activated. |
| 478 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, OneHistoryTabPerWindow) { | 478 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, OneHistoryTabPerWindow) { |
| 479 GURL history_url("chrome://chrome/history/"); | 479 GURL history_url(chrome::kChromeUIHistoryURL); |
| 480 | 480 |
| 481 // Even after navigate completes, the currently-active tab title is | 481 // Even after navigate completes, the currently-active tab title is |
| 482 // 'Loading...' for a brief time while the history page loads. | 482 // 'Loading...' for a brief time while the history page loads. |
| 483 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); | 483 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
| 484 string16 expected_title(ASCIIToUTF16("History")); | 484 string16 expected_title(ASCIIToUTF16("History")); |
| 485 content::TitleWatcher title_watcher(web_contents, expected_title); | 485 content::TitleWatcher title_watcher(web_contents, expected_title); |
| 486 chrome::ExecuteCommand(browser(), IDC_SHOW_HISTORY); | 486 chrome::ExecuteCommand(browser(), IDC_SHOW_HISTORY); |
| 487 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 487 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
| 488 | 488 |
| 489 ui_test_utils::NavigateToURLWithDisposition( | 489 ui_test_utils::NavigateToURLWithDisposition( |
| 490 browser(), GURL(chrome::kAboutBlankURL), NEW_FOREGROUND_TAB, | 490 browser(), GURL(chrome::kAboutBlankURL), NEW_FOREGROUND_TAB, |
| 491 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 491 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 492 chrome::ExecuteCommand(browser(), IDC_SHOW_HISTORY); | 492 chrome::ExecuteCommand(browser(), IDC_SHOW_HISTORY); |
| 493 | 493 |
| 494 content::WebContents* active_web_contents = | 494 content::WebContents* active_web_contents = |
| 495 chrome::GetActiveWebContents(browser()); | 495 chrome::GetActiveWebContents(browser()); |
| 496 ASSERT_EQ(web_contents, active_web_contents); | 496 ASSERT_EQ(web_contents, active_web_contents); |
| 497 ASSERT_EQ(history_url, active_web_contents->GetURL()); | 497 ASSERT_EQ(history_url, active_web_contents->GetURL()); |
| 498 | 498 |
| 499 TabContents* second_tab = browser()->tab_strip_model()->GetTabContentsAt(1); | 499 TabContents* second_tab = browser()->tab_strip_model()->GetTabContentsAt(1); |
| 500 ASSERT_NE(history_url, second_tab->web_contents()->GetURL()); | 500 ASSERT_NE(history_url, second_tab->web_contents()->GetURL()); |
| 501 } | 501 } |
| OLD | NEW |