| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 ASSERT_EQ(2, new_browser->tab_strip_model()->count()); | 1245 ASSERT_EQ(2, new_browser->tab_strip_model()->count()); |
| 1246 EXPECT_EQ(0, new_browser->tab_strip_model()->active_index()); | 1246 EXPECT_EQ(0, new_browser->tab_strip_model()->active_index()); |
| 1247 EXPECT_EQ(url1_, | 1247 EXPECT_EQ(url1_, |
| 1248 new_browser->tab_strip_model()->GetActiveWebContents()->GetURL()); | 1248 new_browser->tab_strip_model()->GetActiveWebContents()->GetURL()); |
| 1249 EXPECT_EQ(url2_, | 1249 EXPECT_EQ(url2_, |
| 1250 new_browser->tab_strip_model()->GetWebContentsAt(1)->GetURL()); | 1250 new_browser->tab_strip_model()->GetWebContentsAt(1)->GetURL()); |
| 1251 } | 1251 } |
| 1252 | 1252 |
| 1253 // Regression test for crbug.com/240156. When restoring tabs with a navigation, | 1253 // Regression test for crbug.com/240156. When restoring tabs with a navigation, |
| 1254 // the navigation should take active tab focus. | 1254 // the navigation should take active tab focus. |
| 1255 // Flaky on Mac. http://crbug.com/656211. |
| 1256 #if defined(OS_MACOSX) |
| 1257 #define MAYBE_RestoreWithNavigateSelectedTab \ |
| 1258 DISABLED_RestoreWithNavigateSelectedTab |
| 1259 #else |
| 1260 #define MAYBE_RestoreWithNavigateSelectedTab RestoreWithNavigateSelectedTab |
| 1261 #endif |
| 1255 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreWithNavigateSelectedTab) { | 1262 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreWithNavigateSelectedTab) { |
| 1256 // Create 2 tabs. | 1263 // Create 2 tabs. |
| 1257 ui_test_utils::NavigateToURL(browser(), url1_); | 1264 ui_test_utils::NavigateToURL(browser(), url1_); |
| 1258 ui_test_utils::NavigateToURLWithDisposition( | 1265 ui_test_utils::NavigateToURLWithDisposition( |
| 1259 browser(), url2_, WindowOpenDisposition::NEW_FOREGROUND_TAB, | 1266 browser(), url2_, WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 1260 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1267 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 1261 | 1268 |
| 1262 // Restore the session by calling chrome::Navigate(). | 1269 // Restore the session by calling chrome::Navigate(). |
| 1263 Browser* new_browser = | 1270 Browser* new_browser = |
| 1264 QuitBrowserAndRestoreWithURL(browser(), 3, url3_, true); | 1271 QuitBrowserAndRestoreWithURL(browser(), 3, url3_, true); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1494 // automatically at the start of the test. | 1501 // automatically at the start of the test. |
| 1495 for (size_t i = 1; i < web_contents().size(); i++) { | 1502 for (size_t i = 1; i < web_contents().size(); i++) { |
| 1496 GURL expected_url = GURL(kUrls[activation_order[kExpectedNumTabs - i]]); | 1503 GURL expected_url = GURL(kUrls[activation_order[kExpectedNumTabs - i]]); |
| 1497 ASSERT_EQ(expected_url, web_contents()[i]->GetLastCommittedURL()); | 1504 ASSERT_EQ(expected_url, web_contents()[i]->GetLastCommittedURL()); |
| 1498 if (i > 0) { | 1505 if (i > 0) { |
| 1499 ASSERT_GT(web_contents()[i - 1]->GetLastActiveTime(), | 1506 ASSERT_GT(web_contents()[i - 1]->GetLastActiveTime(), |
| 1500 web_contents()[i]->GetLastActiveTime()); | 1507 web_contents()[i]->GetLastActiveTime()); |
| 1501 } | 1508 } |
| 1502 } | 1509 } |
| 1503 } | 1510 } |
| OLD | NEW |