Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: chrome/browser/memory/tab_manager_browsertest.cc

Issue 2373653002: [TabManager] Enable tab discarding by default. (Closed)
Patch Set: . Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/memory/tab_manager.cc ('k') | chrome/browser/memory/tab_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 15 matching lines...) Expand all
26 #include "content/public/test/test_utils.h" 26 #include "content/public/test/test_utils.h"
27 #include "url/gurl.h" 27 #include "url/gurl.h"
28 28
29 using content::OpenURLParams; 29 using content::OpenURLParams;
30 30
31 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) 31 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
32 32
33 namespace memory { 33 namespace memory {
34 34
35 class TabManagerTest : public InProcessBrowserTest { 35 class TabManagerTest : public InProcessBrowserTest {
36 public:
37 // Tab discarding is enabled by default on CrOS. On other platforms, force it
38 // by turning on the corresponding experiment as some tests assume this
39 // behavior it turned on.
40 void SetUpCommandLine(base::CommandLine* command_line) override {
41 #if !defined(OS_LINUX)
42 command_line->AppendSwitchASCII(switches::kEnableFeatures,
43 features::kAutomaticTabDiscarding.name);
44 #endif
45 }
46 }; 36 };
47 37
48 IN_PROC_BROWSER_TEST_F(TabManagerTest, TabManagerBasics) { 38 IN_PROC_BROWSER_TEST_F(TabManagerTest, TabManagerBasics) {
49 using content::WindowedNotificationObserver; 39 using content::WindowedNotificationObserver;
50 TabManager* tab_manager = g_browser_process->GetTabManager(); 40 TabManager* tab_manager = g_browser_process->GetTabManager();
51 EXPECT_FALSE(tab_manager->recent_tab_discard()); 41 EXPECT_FALSE(tab_manager->recent_tab_discard());
52 42
53 // Disable the protection of recent tabs. 43 // Disable the protection of recent tabs.
54 tab_manager->set_minimum_protection_time_for_tests( 44 tab_manager->set_minimum_protection_time_for_tests(
55 base::TimeDelta::FromMinutes(0)); 45 base::TimeDelta::FromMinutes(0));
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 tab_manager->SetTabAutoDiscardableState(tsm->GetWebContentsAt(0), true); 431 tab_manager->SetTabAutoDiscardableState(tsm->GetWebContentsAt(0), true);
442 432
443 // Now it should be able to discard the tab. 433 // Now it should be able to discard the tab.
444 EXPECT_TRUE(tab_manager->DiscardTabImpl()); 434 EXPECT_TRUE(tab_manager->DiscardTabImpl());
445 EXPECT_TRUE(tab_manager->IsTabDiscarded(tsm->GetWebContentsAt(0))); 435 EXPECT_TRUE(tab_manager->IsTabDiscarded(tsm->GetWebContentsAt(0)));
446 } 436 }
447 437
448 } // namespace memory 438 } // namespace memory
449 439
450 #endif // OS_WIN || OS_MAXOSX || OS_LINUX 440 #endif // OS_WIN || OS_MAXOSX || OS_LINUX
OLDNEW
« no previous file with comments | « chrome/browser/memory/tab_manager.cc ('k') | chrome/browser/memory/tab_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698