| 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 | 411 |
| 412 // Navigate to a web page. This is necessary to set a current entry in memory | 412 // Navigate to a web page. This is necessary to set a current entry in memory |
| 413 // so the reload can happen. | 413 // so the reload can happen. |
| 414 WebContentsTester::For(test_contents) | 414 WebContentsTester::For(test_contents) |
| 415 ->NavigateAndCommit(GURL("chrome://newtab")); | 415 ->NavigateAndCommit(GURL("chrome://newtab")); |
| 416 EXPECT_FALSE(tab_manager.IsTabDiscarded(tabstrip.GetWebContentsAt(1))); | 416 EXPECT_FALSE(tab_manager.IsTabDiscarded(tabstrip.GetWebContentsAt(1))); |
| 417 | 417 |
| 418 tab_manager.DiscardWebContentsAt(1, &tabstrip); | 418 tab_manager.DiscardWebContentsAt(1, &tabstrip); |
| 419 EXPECT_TRUE(tab_manager.IsTabDiscarded(tabstrip.GetWebContentsAt(1))); | 419 EXPECT_TRUE(tab_manager.IsTabDiscarded(tabstrip.GetWebContentsAt(1))); |
| 420 | 420 |
| 421 tabstrip.GetWebContentsAt(1)->GetController().Reload(false); | 421 tabstrip.GetWebContentsAt(1)->GetController().Reload( |
| 422 content::ReloadType::NORMAL, false); |
| 422 EXPECT_FALSE(tab_manager.IsTabDiscarded(tabstrip.GetWebContentsAt(1))); | 423 EXPECT_FALSE(tab_manager.IsTabDiscarded(tabstrip.GetWebContentsAt(1))); |
| 423 tabstrip.CloseAllTabs(); | 424 tabstrip.CloseAllTabs(); |
| 424 EXPECT_TRUE(tabstrip.empty()); | 425 EXPECT_TRUE(tabstrip.empty()); |
| 425 } | 426 } |
| 426 | 427 |
| 427 // Makes sure that the last active time property is saved even though the tab is | 428 // Makes sure that the last active time property is saved even though the tab is |
| 428 // discarded. | 429 // discarded. |
| 429 TEST_F(TabManagerTest, DiscardedTabKeepsLastActiveTime) { | 430 TEST_F(TabManagerTest, DiscardedTabKeepsLastActiveTime) { |
| 430 TabManager tab_manager; | 431 TabManager tab_manager; |
| 431 TabStripDummyDelegate delegate; | 432 TabStripDummyDelegate delegate; |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 tabstrip.ActivateTabAt(0, true /* user_gesture */); | 770 tabstrip.ActivateTabAt(0, true /* user_gesture */); |
| 770 EXPECT_EQ(TabManager::RUNNING, | 771 EXPECT_EQ(TabManager::RUNNING, |
| 771 tab_manager.GetWebContentsData(tab1)->GetPurgeAndSuspendState()); | 772 tab_manager.GetWebContentsData(tab1)->GetPurgeAndSuspendState()); |
| 772 | 773 |
| 773 // Clean up the tabstrip. | 774 // Clean up the tabstrip. |
| 774 tabstrip.CloseAllTabs(); | 775 tabstrip.CloseAllTabs(); |
| 775 EXPECT_TRUE(tabstrip.empty()); | 776 EXPECT_TRUE(tabstrip.empty()); |
| 776 } | 777 } |
| 777 | 778 |
| 778 } // namespace memory | 779 } // namespace memory |
| OLD | NEW |