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_delegate_chromeos.h" | 5 #include "chrome/browser/memory/tab_manager_delegate_chromeos.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 | 113 |
114 // unit test. | 114 // unit test. |
115 void Clear() { | 115 void Clear() { |
116 killed_arc_processes_.clear(); | 116 killed_arc_processes_.clear(); |
117 killed_tabs_.clear(); | 117 killed_tabs_.clear(); |
118 } | 118 } |
119 | 119 |
120 protected: | 120 protected: |
121 // Nullify the operation for unit test. | 121 // Nullify the operation for unit test. |
122 void SetOomScoreAdjForTabs( | 122 void SetOomScoreAdj( |
123 const std::vector<std::pair<base::ProcessHandle, int>>& entries) | 123 const std::vector<std::pair<base::ProcessHandle, int>>& entries) |
124 override {} | 124 override {} |
125 | 125 |
126 bool KillArcProcess(const int nspid) override { | 126 bool KillArcProcess(const int nspid) override { |
127 killed_arc_processes_.push_back(nspid); | 127 killed_arc_processes_.push_back(nspid); |
128 return true; | 128 return true; |
129 } | 129 } |
130 | 130 |
131 bool KillTab(int64_t tab_id) override { | 131 bool KillTab(int64_t tab_id) override { |
132 killed_tabs_.push_back(tab_id); | 132 killed_tabs_.push_back(tab_id); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 // Killed tabs and their content id. | 297 // Killed tabs and their content id. |
298 // Note that process with pid 11 is counted twice. But so far I don't have a | 298 // Note that process with pid 11 is counted twice. But so far I don't have a |
299 // good way to estimate the memory freed if multiple tabs share one process. | 299 // good way to estimate the memory freed if multiple tabs share one process. |
300 EXPECT_EQ(3U, killed_tabs.size()); | 300 EXPECT_EQ(3U, killed_tabs.size()); |
301 EXPECT_EQ(2, killed_tabs[0]); | 301 EXPECT_EQ(2, killed_tabs[0]); |
302 EXPECT_EQ(5, killed_tabs[1]); | 302 EXPECT_EQ(5, killed_tabs[1]); |
303 EXPECT_EQ(1, killed_tabs[2]); | 303 EXPECT_EQ(1, killed_tabs[2]); |
304 } | 304 } |
305 | 305 |
306 } // namespace memory | 306 } // namespace memory |
OLD | NEW |