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

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

Issue 2843633002: TabManager: Do not overkill when target memory to free is negative. (Closed)
Patch Set: fix test Created 3 years, 8 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 | « no previous file | chrome/browser/memory/tab_manager_delegate_chromeos.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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 WindowedNotificationObserver back2( 181 WindowedNotificationObserver back2(
182 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 182 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
183 base::Bind(&ObserveNavEntryCommitted, GURL(chrome::kChromeUITermsURL))); 183 base::Bind(&ObserveNavEntryCommitted, GURL(chrome::kChromeUITermsURL)));
184 chrome::GoBack(browser(), WindowOpenDisposition::CURRENT_TAB); 184 chrome::GoBack(browser(), WindowOpenDisposition::CURRENT_TAB);
185 back2.Wait(); 185 back2.Wait();
186 EXPECT_FALSE(chrome::CanGoBack(browser())); 186 EXPECT_FALSE(chrome::CanGoBack(browser()));
187 EXPECT_TRUE(chrome::CanGoForward(browser())); 187 EXPECT_TRUE(chrome::CanGoForward(browser()));
188 } 188 }
189 189
190 // On Linux, memory pressure listener is not implemented yet. 190 // On Linux, memory pressure listener is not implemented yet.
191 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) 191 #if defined(OS_WIN) || defined(OS_MACOSX)
Georges Khalil 2017/04/25 15:21:15 Why are we disabling the test for CrOS here?
cylee1 2017/04/25 15:46:20 It's what this CL fixes: on CrOS, it reads memory
Georges Khalil 2017/04/25 15:47:41 Got it, thanks.
192 192
193 // Test that the MemoryPressureListener event is properly triggering a tab 193 // Test that the MemoryPressureListener event is properly triggering a tab
194 // discard upon |MEMORY_PRESSURE_LEVEL_CRITICAL| event. 194 // discard upon |MEMORY_PRESSURE_LEVEL_CRITICAL| event.
195 IN_PROC_BROWSER_TEST_F(TabManagerTest, OomPressureListener) { 195 IN_PROC_BROWSER_TEST_F(TabManagerTest, OomPressureListener) {
196 TabManager* tab_manager = g_browser_process->GetTabManager(); 196 TabManager* tab_manager = g_browser_process->GetTabManager();
197 197
198 // Disable the protection of recent tabs. 198 // Disable the protection of recent tabs.
199 tab_manager->set_minimum_protection_time_for_tests( 199 tab_manager->set_minimum_protection_time_for_tests(
200 base::TimeDelta::FromMinutes(0)); 200 base::TimeDelta::FromMinutes(0));
201 201
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 ASSERT_TRUE(tab1_contents_data->is_purged()); 578 ASSERT_TRUE(tab1_contents_data->is_purged());
579 ASSERT_TRUE(tab2_contents_data->is_purged()); 579 ASSERT_TRUE(tab2_contents_data->is_purged());
580 ASSERT_FALSE(tab3_contents_data->is_purged()); 580 ASSERT_FALSE(tab3_contents_data->is_purged());
581 581
582 tsm->CloseAllTabs(); 582 tsm->CloseAllTabs();
583 } 583 }
584 584
585 } // namespace memory 585 } // namespace memory
586 586
587 #endif // OS_WIN || OS_MAXOSX || OS_LINUX 587 #endif // OS_WIN || OS_MAXOSX || OS_LINUX
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/memory/tab_manager_delegate_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698