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/base_switches.h" | 5 #include "base/base_switches.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/memory/memory_pressure_listener.h" | 7 #include "base/memory/memory_pressure_listener.h" |
8 #include "base/test/simple_test_tick_clock.h" | 8 #include "base/test/simple_test_tick_clock.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 11 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
12 #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" | 12 #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" |
13 #include "chrome/browser/memory/tab_manager.h" | 13 #include "chrome/browser/resource_coordinator/tab_manager.h" |
14 #include "chrome/browser/memory/tab_manager_web_contents_data.h" | 14 #include "chrome/browser/resource_coordinator/tab_manager_web_contents_data.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_commands.h" | 16 #include "chrome/browser/ui/browser_commands.h" |
17 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 17 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
19 #include "chrome/common/chrome_features.h" | 19 #include "chrome/common/chrome_features.h" |
20 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
21 #include "chrome/test/base/in_process_browser_test.h" | 21 #include "chrome/test/base/in_process_browser_test.h" |
22 #include "chrome/test/base/interactive_test_utils.h" | 22 #include "chrome/test/base/interactive_test_utils.h" |
23 #include "content/public/browser/navigation_details.h" | 23 #include "content/public/browser/navigation_details.h" |
24 #include "content/public/browser/navigation_entry.h" | 24 #include "content/public/browser/navigation_entry.h" |
25 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
26 #include "content/public/browser/notification_types.h" | 26 #include "content/public/browser/notification_types.h" |
27 #include "content/public/browser/render_process_host.h" | 27 #include "content/public/browser/render_process_host.h" |
28 #include "content/public/common/content_switches.h" | 28 #include "content/public/common/content_switches.h" |
29 #include "content/public/test/test_utils.h" | 29 #include "content/public/test/test_utils.h" |
30 #include "url/gurl.h" | 30 #include "url/gurl.h" |
31 | 31 |
32 using content::OpenURLParams; | 32 using content::OpenURLParams; |
33 | 33 |
34 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) | 34 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) |
35 | 35 |
36 namespace memory { | 36 namespace resource_coordinator { |
37 | 37 |
38 class TabManagerTest : public InProcessBrowserTest { | 38 class TabManagerTest : public InProcessBrowserTest {}; |
39 }; | |
40 | 39 |
41 bool ObserveNavEntryCommitted(const GURL& expected_url, | 40 bool ObserveNavEntryCommitted(const GURL& expected_url, |
42 const content::NotificationSource& source, | 41 const content::NotificationSource& source, |
43 const content::NotificationDetails& details) { | 42 const content::NotificationDetails& details) { |
44 return content::Details<content::LoadCommittedDetails>(details) | 43 return content::Details<content::LoadCommittedDetails>(details) |
45 ->entry->GetURL() == expected_url; | 44 ->entry->GetURL() == expected_url; |
46 } | 45 } |
47 | 46 |
48 IN_PROC_BROWSER_TEST_F(TabManagerTest, TabManagerBasics) { | 47 IN_PROC_BROWSER_TEST_F(TabManagerTest, TabManagerBasics) { |
49 using content::WindowedNotificationObserver; | 48 using content::WindowedNotificationObserver; |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 // Since tab2 is kept inactive and background for more than | 574 // Since tab2 is kept inactive and background for more than |
576 // time_to_purge2, tab1 should be purged. | 575 // time_to_purge2, tab1 should be purged. |
577 // Since tab3 is active, tab3 should not be purged. | 576 // Since tab3 is active, tab3 should not be purged. |
578 ASSERT_TRUE(tab1_contents_data->is_purged()); | 577 ASSERT_TRUE(tab1_contents_data->is_purged()); |
579 ASSERT_TRUE(tab2_contents_data->is_purged()); | 578 ASSERT_TRUE(tab2_contents_data->is_purged()); |
580 ASSERT_FALSE(tab3_contents_data->is_purged()); | 579 ASSERT_FALSE(tab3_contents_data->is_purged()); |
581 | 580 |
582 tsm->CloseAllTabs(); | 581 tsm->CloseAllTabs(); |
583 } | 582 } |
584 | 583 |
585 } // namespace memory | 584 } // namespace resource_coordinator |
586 | 585 |
587 #endif // OS_WIN || OS_MAXOSX || OS_LINUX | 586 #endif // OS_WIN || OS_MAXOSX || OS_LINUX |
OLD | NEW |