OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
10 #endif | 10 #endif |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 CheckActiveWindow(browser_proxy.get()); | 452 CheckActiveWindow(browser_proxy.get()); |
453 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); | 453 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); |
454 EXPECT_EQ(2, tab_count); | 454 EXPECT_EQ(2, tab_count); |
455 EXPECT_EQ(url1_, GetActiveTabURL(1)); | 455 EXPECT_EQ(url1_, GetActiveTabURL(1)); |
456 } | 456 } |
457 | 457 |
458 // Tests that a duplicate history entry is not created when we restore a page | 458 // Tests that a duplicate history entry is not created when we restore a page |
459 // to an existing SiteInstance. (Bug 1230446) | 459 // to an existing SiteInstance. (Bug 1230446) |
460 TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) { | 460 TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) { |
461 const wchar_t kDocRoot[] = L"chrome/test/data"; | 461 const wchar_t kDocRoot[] = L"chrome/test/data"; |
462 scoped_refptr<HTTPTestServer> server = | 462 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); |
463 HTTPTestServer::CreateServer(kDocRoot, NULL); | |
464 ASSERT_TRUE(NULL != server.get()); | 463 ASSERT_TRUE(NULL != server.get()); |
465 GURL http_url1(server->TestServerPage("files/title1.html")); | 464 GURL http_url1(server->TestServerPage("files/title1.html")); |
466 GURL http_url2(server->TestServerPage("files/title2.html")); | 465 GURL http_url2(server->TestServerPage("files/title2.html")); |
467 | 466 |
468 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 467 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
469 ASSERT_TRUE(browser_proxy.get()); | 468 ASSERT_TRUE(browser_proxy.get()); |
470 int tab_count; | 469 int tab_count; |
471 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); | 470 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); |
472 | 471 |
473 // Add a tab | 472 // Add a tab |
(...skipping 25 matching lines...) Expand all Loading... |
499 EXPECT_EQ(http_url2, GetActiveTabURL()); | 498 EXPECT_EQ(http_url2, GetActiveTabURL()); |
500 EXPECT_TRUE(tab->GoBack()); | 499 EXPECT_TRUE(tab->GoBack()); |
501 EXPECT_EQ(http_url1, GetActiveTabURL()); | 500 EXPECT_EQ(http_url1, GetActiveTabURL()); |
502 } | 501 } |
503 | 502 |
504 // Tests that the SiteInstances used for entries in a restored tab's history | 503 // Tests that the SiteInstances used for entries in a restored tab's history |
505 // are given appropriate max page IDs, even if the renderer for the entry | 504 // are given appropriate max page IDs, even if the renderer for the entry |
506 // already exists. (Bug 1204135) | 505 // already exists. (Bug 1204135) |
507 TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { | 506 TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { |
508 const wchar_t kDocRoot[] = L"chrome/test/data"; | 507 const wchar_t kDocRoot[] = L"chrome/test/data"; |
509 scoped_refptr<HTTPTestServer> server = | 508 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); |
510 HTTPTestServer::CreateServer(kDocRoot, NULL); | |
511 ASSERT_TRUE(NULL != server.get()); | 509 ASSERT_TRUE(NULL != server.get()); |
512 GURL http_url1(server->TestServerPage("files/title1.html")); | 510 GURL http_url1(server->TestServerPage("files/title1.html")); |
513 GURL http_url2(server->TestServerPage("files/title2.html")); | 511 GURL http_url2(server->TestServerPage("files/title2.html")); |
514 | 512 |
515 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 513 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
516 ASSERT_TRUE(browser_proxy.get()); | 514 ASSERT_TRUE(browser_proxy.get()); |
517 int tab_count; | 515 int tab_count; |
518 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); | 516 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); |
519 | 517 |
520 // Add a tab | 518 // Add a tab |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 | 639 |
642 // See if content is as expected. | 640 // See if content is as expected. |
643 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, | 641 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, |
644 NULL)); | 642 NULL)); |
645 } | 643 } |
646 | 644 |
647 // Restore tab with special URL in its navigation history, go back to that | 645 // Restore tab with special URL in its navigation history, go back to that |
648 // entry and see that it loads properly. See http://crbug.com/31905 | 646 // entry and see that it loads properly. See http://crbug.com/31905 |
649 TEST_F(TabRestoreUITest, RestoreTabWithSpecialURLOnBack) { | 647 TEST_F(TabRestoreUITest, RestoreTabWithSpecialURLOnBack) { |
650 const wchar_t kDocRoot[] = L"chrome/test/data"; | 648 const wchar_t kDocRoot[] = L"chrome/test/data"; |
651 scoped_refptr<HTTPTestServer> server = | 649 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); |
652 HTTPTestServer::CreateServer(kDocRoot, NULL); | |
653 ASSERT_TRUE(server.get()); | 650 ASSERT_TRUE(server.get()); |
654 const GURL http_url(server->TestServerPage("files/title1.html")); | 651 const GURL http_url(server->TestServerPage("files/title1.html")); |
655 | 652 |
656 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 653 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
657 ASSERT_TRUE(browser.get()); | 654 ASSERT_TRUE(browser.get()); |
658 CheckActiveWindow(browser.get()); | 655 CheckActiveWindow(browser.get()); |
659 | 656 |
660 // Navigate new tab to a special URL. | 657 // Navigate new tab to a special URL. |
661 const GURL special_url(chrome::kAboutCreditsURL); | 658 const GURL special_url(chrome::kAboutCreditsURL); |
662 ASSERT_TRUE(browser->AppendTab(special_url)); | 659 ASSERT_TRUE(browser->AppendTab(special_url)); |
(...skipping 13 matching lines...) Expand all Loading... |
676 ASSERT_TRUE(tab->WaitForTabToBeRestored(action_timeout_ms())); | 673 ASSERT_TRUE(tab->WaitForTabToBeRestored(action_timeout_ms())); |
677 GURL url; | 674 GURL url; |
678 ASSERT_TRUE(tab->GetCurrentURL(&url)); | 675 ASSERT_TRUE(tab->GetCurrentURL(&url)); |
679 ASSERT_EQ(http_url, url); | 676 ASSERT_EQ(http_url, url); |
680 | 677 |
681 // Go back, and see if content is as expected. | 678 // Go back, and see if content is as expected. |
682 ASSERT_TRUE(tab->GoBack()); | 679 ASSERT_TRUE(tab->GoBack()); |
683 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, | 680 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, |
684 NULL)); | 681 NULL)); |
685 } | 682 } |
OLD | NEW |