| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 10 matching lines...) Expand all Loading... |
| 21 #include "net/base/net_util.h" | 21 #include "net/base/net_util.h" |
| 22 #include "net/url_request/url_request_unittest.h" | 22 #include "net/url_request/url_request_unittest.h" |
| 23 | 23 |
| 24 // http://code.google.com/p/chromium/issues/detail?id=14774 | 24 // http://code.google.com/p/chromium/issues/detail?id=14774 |
| 25 #if defined(OS_WIN) && !defined(NDEBUG) | 25 #if defined(OS_WIN) && !defined(NDEBUG) |
| 26 #define MAYBE_BasicRestoreFromClosedWindow DISABLED_BasicRestoreFromClosedWindow | 26 #define MAYBE_BasicRestoreFromClosedWindow DISABLED_BasicRestoreFromClosedWindow |
| 27 #else | 27 #else |
| 28 #define MAYBE_BasicRestoreFromClosedWindow BasicRestoreFromClosedWindow | 28 #define MAYBE_BasicRestoreFromClosedWindow BasicRestoreFromClosedWindow |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 // http://crbug.com/ |
| 32 #if defined(OS_CHROMEOS) && !defined(NDEBUG) |
| 33 #define MAYBE_RestoreWindowAndTab DISABLED_RestoreWindowAndTab |
| 34 #define MAYBE_RestoreWindow DISABLED_RestoreWindow |
| 35 #else |
| 36 #define MAYBE_RestoreWindowAndTab RestoreWindowAndTab |
| 37 #define MAYBE_RestoreWindow RestoreWindow |
| 38 #endif |
| 39 |
| 31 class TabRestoreUITest : public UITest { | 40 class TabRestoreUITest : public UITest { |
| 32 public: | 41 public: |
| 33 TabRestoreUITest() : UITest() { | 42 TabRestoreUITest() : UITest() { |
| 34 FilePath path_prefix(test_data_directory_); | 43 FilePath path_prefix(test_data_directory_); |
| 35 path_prefix = path_prefix.AppendASCII("session_history"); | 44 path_prefix = path_prefix.AppendASCII("session_history"); |
| 36 url1_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot1.html")); | 45 url1_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot1.html")); |
| 37 url2_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot2.html")); | 46 url2_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot2.html")); |
| 38 } | 47 } |
| 39 | 48 |
| 40 protected: | 49 protected: |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 337 |
| 329 // Make sure that there's nothing else to restore. | 338 // Make sure that there's nothing else to restore. |
| 330 bool enabled; | 339 bool enabled; |
| 331 ASSERT_TRUE(browser_proxy->IsPageMenuCommandEnabled(IDC_RESTORE_TAB, | 340 ASSERT_TRUE(browser_proxy->IsPageMenuCommandEnabled(IDC_RESTORE_TAB, |
| 332 &enabled)); | 341 &enabled)); |
| 333 EXPECT_FALSE(enabled); | 342 EXPECT_FALSE(enabled); |
| 334 } | 343 } |
| 335 | 344 |
| 336 // Open a window with multiple tabs, close a tab, then close the window. | 345 // Open a window with multiple tabs, close a tab, then close the window. |
| 337 // Restore both and make sure the tab goes back into the window. | 346 // Restore both and make sure the tab goes back into the window. |
| 338 TEST_F(TabRestoreUITest, RestoreWindowAndTab) { | 347 TEST_F(TabRestoreUITest, MAYBE_RestoreWindowAndTab) { |
| 339 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 348 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
| 340 ASSERT_TRUE(browser_proxy.get()); | 349 ASSERT_TRUE(browser_proxy.get()); |
| 341 CheckActiveWindow(browser_proxy.get()); | 350 CheckActiveWindow(browser_proxy.get()); |
| 342 | 351 |
| 343 int starting_tab_count; | 352 int starting_tab_count; |
| 344 ASSERT_TRUE(browser_proxy->GetTabCount(&starting_tab_count)); | 353 ASSERT_TRUE(browser_proxy->GetTabCount(&starting_tab_count)); |
| 345 int tab_count = AddSomeTabs(browser_proxy.get(), 3); | 354 int tab_count = AddSomeTabs(browser_proxy.get(), 3); |
| 346 | 355 |
| 347 // Close one in the middle | 356 // Close one in the middle |
| 348 int closed_tab_index = starting_tab_count + 1; | 357 int closed_tab_index = starting_tab_count + 1; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 EXPECT_TRUE(tab->GoBack()); | 550 EXPECT_TRUE(tab->GoBack()); |
| 542 EXPECT_EQ(http_url1, GetActiveTabURL()); | 551 EXPECT_EQ(http_url1, GetActiveTabURL()); |
| 543 | 552 |
| 544 // Navigating to a new URL should clear the forward list, because the max | 553 // Navigating to a new URL should clear the forward list, because the max |
| 545 // page ID of the renderer should have been updated when we restored the tab. | 554 // page ID of the renderer should have been updated when we restored the tab. |
| 546 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(http_url2)); | 555 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(http_url2)); |
| 547 EXPECT_FALSE(tab->GoForward()); | 556 EXPECT_FALSE(tab->GoForward()); |
| 548 EXPECT_EQ(http_url2, GetActiveTabURL()); | 557 EXPECT_EQ(http_url2, GetActiveTabURL()); |
| 549 } | 558 } |
| 550 | 559 |
| 551 TEST_F(TabRestoreUITest, RestoreWindow) { | 560 TEST_F(TabRestoreUITest, MAYBE_RestoreWindow) { |
| 552 // Create a new window. | 561 // Create a new window. |
| 553 int window_count; | 562 int window_count; |
| 554 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 563 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 555 ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, false)); | 564 ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, false)); |
| 556 int new_window_count = 0; | 565 int new_window_count = 0; |
| 557 ASSERT_TRUE(automation()->GetBrowserWindowCount(&new_window_count)); | 566 ASSERT_TRUE(automation()->GetBrowserWindowCount(&new_window_count)); |
| 558 EXPECT_EQ(++window_count, new_window_count); | 567 EXPECT_EQ(++window_count, new_window_count); |
| 559 | 568 |
| 560 // Create two more tabs, one with url1, the other url2. | 569 // Create two more tabs, one with url1, the other url2. |
| 561 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 570 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 ASSERT_TRUE(tab->WaitForTabToBeRestored(action_timeout_ms())); | 677 ASSERT_TRUE(tab->WaitForTabToBeRestored(action_timeout_ms())); |
| 669 GURL url; | 678 GURL url; |
| 670 ASSERT_TRUE(tab->GetCurrentURL(&url)); | 679 ASSERT_TRUE(tab->GetCurrentURL(&url)); |
| 671 ASSERT_EQ(http_url, url); | 680 ASSERT_EQ(http_url, url); |
| 672 | 681 |
| 673 // Go back, and see if content is as expected. | 682 // Go back, and see if content is as expected. |
| 674 ASSERT_TRUE(tab->GoBack()); | 683 ASSERT_TRUE(tab->GoBack()); |
| 675 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, | 684 EXPECT_TRUE(tab->FindInPage(std::wstring(L"webkit"), FWD, IGNORE_CASE, false, |
| 676 NULL)); | 685 NULL)); |
| 677 } | 686 } |
| OLD | NEW |