OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/browser/memory/memory_coordinator_impl.h" | 5 #include "content/browser/memory/memory_coordinator_impl.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/test/scoped_feature_list.h" | 8 #include "base/test/scoped_feature_list.h" |
9 #include "content/browser/browser_main_loop.h" | 9 #include "content/browser/browser_main_loop.h" |
10 #include "content/public/common/content_features.h" | 10 #include "content/public/common/content_features.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 NavigateToURL(shell(), url); | 57 NavigateToURL(shell(), url); |
58 auto* memory_coordinator = MemoryCoordinatorImpl::GetInstance(); | 58 auto* memory_coordinator = MemoryCoordinatorImpl::GetInstance(); |
59 memory_coordinator->SetDelegateForTesting( | 59 memory_coordinator->SetDelegateForTesting( |
60 base::MakeUnique<TestMemoryCoordinatorDelegate>()); | 60 base::MakeUnique<TestMemoryCoordinatorDelegate>()); |
61 EXPECT_EQ(1u, memory_coordinator->children().size()); | 61 EXPECT_EQ(1u, memory_coordinator->children().size()); |
62 int render_process_id = memory_coordinator->children().begin()->first; | 62 int render_process_id = memory_coordinator->children().begin()->first; |
63 // Foreground tab cannot be suspended. | 63 // Foreground tab cannot be suspended. |
64 EXPECT_FALSE(memory_coordinator->CanSuspendRenderer(render_process_id)); | 64 EXPECT_FALSE(memory_coordinator->CanSuspendRenderer(render_process_id)); |
65 } | 65 } |
66 | 66 |
| 67 IN_PROC_BROWSER_TEST_F(MemoryCoordinatorImplBrowserTest, GetStateForProcess) { |
| 68 GURL url = GetTestUrl("", "simple_page.html"); |
| 69 NavigateToURL(shell(), url); |
| 70 auto* memory_coordinator = MemoryCoordinator::GetInstance(); |
| 71 base::ProcessHandle handle = base::GetCurrentProcessHandle(); |
| 72 EXPECT_NE(base::MemoryState::UNKNOWN, |
| 73 memory_coordinator->GetStateForProcess(handle)); |
| 74 } |
| 75 |
67 #endif // !defined(OS_MACOSX) | 76 #endif // !defined(OS_MACOSX) |
68 | 77 |
69 } // namespace content | 78 } // namespace content |
OLD | NEW |