| 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 // Configure the TabManager for testing. | 544 // Configure the TabManager for testing. |
| 545 tabstrip.AddObserver(&tm); | 545 tabstrip.AddObserver(&tm); |
| 546 tm.test_tab_strip_models_.push_back( | 546 tm.test_tab_strip_models_.push_back( |
| 547 TabManager::TestTabStripModel(&tabstrip, false /* !is_app */)); | 547 TabManager::TestTabStripModel(&tabstrip, false /* !is_app */)); |
| 548 tm.test_tick_clock_ = &test_clock; | 548 tm.test_tick_clock_ = &test_clock; |
| 549 tm.task_runner_ = task_runner; | 549 tm.task_runner_ = task_runner; |
| 550 tm.notify_renderer_process_ = base::Bind( | 550 tm.notify_renderer_process_ = base::Bind( |
| 551 &TabManagerTest::NotifyRendererProcess, base::Unretained(this)); | 551 &TabManagerTest::NotifyRendererProcess, base::Unretained(this)); |
| 552 | 552 |
| 553 // Create two dummy tabs. | 553 // Create two dummy tabs. |
| 554 auto tab0 = CreateWebContents(); | 554 auto* tab0 = CreateWebContents(); |
| 555 auto tab1 = CreateWebContents(); | 555 auto* tab1 = CreateWebContents(); |
| 556 auto tab2 = CreateWebContents(); | 556 auto* tab2 = CreateWebContents(); |
| 557 tabstrip.AppendWebContents(tab0, true); // Foreground tab. | 557 tabstrip.AppendWebContents(tab0, true); // Foreground tab. |
| 558 tabstrip.AppendWebContents(tab1, false); // Background tab. | 558 tabstrip.AppendWebContents(tab1, false); // Background tab. |
| 559 tabstrip.AppendWebContents(tab2, false); // Background tab. | 559 tabstrip.AppendWebContents(tab2, false); // Background tab. |
| 560 const content::RenderProcessHost* renderer1 = tab1->GetRenderProcessHost(); | 560 const content::RenderProcessHost* renderer1 = tab1->GetRenderProcessHost(); |
| 561 const content::RenderProcessHost* renderer2 = tab2->GetRenderProcessHost(); | 561 const content::RenderProcessHost* renderer2 = tab2->GetRenderProcessHost(); |
| 562 | 562 |
| 563 // Make sure that tab2 has a lower priority than tab1 by its access time. | 563 // Make sure that tab2 has a lower priority than tab1 by its access time. |
| 564 test_clock.Advance(base::TimeDelta::FromMilliseconds(1)); | 564 test_clock.Advance(base::TimeDelta::FromMilliseconds(1)); |
| 565 tab2->SetLastActiveTime(test_clock.NowTicks()); | 565 tab2->SetLastActiveTime(test_clock.NowTicks()); |
| 566 test_clock.Advance(base::TimeDelta::FromMilliseconds(1)); | 566 test_clock.Advance(base::TimeDelta::FromMilliseconds(1)); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 EXPECT_EQ(0u, task_runner->size()); | 661 EXPECT_EQ(0u, task_runner->size()); |
| 662 EXPECT_EQ(0u, tm.notified_renderers_.size()); | 662 EXPECT_EQ(0u, tm.notified_renderers_.size()); |
| 663 | 663 |
| 664 | 664 |
| 665 // Clean up the tabstrip. | 665 // Clean up the tabstrip. |
| 666 tabstrip.CloseAllTabs(); | 666 tabstrip.CloseAllTabs(); |
| 667 ASSERT_TRUE(tabstrip.empty()); | 667 ASSERT_TRUE(tabstrip.empty()); |
| 668 } | 668 } |
| 669 | 669 |
| 670 } // namespace memory | 670 } // namespace memory |
| OLD | NEW |