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

Side by Side Diff: chrome/browser/tab_restore_uitest.cc

Issue 6282002: Remove action_timeout_ms and fix all the callers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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) 2010 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 "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/common/chrome_paths.h" 10 #include "chrome/common/chrome_paths.h"
10 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
11 #include "chrome/test/automation/tab_proxy.h" 12 #include "chrome/test/automation/tab_proxy.h"
12 #include "chrome/test/automation/browser_proxy.h" 13 #include "chrome/test/automation/browser_proxy.h"
13 #include "chrome/test/automation/window_proxy.h" 14 #include "chrome/test/automation/window_proxy.h"
14 #include "chrome/test/ui/ui_test.h" 15 #include "chrome/test/ui/ui_test.h"
15 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
16 #include "net/base/net_util.h" 17 #include "net/base/net_util.h"
17 #include "net/test/test_server.h" 18 #include "net/test/test_server.h"
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 EXPECT_EQ(window_count, new_window_count); 592 EXPECT_EQ(window_count, new_window_count);
592 593
593 browser_proxy = automation()->GetBrowserWindow(1); 594 browser_proxy = automation()->GetBrowserWindow(1);
594 int tab_count; 595 int tab_count;
595 EXPECT_TRUE(browser_proxy->GetTabCount(&tab_count)); 596 EXPECT_TRUE(browser_proxy->GetTabCount(&tab_count));
596 EXPECT_EQ(initial_tab_count + 2, tab_count); 597 EXPECT_EQ(initial_tab_count + 2, tab_count);
597 598
598 scoped_refptr<TabProxy> restored_tab_proxy( 599 scoped_refptr<TabProxy> restored_tab_proxy(
599 browser_proxy->GetTab(initial_tab_count)); 600 browser_proxy->GetTab(initial_tab_count));
600 ASSERT_TRUE(restored_tab_proxy.get()); 601 ASSERT_TRUE(restored_tab_proxy.get());
601 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); 602 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(
603 TestTimeouts::action_timeout_ms()));
602 GURL url; 604 GURL url;
603 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); 605 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url));
604 EXPECT_TRUE(url == url1_); 606 EXPECT_TRUE(url == url1_);
605 607
606 restored_tab_proxy = browser_proxy->GetTab(initial_tab_count + 1); 608 restored_tab_proxy = browser_proxy->GetTab(initial_tab_count + 1);
607 ASSERT_TRUE(restored_tab_proxy.get()); 609 ASSERT_TRUE(restored_tab_proxy.get());
608 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); 610 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(
611 TestTimeouts::action_timeout_ms()));
609 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); 612 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url));
610 EXPECT_TRUE(url == url2_); 613 EXPECT_TRUE(url == url2_);
611 } 614 }
612 615
613 // Restore tab with special URL about:credits and make sure the page loads 616 // Restore tab with special URL about:credits and make sure the page loads
614 // properly after restore. See http://crbug.com/31905. 617 // properly after restore. See http://crbug.com/31905.
615 TEST_F(TabRestoreUITest, RestoreTabWithSpecialURL) { 618 TEST_F(TabRestoreUITest, RestoreTabWithSpecialURL) {
616 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 619 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
617 ASSERT_TRUE(browser.get()); 620 ASSERT_TRUE(browser.get());
618 CheckActiveWindow(browser.get()); 621 CheckActiveWindow(browser.get());
619 622
620 // Navigate new tab to a special URL. 623 // Navigate new tab to a special URL.
621 const GURL special_url(chrome::kAboutCreditsURL); 624 const GURL special_url(chrome::kAboutCreditsURL);
622 ASSERT_TRUE(browser->AppendTab(special_url)); 625 ASSERT_TRUE(browser->AppendTab(special_url));
623 scoped_refptr<TabProxy> tab(browser->GetActiveTab()); 626 scoped_refptr<TabProxy> tab(browser->GetActiveTab());
624 ASSERT_TRUE(tab.get()); 627 ASSERT_TRUE(tab.get());
625 628
626 // Close the tab. 629 // Close the tab.
627 ASSERT_TRUE(tab->Close(true)); 630 ASSERT_TRUE(tab->Close(true));
628 631
629 // Restore the closed tab. 632 // Restore the closed tab.
630 RestoreTab(0, 1); 633 RestoreTab(0, 1);
631 tab = browser->GetTab(1); 634 tab = browser->GetTab(1);
632 ASSERT_TRUE(tab.get()); 635 ASSERT_TRUE(tab.get());
633 ASSERT_TRUE(tab->WaitForTabToBeRestored(action_timeout_ms())); 636 ASSERT_TRUE(tab->WaitForTabToBeRestored(TestTimeouts::action_timeout_ms()));
634 637
635 // See if content is as expected. 638 // See if content is as expected.
636 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, 639 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false,
637 NULL)); 640 NULL));
638 } 641 }
639 642
640 // Restore tab with special URL in its navigation history, go back to that 643 // Restore tab with special URL in its navigation history, go back to that
641 // entry and see that it loads properly. See http://crbug.com/31905 644 // entry and see that it loads properly. See http://crbug.com/31905
642 TEST_F(TabRestoreUITest, RestoreTabWithSpecialURLOnBack) { 645 TEST_F(TabRestoreUITest, RestoreTabWithSpecialURLOnBack) {
643 net::TestServer test_server(net::TestServer::TYPE_HTTP, 646 net::TestServer test_server(net::TestServer::TYPE_HTTP,
(...skipping 15 matching lines...) Expand all
659 // Then navigate to a normal URL. 662 // Then navigate to a normal URL.
660 ASSERT_TRUE(tab->NavigateToURL(http_url)); 663 ASSERT_TRUE(tab->NavigateToURL(http_url));
661 664
662 // Close the tab. 665 // Close the tab.
663 ASSERT_TRUE(tab->Close(true)); 666 ASSERT_TRUE(tab->Close(true));
664 667
665 // Restore the closed tab. 668 // Restore the closed tab.
666 RestoreTab(0, 1); 669 RestoreTab(0, 1);
667 tab = browser->GetTab(1); 670 tab = browser->GetTab(1);
668 ASSERT_TRUE(tab.get()); 671 ASSERT_TRUE(tab.get());
669 ASSERT_TRUE(tab->WaitForTabToBeRestored(action_timeout_ms())); 672 ASSERT_TRUE(tab->WaitForTabToBeRestored(TestTimeouts::action_timeout_ms()));
670 GURL url; 673 GURL url;
671 ASSERT_TRUE(tab->GetCurrentURL(&url)); 674 ASSERT_TRUE(tab->GetCurrentURL(&url));
672 ASSERT_EQ(http_url, url); 675 ASSERT_EQ(http_url, url);
673 676
674 // Go back, and see if content is as expected. 677 // Go back, and see if content is as expected.
675 ASSERT_TRUE(tab->GoBack()); 678 ASSERT_TRUE(tab->GoBack());
676 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, 679 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false,
677 NULL)); 680 NULL));
678 } 681 }
OLDNEW
« no previous file with comments | « chrome/browser/process_singleton_linux_uitest.cc ('k') | chrome/test/automated_ui_tests/automated_ui_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698