| 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 <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| (...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1513 std::vector<content::DownloadItem*> downloads; | 1513 std::vector<content::DownloadItem*> downloads; |
| 1514 download_manager->GetAllDownloads(&downloads); | 1514 download_manager->GetAllDownloads(&downloads); |
| 1515 ASSERT_EQ(2u, downloads.size()); | 1515 ASSERT_EQ(2u, downloads.size()); |
| 1516 std::set<GURL> download_urls{downloads[0]->GetURL(), | 1516 std::set<GURL> download_urls{downloads[0]->GetURL(), |
| 1517 downloads[1]->GetURL()}; | 1517 downloads[1]->GetURL()}; |
| 1518 std::set<GURL> expected_urls{first_download_url, second_download_url}; | 1518 std::set<GURL> expected_urls{first_download_url, second_download_url}; |
| 1519 EXPECT_EQ(expected_urls, download_urls); | 1519 EXPECT_EQ(expected_urls, download_urls); |
| 1520 } | 1520 } |
| 1521 } | 1521 } |
| 1522 | 1522 |
| 1523 IN_PROC_BROWSER_TEST_F(SmartSessionRestoreTest, PRE_CorrectLoadingOrder) { | 1523 // PRE_CorrectLoadingOrder is flaky on ChromeOS MSAN and Mac. |
| 1524 // See http://crbug.com/493167. |
| 1525 #if (defined(OS_CHROMEOS) && defined(MEMORY_SANITIZER)) || defined(OS_MACOSX) |
| 1526 #define MAYBE_PRE_CorrectLoadingOrder DISABLED_PRE_CorrectLoadingOrder |
| 1527 #define MAYBE_CorrectLoadingOrder DISABLED_CorrectLoadingOrder |
| 1528 #else |
| 1529 #define MAYBE_PRE_CorrectLoadingOrder PRE_CorrectLoadingOrder |
| 1530 #define MAYBE_CorrectLoadingOrder CorrectLoadingOrder |
| 1531 #endif |
| 1532 IN_PROC_BROWSER_TEST_F(SmartSessionRestoreTest, MAYBE_PRE_CorrectLoadingOrder) { |
| 1524 Profile* profile = browser()->profile(); | 1533 Profile* profile = browser()->profile(); |
| 1525 | 1534 |
| 1526 const int activation_order[] = {4, 2, 1, 5, 0, 3}; | 1535 const int activation_order[] = {4, 2, 1, 5, 0, 3}; |
| 1527 | 1536 |
| 1528 // Replace the first tab and add the other tabs. | 1537 // Replace the first tab and add the other tabs. |
| 1529 ui_test_utils::NavigateToURL(browser(), GURL(kUrls[0])); | 1538 ui_test_utils::NavigateToURL(browser(), GURL(kUrls[0])); |
| 1530 for (size_t i = 1; i < kExpectedNumTabs; i++) { | 1539 for (size_t i = 1; i < kExpectedNumTabs; i++) { |
| 1531 ui_test_utils::NavigateToURLWithDisposition( | 1540 ui_test_utils::NavigateToURLWithDisposition( |
| 1532 browser(), GURL(kUrls[i]), WindowOpenDisposition::NEW_FOREGROUND_TAB, | 1541 browser(), GURL(kUrls[i]), WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 1533 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1542 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 ASSERT_GT(web_contents()[i - 1]->GetLastActiveTime(), | 1575 ASSERT_GT(web_contents()[i - 1]->GetLastActiveTime(), |
| 1567 web_contents()[i]->GetLastActiveTime()); | 1576 web_contents()[i]->GetLastActiveTime()); |
| 1568 } | 1577 } |
| 1569 } | 1578 } |
| 1570 | 1579 |
| 1571 // Activate the 2nd tab before the browser closes. This should be persisted in | 1580 // Activate the 2nd tab before the browser closes. This should be persisted in |
| 1572 // the following test. | 1581 // the following test. |
| 1573 new_browser->tab_strip_model()->ActivateTabAt(1, true); | 1582 new_browser->tab_strip_model()->ActivateTabAt(1, true); |
| 1574 } | 1583 } |
| 1575 | 1584 |
| 1576 // PRE_CorrectLoadingOrder is flaky on ChromeOS MSAN: https://crbug.com/582323 | |
| 1577 // And Mac: https://crbug.com/656687 | |
| 1578 #if (defined(OS_CHROMEOS) && defined(MEMORY_SANITIZER)) || defined(OS_MACOSX) | |
| 1579 #define MAYBE_CorrectLoadingOrder DISABLED_CorrectLoadingOrder | |
| 1580 #else | |
| 1581 #define MAYBE_CorrectLoadingOrder CorrectLoadingOrder | |
| 1582 #endif | |
| 1583 IN_PROC_BROWSER_TEST_F(SmartSessionRestoreTest, MAYBE_CorrectLoadingOrder) { | 1585 IN_PROC_BROWSER_TEST_F(SmartSessionRestoreTest, MAYBE_CorrectLoadingOrder) { |
| 1584 const int activation_order[] = {4, 2, 5, 0, 3, 1}; | 1586 const int activation_order[] = {4, 2, 5, 0, 3, 1}; |
| 1585 Profile* profile = browser()->profile(); | 1587 Profile* profile = browser()->profile(); |
| 1586 | 1588 |
| 1587 // Close the browser that gets opened automatically so we can track the order | 1589 // Close the browser that gets opened automatically so we can track the order |
| 1588 // of loading of the tabs. | 1590 // of loading of the tabs. |
| 1589 std::unique_ptr<ScopedKeepAlive> keep_alive(new ScopedKeepAlive( | 1591 std::unique_ptr<ScopedKeepAlive> keep_alive(new ScopedKeepAlive( |
| 1590 KeepAliveOrigin::SESSION_RESTORE, KeepAliveRestartOption::DISABLED)); | 1592 KeepAliveOrigin::SESSION_RESTORE, KeepAliveRestartOption::DISABLED)); |
| 1591 CloseBrowserSynchronously(browser()); | 1593 CloseBrowserSynchronously(browser()); |
| 1592 // We have an extra tab that is added when the test starts, which gets ignored | 1594 // We have an extra tab that is added when the test starts, which gets ignored |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1611 // automatically at the start of the test. | 1613 // automatically at the start of the test. |
| 1612 for (size_t i = 1; i < web_contents().size(); i++) { | 1614 for (size_t i = 1; i < web_contents().size(); i++) { |
| 1613 GURL expected_url = GURL(kUrls[activation_order[kExpectedNumTabs - i]]); | 1615 GURL expected_url = GURL(kUrls[activation_order[kExpectedNumTabs - i]]); |
| 1614 ASSERT_EQ(expected_url, web_contents()[i]->GetLastCommittedURL()); | 1616 ASSERT_EQ(expected_url, web_contents()[i]->GetLastCommittedURL()); |
| 1615 if (i > 0) { | 1617 if (i > 0) { |
| 1616 ASSERT_GT(web_contents()[i - 1]->GetLastActiveTime(), | 1618 ASSERT_GT(web_contents()[i - 1]->GetLastActiveTime(), |
| 1617 web_contents()[i]->GetLastActiveTime()); | 1619 web_contents()[i]->GetLastActiveTime()); |
| 1618 } | 1620 } |
| 1619 } | 1621 } |
| 1620 } | 1622 } |
| OLD | NEW |