Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1162)

Side by Side Diff: content/browser/memory/test_memory_monitor.h

Issue 2321313002: Move components/memory_coordinator -> content/ (Closed)
Patch Set: rebase etc Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "components/memory_coordinator/browser/memory_monitor.h" 5 #ifndef CONTENT_BROWSER_MEMORY_TEST_MEMORY_MONITOR_H_
6 #define CONTENT_BROWSER_MEMORY_TEST_MEMORY_MONITOR_H_
7
8 #include "content/browser/memory/memory_monitor.h"
6 9
7 #include "base/process/process_metrics.h" 10 #include "base/process/process_metrics.h"
8 11
9 namespace memory_coordinator { 12 namespace content {
10 13
11 // A delegate that allows mocking the various inputs to MemoryMonitor. 14 // A delegate that allows mocking the various inputs to MemoryMonitor.
12 class TestMemoryMonitorDelegate : public MemoryMonitorDelegate { 15 class TestMemoryMonitorDelegate : public MemoryMonitorDelegate {
13 public: 16 public:
14 TestMemoryMonitorDelegate() : calls_(0) { mem_info_ = {}; } 17 TestMemoryMonitorDelegate() : calls_(0) { mem_info_ = {}; }
15 ~TestMemoryMonitorDelegate() override; 18 ~TestMemoryMonitorDelegate() override;
16 19
17 void GetSystemMemoryInfo(base::SystemMemoryInfoKB* mem_info) override; 20 void GetSystemMemoryInfo(base::SystemMemoryInfoKB* mem_info) override;
18 21
19 size_t calls() const { return calls_; } 22 size_t calls() const { return calls_; }
20 void ResetCalls() { calls_ = 0; } 23 void ResetCalls() { calls_ = 0; }
21 24
22 void SetTotalMemoryKB(int total_memory_kb) { 25 void SetTotalMemoryKB(int total_memory_kb) {
23 mem_info_.total = total_memory_kb; 26 mem_info_.total = total_memory_kb;
24 } 27 }
25 28
26 protected: 29 protected:
27 // Because the fields of SystemMemoryInfoKB vary depending on the operating 30 // Because the fields of SystemMemoryInfoKB vary depending on the operating
28 // system, specific derived classes will have to provide methods to load 31 // system, specific derived classes will have to provide methods to load
29 // values into |mem_info_|; 32 // values into |mem_info_|;
30 base::SystemMemoryInfoKB mem_info_; 33 base::SystemMemoryInfoKB mem_info_;
31 34
32 private: 35 private:
33 size_t calls_; 36 size_t calls_;
34 37
35 DISALLOW_COPY_AND_ASSIGN(TestMemoryMonitorDelegate); 38 DISALLOW_COPY_AND_ASSIGN(TestMemoryMonitorDelegate);
36 }; 39 };
37 40
38 } // namespace memory_coordinator 41 } // namespace content
42
43 #endif // CONTENT_BROWSER_MEMORY_TEST_MEMORY_MONITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698