OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 EXPECT_TRUE(url == url1_); | 595 EXPECT_TRUE(url == url1_); |
596 | 596 |
597 restored_tab_proxy = browser_proxy->GetTab(initial_tab_count + 1); | 597 restored_tab_proxy = browser_proxy->GetTab(initial_tab_count + 1); |
598 ASSERT_TRUE(restored_tab_proxy.get()); | 598 ASSERT_TRUE(restored_tab_proxy.get()); |
599 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored( | 599 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored( |
600 TestTimeouts::action_timeout_ms())); | 600 TestTimeouts::action_timeout_ms())); |
601 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); | 601 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); |
602 EXPECT_TRUE(url == url2_); | 602 EXPECT_TRUE(url == url2_); |
603 } | 603 } |
604 | 604 |
605 // Restore tab with special URL about:credits and make sure the page loads | 605 // Restore tab with special URL chrome://credits/ and make sure the page loads |
606 // properly after restore. See http://crbug.com/31905. | 606 // properly after restore. See http://crbug.com/31905. |
607 TEST_F(TabRestoreUITest, RestoreTabWithSpecialURL) { | 607 TEST_F(TabRestoreUITest, RestoreTabWithSpecialURL) { |
608 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 608 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
609 ASSERT_TRUE(browser.get()); | 609 ASSERT_TRUE(browser.get()); |
610 CheckActiveWindow(browser.get()); | 610 CheckActiveWindow(browser.get()); |
611 | 611 |
612 // Navigate new tab to a special URL. | 612 // Navigate new tab to a special URL. |
613 const GURL special_url(chrome::kAboutCreditsURL); | 613 const GURL special_url(chrome::kChromeUICreditsURL); |
614 ASSERT_TRUE(browser->AppendTab(special_url)); | 614 ASSERT_TRUE(browser->AppendTab(special_url)); |
615 scoped_refptr<TabProxy> tab(browser->GetActiveTab()); | 615 scoped_refptr<TabProxy> tab(browser->GetActiveTab()); |
616 ASSERT_TRUE(tab.get()); | 616 ASSERT_TRUE(tab.get()); |
617 | 617 |
618 // Close the tab. | 618 // Close the tab. |
619 ASSERT_TRUE(tab->Close(true)); | 619 ASSERT_TRUE(tab->Close(true)); |
620 | 620 |
621 // Restore the closed tab. | 621 // Restore the closed tab. |
622 RestoreTab(0, 1); | 622 RestoreTab(0, 1); |
623 tab = browser->GetTab(1); | 623 tab = browser->GetTab(1); |
(...skipping 12 matching lines...) Expand all Loading... |
636 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 636 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
637 ASSERT_TRUE(test_server.Start()); | 637 ASSERT_TRUE(test_server.Start()); |
638 | 638 |
639 const GURL http_url(test_server.GetURL("files/title1.html")); | 639 const GURL http_url(test_server.GetURL("files/title1.html")); |
640 | 640 |
641 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 641 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
642 ASSERT_TRUE(browser.get()); | 642 ASSERT_TRUE(browser.get()); |
643 CheckActiveWindow(browser.get()); | 643 CheckActiveWindow(browser.get()); |
644 | 644 |
645 // Navigate new tab to a special URL. | 645 // Navigate new tab to a special URL. |
646 const GURL special_url(chrome::kAboutCreditsURL); | 646 const GURL special_url(chrome::kChromeUICreditsURL); |
647 ASSERT_TRUE(browser->AppendTab(special_url)); | 647 ASSERT_TRUE(browser->AppendTab(special_url)); |
648 scoped_refptr<TabProxy> tab(browser->GetActiveTab()); | 648 scoped_refptr<TabProxy> tab(browser->GetActiveTab()); |
649 ASSERT_TRUE(tab.get()); | 649 ASSERT_TRUE(tab.get()); |
650 | 650 |
651 // Then navigate to a normal URL. | 651 // Then navigate to a normal URL. |
652 ASSERT_TRUE(tab->NavigateToURL(http_url)); | 652 ASSERT_TRUE(tab->NavigateToURL(http_url)); |
653 | 653 |
654 // Close the tab. | 654 // Close the tab. |
655 ASSERT_TRUE(tab->Close(true)); | 655 ASSERT_TRUE(tab->Close(true)); |
656 | 656 |
657 // Restore the closed tab. | 657 // Restore the closed tab. |
658 RestoreTab(0, 1); | 658 RestoreTab(0, 1); |
659 tab = browser->GetTab(1); | 659 tab = browser->GetTab(1); |
660 ASSERT_TRUE(tab.get()); | 660 ASSERT_TRUE(tab.get()); |
661 ASSERT_TRUE(tab->WaitForTabToBeRestored(TestTimeouts::action_timeout_ms())); | 661 ASSERT_TRUE(tab->WaitForTabToBeRestored(TestTimeouts::action_timeout_ms())); |
662 GURL url; | 662 GURL url; |
663 ASSERT_TRUE(tab->GetCurrentURL(&url)); | 663 ASSERT_TRUE(tab->GetCurrentURL(&url)); |
664 ASSERT_EQ(http_url, url); | 664 ASSERT_EQ(http_url, url); |
665 | 665 |
666 // Go back, and see if content is as expected. | 666 // Go back, and see if content is as expected. |
667 ASSERT_TRUE(tab->GoBack()); | 667 ASSERT_TRUE(tab->GoBack()); |
668 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, | 668 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, |
669 NULL)); | 669 NULL)); |
670 } | 670 } |
OLD | NEW |