| 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 |
| 11 #include "chrome/app/chrome_dll_resource.h" | 11 #include "chrome/app/chrome_dll_resource.h" |
| 12 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 15 #include "chrome/test/automation/tab_proxy.h" | 15 #include "chrome/test/automation/tab_proxy.h" |
| 16 #include "chrome/test/automation/browser_proxy.h" | 16 #include "chrome/test/automation/browser_proxy.h" |
| 17 #include "chrome/test/automation/window_proxy.h" | 17 #include "chrome/test/automation/window_proxy.h" |
| 18 #include "chrome/test/ui/ui_test.h" | 18 #include "chrome/test/ui/ui_test.h" |
| 19 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| 20 #include "net/base/net_util.h" | 20 #include "net/base/net_util.h" |
| 21 #include "net/url_request/url_request_unittest.h" | 21 #include "net/url_request/url_request_unittest.h" |
| 22 | 22 |
| 23 // http://code.google.com/p/chromium/issues/detail?id=14774 |
| 24 #if defined(OS_WIN) && !defined(NDEBUG) |
| 25 #define MAYBE_BasicRestoreFromClosedWindow DISABLED_BasicRestoreFromClosedWindow |
| 26 #else |
| 27 #define MAYBE_BasicRestoreFromClosedWindow BasicRestoreFromClosedWindow |
| 28 #endif |
| 29 |
| 23 class TabRestoreUITest : public UITest { | 30 class TabRestoreUITest : public UITest { |
| 24 public: | 31 public: |
| 25 TabRestoreUITest() : UITest() { | 32 TabRestoreUITest() : UITest() { |
| 26 FilePath path_prefix(test_data_directory_); | 33 FilePath path_prefix(test_data_directory_); |
| 27 path_prefix = path_prefix.AppendASCII("session_history"); | 34 path_prefix = path_prefix.AppendASCII("session_history"); |
| 28 url1_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot1.html")); | 35 url1_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot1.html")); |
| 29 url2_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot2.html")); | 36 url2_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot2.html")); |
| 30 } | 37 } |
| 31 | 38 |
| 32 protected: | 39 protected: |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 // And make sure everything looks right. | 235 // And make sure everything looks right. |
| 229 CheckActiveWindow(browser_proxy.get()); | 236 CheckActiveWindow(browser_proxy.get()); |
| 230 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); | 237 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); |
| 231 EXPECT_EQ(starting_tab_count + 3, tab_count); | 238 EXPECT_EQ(starting_tab_count + 3, tab_count); |
| 232 EXPECT_EQ(closed_tab_index, GetActiveTabIndex(0)); | 239 EXPECT_EQ(closed_tab_index, GetActiveTabIndex(0)); |
| 233 EXPECT_EQ(url1_, GetActiveTabURL(0)); | 240 EXPECT_EQ(url1_, GetActiveTabURL(0)); |
| 234 } | 241 } |
| 235 | 242 |
| 236 // Close a tab, open a new window, close the first window, then restore the | 243 // Close a tab, open a new window, close the first window, then restore the |
| 237 // tab. It should be in a new window. | 244 // tab. It should be in a new window. |
| 238 TEST_F(TabRestoreUITest, BasicRestoreFromClosedWindow) { | 245 TEST_F(TabRestoreUITest, MAYBE_BasicRestoreFromClosedWindow) { |
| 239 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 246 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
| 240 CheckActiveWindow(browser_proxy.get()); | 247 CheckActiveWindow(browser_proxy.get()); |
| 241 | 248 |
| 242 int tab_count; | 249 int tab_count; |
| 243 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); | 250 ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count)); |
| 244 | 251 |
| 245 // Close tabs until we only have one open. | 252 // Close tabs until we only have one open. |
| 246 while (tab_count > 1) { | 253 while (tab_count > 1) { |
| 247 scoped_refptr<TabProxy> tab_to_close(browser_proxy->GetTab(0)); | 254 scoped_refptr<TabProxy> tab_to_close(browser_proxy->GetTab(0)); |
| 248 tab_to_close->Close(true); | 255 tab_to_close->Close(true); |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); | 575 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); |
| 569 GURL url; | 576 GURL url; |
| 570 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); | 577 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); |
| 571 EXPECT_TRUE(url == url1_); | 578 EXPECT_TRUE(url == url1_); |
| 572 | 579 |
| 573 restored_tab_proxy = browser_proxy->GetTab(initial_tab_count + 1); | 580 restored_tab_proxy = browser_proxy->GetTab(initial_tab_count + 1); |
| 574 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); | 581 ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); |
| 575 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); | 582 ASSERT_TRUE(restored_tab_proxy->GetCurrentURL(&url)); |
| 576 EXPECT_TRUE(url == url2_); | 583 EXPECT_TRUE(url == url2_); |
| 577 } | 584 } |
| OLD | NEW |