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/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 425 |
426 // Navigate to another same-site URL. | 426 // Navigate to another same-site URL. |
427 content::WebContents* tab = | 427 content::WebContents* tab = |
428 browser()->tab_strip_model()->GetWebContentsAt(tab_count - 1); | 428 browser()->tab_strip_model()->GetWebContentsAt(tab_count - 1); |
429 content::WindowedNotificationObserver observer( | 429 content::WindowedNotificationObserver observer( |
430 content::NOTIFICATION_LOAD_STOP, | 430 content::NOTIFICATION_LOAD_STOP, |
431 content::NotificationService::AllSources()); | 431 content::NotificationService::AllSources()); |
432 static_cast<content::WebContentsDelegate*>(browser())->OpenURLFromTab( | 432 static_cast<content::WebContentsDelegate*>(browser())->OpenURLFromTab( |
433 tab, | 433 tab, |
434 content::OpenURLParams(http_url2, content::Referrer(), CURRENT_TAB, | 434 content::OpenURLParams(http_url2, content::Referrer(), CURRENT_TAB, |
435 content::PAGE_TRANSITION_TYPED, false)); | 435 ui::PAGE_TRANSITION_TYPED, false)); |
436 observer.Wait(); | 436 observer.Wait(); |
437 | 437 |
438 // Close the tab. | 438 // Close the tab. |
439 CloseTab(1); | 439 CloseTab(1); |
440 | 440 |
441 // Create a new tab to the original site. Assuming process-per-site is | 441 // Create a new tab to the original site. Assuming process-per-site is |
442 // enabled, this will ensure that the SiteInstance used by the restored tab | 442 // enabled, this will ensure that the SiteInstance used by the restored tab |
443 // will already exist when the restore happens. | 443 // will already exist when the restore happens. |
444 ui_test_utils::NavigateToURLWithDisposition( | 444 ui_test_utils::NavigateToURLWithDisposition( |
445 browser(), http_url2, NEW_FOREGROUND_TAB, | 445 browser(), http_url2, NEW_FOREGROUND_TAB, |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 while (browser()->tab_strip_model()->count()) | 635 while (browser()->tab_strip_model()->count()) |
636 CloseTab(0); | 636 CloseTab(0); |
637 } | 637 } |
638 | 638 |
639 // Verifies restoring a tab works on startup. | 639 // Verifies restoring a tab works on startup. |
640 IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreOnStartup) { | 640 IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreOnStartup) { |
641 ASSERT_NO_FATAL_FAILURE(RestoreTab(0, 1)); | 641 ASSERT_NO_FATAL_FAILURE(RestoreTab(0, 1)); |
642 EXPECT_EQ(url1_, | 642 EXPECT_EQ(url1_, |
643 browser()->tab_strip_model()->GetWebContentsAt(1)->GetURL()); | 643 browser()->tab_strip_model()->GetWebContentsAt(1)->GetURL()); |
644 } | 644 } |
OLD | NEW |