OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 250 |
251 // Close one of them. | 251 // Close one of them. |
252 CloseTab(0); | 252 CloseTab(0); |
253 ASSERT_EQ(browser()->tab_count(), starting_tab_count + 1); | 253 ASSERT_EQ(browser()->tab_count(), starting_tab_count + 1); |
254 | 254 |
255 // Restore it. | 255 // Restore it. |
256 ASSERT_NO_FATAL_FAILURE(RestoreTab(0, 0)); | 256 ASSERT_NO_FATAL_FAILURE(RestoreTab(0, 0)); |
257 ASSERT_EQ(browser()->tab_count(), starting_tab_count + 2); | 257 ASSERT_EQ(browser()->tab_count(), starting_tab_count + 2); |
258 | 258 |
259 // Make sure that there's nothing else to restore. | 259 // Make sure that there's nothing else to restore. |
260 ASSERT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_RESTORE_TAB)); | 260 ASSERT_FALSE(chrome::CanRestoreTab(browser())); |
261 } | 261 } |
262 | 262 |
263 // Open a window with multiple tabs, close a tab, then close the window. | 263 // Open a window with multiple tabs, close a tab, then close the window. |
264 // Restore both and make sure the tab goes back into the window. | 264 // Restore both and make sure the tab goes back into the window. |
265 IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindowAndTab) { | 265 IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindowAndTab) { |
266 int starting_tab_count = browser()->tab_count(); | 266 int starting_tab_count = browser()->tab_count(); |
267 AddSomeTabs(browser(), 3); | 267 AddSomeTabs(browser(), 3); |
268 | 268 |
269 // Close one in the middle | 269 // Close one in the middle |
270 int closed_tab_index = starting_tab_count + 1; | 270 int closed_tab_index = starting_tab_count + 1; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 TabContents* tab = browser()->GetTabContentsAt(1); | 534 TabContents* tab = browser()->GetTabContentsAt(1); |
535 EnsureTabFinishedRestoring(tab->web_contents()); | 535 EnsureTabFinishedRestoring(tab->web_contents()); |
536 ASSERT_EQ(http_url, tab->web_contents()->GetURL()); | 536 ASSERT_EQ(http_url, tab->web_contents()->GetURL()); |
537 | 537 |
538 // Go back, and see if content is as expected. | 538 // Go back, and see if content is as expected. |
539 GoBack(browser()); | 539 GoBack(browser()); |
540 EXPECT_GT( | 540 EXPECT_GT( |
541 ui_test_utils::FindInPage(tab, ASCIIToUTF16("webkit"), true, false, NULL), | 541 ui_test_utils::FindInPage(tab, ASCIIToUTF16("webkit"), true, false, NULL), |
542 0); | 542 0); |
543 } | 543 } |
OLD | NEW |