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/memory_coordinator_client_registry.h" | 7 #include "base/memory/memory_coordinator_client_registry.h" |
8 #include "base/memory/memory_coordinator_proxy.h" | 8 #include "base/memory/memory_coordinator_proxy.h" |
9 #include "base/memory/memory_pressure_monitor.h" | 9 #include "base/memory/memory_pressure_monitor.h" |
| 10 #include "base/memory/ptr_util.h" |
10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
12 #include "base/test/scoped_feature_list.h" | 13 #include "base/test/scoped_feature_list.h" |
13 #include "base/test/test_mock_time_task_runner.h" | 14 #include "base/test/test_mock_time_task_runner.h" |
14 #include "content/browser/memory/memory_monitor.h" | 15 #include "content/browser/memory/memory_monitor.h" |
15 #include "content/browser/memory/memory_state_updater.h" | 16 #include "content/browser/memory/memory_state_updater.h" |
16 #include "content/public/common/content_features.h" | 17 #include "content/public/common/content_features.h" |
17 #include "content/public/test/mock_render_process_host.h" | 18 #include "content/public/test/mock_render_process_host.h" |
18 #include "content/public/test/test_browser_context.h" | 19 #include "content/public/test/test_browser_context.h" |
19 #include "mojo/public/cpp/bindings/binding.h" | 20 #include "mojo/public/cpp/bindings/binding.h" |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 // Also make sure that the state is updated based on free avaiable memory. | 465 // Also make sure that the state is updated based on free avaiable memory. |
465 // Since the global state has changed in the previous task, we have to wait | 466 // Since the global state has changed in the previous task, we have to wait |
466 // for |minimum_transition|. | 467 // for |minimum_transition|. |
467 GetMockMemoryMonitor()->SetFreeMemoryUntilCriticalMB(40); | 468 GetMockMemoryMonitor()->SetFreeMemoryUntilCriticalMB(40); |
468 task_runner_->FastForwardBy(minimum_transition); | 469 task_runner_->FastForwardBy(minimum_transition); |
469 task_runner_->RunUntilIdle(); | 470 task_runner_->RunUntilIdle(); |
470 EXPECT_EQ(base::MemoryState::THROTTLED, coordinator_->GetGlobalMemoryState()); | 471 EXPECT_EQ(base::MemoryState::THROTTLED, coordinator_->GetGlobalMemoryState()); |
471 } | 472 } |
472 | 473 |
473 } // namespace content | 474 } // namespace content |
OLD | NEW |