| 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 "chrome/browser/memory/tab_manager.h" | 5 #include "chrome/browser/memory/tab_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 test_clock.Advance(base::TimeDelta::FromSeconds(1)); | 697 test_clock.Advance(base::TimeDelta::FromSeconds(1)); |
| 698 EXPECT_EQ(TabManager::SUSPENDED, | 698 EXPECT_EQ(TabManager::SUSPENDED, |
| 699 tab_manager.GetNextPurgeAndSuspendState( | 699 tab_manager.GetNextPurgeAndSuspendState( |
| 700 test_contents, test_clock.NowTicks(), threshold)); | 700 test_contents, test_clock.NowTicks(), threshold)); |
| 701 | 701 |
| 702 tab_manager.GetWebContentsData(test_contents) | 702 tab_manager.GetWebContentsData(test_contents) |
| 703 ->SetPurgeAndSuspendState(TabManager::SUSPENDED); | 703 ->SetPurgeAndSuspendState(TabManager::SUSPENDED); |
| 704 tab_manager.GetWebContentsData(test_contents) | 704 tab_manager.GetWebContentsData(test_contents) |
| 705 ->SetLastPurgeAndSuspendModifiedTimeForTesting(test_clock.NowTicks()); | 705 ->SetLastPurgeAndSuspendModifiedTimeForTesting(test_clock.NowTicks()); |
| 706 | 706 |
| 707 test_clock.Advance(base::TimeDelta::FromSeconds(120)); | 707 test_clock.Advance(base::TimeDelta::FromSeconds(1200)); |
| 708 EXPECT_EQ(TabManager::SUSPENDED, | 708 EXPECT_EQ(TabManager::SUSPENDED, |
| 709 tab_manager.GetNextPurgeAndSuspendState( | 709 tab_manager.GetNextPurgeAndSuspendState( |
| 710 test_contents, test_clock.NowTicks(), threshold)); | 710 test_contents, test_clock.NowTicks(), threshold)); |
| 711 | 711 |
| 712 test_clock.Advance(base::TimeDelta::FromSeconds(1)); | 712 test_clock.Advance(base::TimeDelta::FromSeconds(1)); |
| 713 EXPECT_EQ(TabManager::RESUMED, | 713 EXPECT_EQ(TabManager::RESUMED, |
| 714 tab_manager.GetNextPurgeAndSuspendState( | 714 tab_manager.GetNextPurgeAndSuspendState( |
| 715 test_contents, test_clock.NowTicks(), threshold)); | 715 test_contents, test_clock.NowTicks(), threshold)); |
| 716 | 716 |
| 717 tab_manager.GetWebContentsData(test_contents) | 717 tab_manager.GetWebContentsData(test_contents) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 tabstrip.ActivateTabAt(0, true /* user_gesture */); | 770 tabstrip.ActivateTabAt(0, true /* user_gesture */); |
| 771 EXPECT_EQ(TabManager::RUNNING, | 771 EXPECT_EQ(TabManager::RUNNING, |
| 772 tab_manager.GetWebContentsData(tab1)->GetPurgeAndSuspendState()); | 772 tab_manager.GetWebContentsData(tab1)->GetPurgeAndSuspendState()); |
| 773 | 773 |
| 774 // Clean up the tabstrip. | 774 // Clean up the tabstrip. |
| 775 tabstrip.CloseAllTabs(); | 775 tabstrip.CloseAllTabs(); |
| 776 EXPECT_TRUE(tabstrip.empty()); | 776 EXPECT_TRUE(tabstrip.empty()); |
| 777 } | 777 } |
| 778 | 778 |
| 779 } // namespace memory | 779 } // namespace memory |
| OLD | NEW |