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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/memory_pressure_listener.h" | 15 #include "base/memory/memory_pressure_listener.h" |
16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
17 #include "base/process/launch.h" | 17 #include "base/process/launch.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/threading/thread_restrictions.h" |
19 #include "base/time/time.h" | 20 #include "base/time/time.h" |
20 #include "build/build_config.h" | 21 #include "build/build_config.h" |
21 #include "chrome/browser/defaults.h" | 22 #include "chrome/browser/defaults.h" |
22 #include "chrome/browser/download/download_prefs.h" | 23 #include "chrome/browser/download/download_prefs.h" |
23 #include "chrome/browser/first_run/first_run.h" | 24 #include "chrome/browser/first_run/first_run.h" |
24 #include "chrome/browser/lifetime/keep_alive_types.h" | 25 #include "chrome/browser/lifetime/keep_alive_types.h" |
25 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 26 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
26 #include "chrome/browser/prefs/session_startup_pref.h" | 27 #include "chrome/browser/prefs/session_startup_pref.h" |
27 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
28 #include "chrome/browser/profiles/profile_manager.h" | 29 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 EXPECT_TRUE( | 1444 EXPECT_TRUE( |
1444 controller->GetDefaultSessionStorageNamespace()->should_persist()); | 1445 controller->GetDefaultSessionStorageNamespace()->should_persist()); |
1445 | 1446 |
1446 // Quit and restore. Check that no extra tabs were created. | 1447 // Quit and restore. Check that no extra tabs were created. |
1447 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); | 1448 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); |
1448 ASSERT_EQ(1u, active_browser_list_->size()); | 1449 ASSERT_EQ(1u, active_browser_list_->size()); |
1449 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); | 1450 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); |
1450 } | 1451 } |
1451 | 1452 |
1452 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, TabWithDownloadDoesNotGetRestored) { | 1453 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, TabWithDownloadDoesNotGetRestored) { |
| 1454 base::ThreadRestrictions::ScopedAllowIO allow_io; |
1453 base::ScopedTempDir download_directory; | 1455 base::ScopedTempDir download_directory; |
1454 ASSERT_TRUE(download_directory.CreateUniqueTempDir()); | 1456 ASSERT_TRUE(download_directory.CreateUniqueTempDir()); |
1455 ASSERT_TRUE(embedded_test_server()->Start()); | 1457 ASSERT_TRUE(embedded_test_server()->Start()); |
1456 ASSERT_EQ(Browser::TYPE_TABBED, browser()->type()); | 1458 ASSERT_EQ(Browser::TYPE_TABBED, browser()->type()); |
1457 | 1459 |
1458 DownloadPrefs* download_prefs = | 1460 DownloadPrefs* download_prefs = |
1459 DownloadPrefs::FromBrowserContext(browser()->profile()); | 1461 DownloadPrefs::FromBrowserContext(browser()->profile()); |
1460 download_prefs->SetDownloadPath(download_directory.GetPath()); | 1462 download_prefs->SetDownloadPath(download_directory.GetPath()); |
1461 GURL first_download_url = | 1463 GURL first_download_url = |
1462 embedded_test_server()->GetURL("/downloads/a_zip_file.zip"); | 1464 embedded_test_server()->GetURL("/downloads/a_zip_file.zip"); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 // automatically at the start of the test. | 1615 // automatically at the start of the test. |
1614 for (size_t i = 1; i < web_contents().size(); i++) { | 1616 for (size_t i = 1; i < web_contents().size(); i++) { |
1615 GURL expected_url = GURL(kUrls[activation_order[kExpectedNumTabs - i]]); | 1617 GURL expected_url = GURL(kUrls[activation_order[kExpectedNumTabs - i]]); |
1616 ASSERT_EQ(expected_url, web_contents()[i]->GetLastCommittedURL()); | 1618 ASSERT_EQ(expected_url, web_contents()[i]->GetLastCommittedURL()); |
1617 if (i > 0) { | 1619 if (i > 0) { |
1618 ASSERT_GT(web_contents()[i - 1]->GetLastActiveTime(), | 1620 ASSERT_GT(web_contents()[i - 1]->GetLastActiveTime(), |
1619 web_contents()[i]->GetLastActiveTime()); | 1621 web_contents()[i]->GetLastActiveTime()); |
1620 } | 1622 } |
1621 } | 1623 } |
1622 } | 1624 } |
OLD | NEW |