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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 int tab_count = browser->tab_count(); | 94 int tab_count = browser->tab_count(); |
95 ASSERT_GT(tab_count, 0); | 95 ASSERT_GT(tab_count, 0); |
96 | 96 |
97 // Restore the tab. | 97 // Restore the tab. |
98 ui_test_utils::WindowedNotificationObserver tab_added_observer( | 98 ui_test_utils::WindowedNotificationObserver tab_added_observer( |
99 chrome::NOTIFICATION_TAB_PARENTED, | 99 chrome::NOTIFICATION_TAB_PARENTED, |
100 content::NotificationService::AllSources()); | 100 content::NotificationService::AllSources()); |
101 ui_test_utils::WindowedNotificationObserver tab_loaded_observer( | 101 ui_test_utils::WindowedNotificationObserver tab_loaded_observer( |
102 content::NOTIFICATION_LOAD_STOP, | 102 content::NOTIFICATION_LOAD_STOP, |
103 content::NotificationService::AllSources()); | 103 content::NotificationService::AllSources()); |
104 browser->RestoreTab(); | 104 chrome::RestoreTab(browser); |
105 tab_added_observer.Wait(); | 105 tab_added_observer.Wait(); |
106 tab_loaded_observer.Wait(); | 106 tab_loaded_observer.Wait(); |
107 | 107 |
108 if (expect_new_window) { | 108 if (expect_new_window) { |
109 int new_window_count = static_cast<int>(BrowserList::size()); | 109 int new_window_count = static_cast<int>(BrowserList::size()); |
110 EXPECT_EQ(++window_count, new_window_count); | 110 EXPECT_EQ(++window_count, new_window_count); |
111 browser = GetBrowser(expected_window_index); | 111 browser = GetBrowser(expected_window_index); |
112 } else { | 112 } else { |
113 EXPECT_EQ(++tab_count, browser->tab_count()); | 113 EXPECT_EQ(++tab_count, browser->tab_count()); |
114 } | 114 } |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 close_window_observer.Wait(); | 466 close_window_observer.Wait(); |
467 EXPECT_EQ(window_count - 1, BrowserList::size()); | 467 EXPECT_EQ(window_count - 1, BrowserList::size()); |
468 | 468 |
469 // Restore the window. | 469 // Restore the window. |
470 ui_test_utils::WindowedNotificationObserver open_window_observer( | 470 ui_test_utils::WindowedNotificationObserver open_window_observer( |
471 chrome::NOTIFICATION_BROWSER_OPENED, | 471 chrome::NOTIFICATION_BROWSER_OPENED, |
472 content::NotificationService::AllSources()); | 472 content::NotificationService::AllSources()); |
473 ui_test_utils::WindowedNotificationObserver load_stop_observer( | 473 ui_test_utils::WindowedNotificationObserver load_stop_observer( |
474 content::NOTIFICATION_LOAD_STOP, | 474 content::NOTIFICATION_LOAD_STOP, |
475 content::NotificationService::AllSources()); | 475 content::NotificationService::AllSources()); |
476 (*BrowserList::begin())->RestoreTab(); | 476 chrome::RestoreTab(*BrowserList::begin()); |
477 open_window_observer.Wait(); | 477 open_window_observer.Wait(); |
478 EXPECT_EQ(window_count, BrowserList::size()); | 478 EXPECT_EQ(window_count, BrowserList::size()); |
479 | 479 |
480 Browser* browser = GetBrowser(1); | 480 Browser* browser = GetBrowser(1); |
481 EXPECT_EQ(initial_tab_count + 2, browser->tab_count()); | 481 EXPECT_EQ(initial_tab_count + 2, browser->tab_count()); |
482 load_stop_observer.Wait(); | 482 load_stop_observer.Wait(); |
483 | 483 |
484 content::WebContents* restored_tab = | 484 content::WebContents* restored_tab = |
485 chrome::GetWebContentsAt(browser, initial_tab_count); | 485 chrome::GetWebContentsAt(browser, initial_tab_count); |
486 EnsureTabFinishedRestoring(restored_tab); | 486 EnsureTabFinishedRestoring(restored_tab); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 TabContents* tab = chrome::GetTabContentsAt(browser(), 1); | 536 TabContents* tab = chrome::GetTabContentsAt(browser(), 1); |
537 EnsureTabFinishedRestoring(tab->web_contents()); | 537 EnsureTabFinishedRestoring(tab->web_contents()); |
538 ASSERT_EQ(http_url, tab->web_contents()->GetURL()); | 538 ASSERT_EQ(http_url, tab->web_contents()->GetURL()); |
539 | 539 |
540 // Go back, and see if content is as expected. | 540 // Go back, and see if content is as expected. |
541 GoBack(browser()); | 541 GoBack(browser()); |
542 EXPECT_GT( | 542 EXPECT_GT( |
543 ui_test_utils::FindInPage(tab, ASCIIToUTF16("webkit"), true, false, NULL), | 543 ui_test_utils::FindInPage(tab, ASCIIToUTF16("webkit"), true, false, NULL), |
544 0); | 544 0); |
545 } | 545 } |
OLD | NEW |