| 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 CheckActiveWindow(browser_proxy.get()); | 438 CheckActiveWindow(browser_proxy.get()); |
| 439 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); | 439 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); |
| 440 EXPECT_EQ(2, tab_count); | 440 EXPECT_EQ(2, tab_count); |
| 441 EXPECT_EQ(url1_, GetActiveTabURL(1)); | 441 EXPECT_EQ(url1_, GetActiveTabURL(1)); |
| 442 } | 442 } |
| 443 | 443 |
| 444 // Tests that a duplicate history entry is not created when we restore a page | 444 // Tests that a duplicate history entry is not created when we restore a page |
| 445 // to an existing SiteInstance. (Bug 1230446) | 445 // to an existing SiteInstance. (Bug 1230446) |
| 446 TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) { | 446 TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) { |
| 447 net::TestServer test_server(net::TestServer::TYPE_HTTP, | 447 net::TestServer test_server(net::TestServer::TYPE_HTTP, |
| 448 net::TestServer::kLocalhost, |
| 448 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 449 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| 449 ASSERT_TRUE(test_server.Start()); | 450 ASSERT_TRUE(test_server.Start()); |
| 450 | 451 |
| 451 GURL http_url1(test_server.GetURL("files/title1.html")); | 452 GURL http_url1(test_server.GetURL("files/title1.html")); |
| 452 GURL http_url2(test_server.GetURL("files/title2.html")); | 453 GURL http_url2(test_server.GetURL("files/title2.html")); |
| 453 | 454 |
| 454 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 455 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
| 455 ASSERT_TRUE(browser_proxy.get()); | 456 ASSERT_TRUE(browser_proxy.get()); |
| 456 int tab_count; | 457 int tab_count; |
| 457 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); | 458 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 485 EXPECT_EQ(http_url2, GetActiveTabURL()); | 486 EXPECT_EQ(http_url2, GetActiveTabURL()); |
| 486 EXPECT_TRUE(tab->GoBack()); | 487 EXPECT_TRUE(tab->GoBack()); |
| 487 EXPECT_EQ(http_url1, GetActiveTabURL()); | 488 EXPECT_EQ(http_url1, GetActiveTabURL()); |
| 488 } | 489 } |
| 489 | 490 |
| 490 // Tests that the SiteInstances used for entries in a restored tab's history | 491 // Tests that the SiteInstances used for entries in a restored tab's history |
| 491 // are given appropriate max page IDs, even if the renderer for the entry | 492 // are given appropriate max page IDs, even if the renderer for the entry |
| 492 // already exists. (Bug 1204135) | 493 // already exists. (Bug 1204135) |
| 493 TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { | 494 TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) { |
| 494 net::TestServer test_server(net::TestServer::TYPE_HTTP, | 495 net::TestServer test_server(net::TestServer::TYPE_HTTP, |
| 496 net::TestServer::kLocalhost, |
| 495 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 497 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| 496 ASSERT_TRUE(test_server.Start()); | 498 ASSERT_TRUE(test_server.Start()); |
| 497 | 499 |
| 498 GURL http_url1(test_server.GetURL("files/title1.html")); | 500 GURL http_url1(test_server.GetURL("files/title1.html")); |
| 499 GURL http_url2(test_server.GetURL("files/title2.html")); | 501 GURL http_url2(test_server.GetURL("files/title2.html")); |
| 500 | 502 |
| 501 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 503 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
| 502 ASSERT_TRUE(browser_proxy.get()); | 504 ASSERT_TRUE(browser_proxy.get()); |
| 503 int tab_count; | 505 int tab_count; |
| 504 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); | 506 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 | 629 |
| 628 // See if content is as expected. | 630 // See if content is as expected. |
| 629 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, | 631 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, |
| 630 NULL)); | 632 NULL)); |
| 631 } | 633 } |
| 632 | 634 |
| 633 // Restore tab with special URL in its navigation history, go back to that | 635 // Restore tab with special URL in its navigation history, go back to that |
| 634 // entry and see that it loads properly. See http://crbug.com/31905 | 636 // entry and see that it loads properly. See http://crbug.com/31905 |
| 635 TEST_F(TabRestoreUITest, RestoreTabWithSpecialURLOnBack) { | 637 TEST_F(TabRestoreUITest, RestoreTabWithSpecialURLOnBack) { |
| 636 net::TestServer test_server(net::TestServer::TYPE_HTTP, | 638 net::TestServer test_server(net::TestServer::TYPE_HTTP, |
| 639 net::TestServer::kLocalhost, |
| 637 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 640 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| 638 ASSERT_TRUE(test_server.Start()); | 641 ASSERT_TRUE(test_server.Start()); |
| 639 | 642 |
| 640 const GURL http_url(test_server.GetURL("files/title1.html")); | 643 const GURL http_url(test_server.GetURL("files/title1.html")); |
| 641 | 644 |
| 642 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 645 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 643 ASSERT_TRUE(browser.get()); | 646 ASSERT_TRUE(browser.get()); |
| 644 CheckActiveWindow(browser.get()); | 647 CheckActiveWindow(browser.get()); |
| 645 | 648 |
| 646 // Navigate new tab to a special URL. | 649 // Navigate new tab to a special URL. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 662 ASSERT_TRUE(tab->WaitForTabToBeRestored(TestTimeouts::action_timeout_ms())); | 665 ASSERT_TRUE(tab->WaitForTabToBeRestored(TestTimeouts::action_timeout_ms())); |
| 663 GURL url; | 666 GURL url; |
| 664 ASSERT_TRUE(tab->GetCurrentURL(&url)); | 667 ASSERT_TRUE(tab->GetCurrentURL(&url)); |
| 665 ASSERT_EQ(http_url, url); | 668 ASSERT_EQ(http_url, url); |
| 666 | 669 |
| 667 // Go back, and see if content is as expected. | 670 // Go back, and see if content is as expected. |
| 668 ASSERT_TRUE(tab->GoBack()); | 671 ASSERT_TRUE(tab->GoBack()); |
| 669 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, | 672 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, |
| 670 NULL)); | 673 NULL)); |
| 671 } | 674 } |
| OLD | NEW |