| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 return killed_tabs_; | 111 return killed_tabs_; |
| 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. | |
| 122 void SetOomScoreAdjForTabs( | |
| 123 const std::vector<std::pair<base::ProcessHandle, int>>& entries) | |
| 124 override {} | |
| 125 | |
| 126 bool KillArcProcess(const int nspid) override { | 121 bool KillArcProcess(const int nspid) override { |
| 127 killed_arc_processes_.push_back(nspid); | 122 killed_arc_processes_.push_back(nspid); |
| 128 return true; | 123 return true; |
| 129 } | 124 } |
| 130 | 125 |
| 131 bool KillTab(int64_t tab_id) override { | 126 bool KillTab(int64_t tab_id) override { |
| 132 killed_tabs_.push_back(tab_id); | 127 killed_tabs_.push_back(tab_id); |
| 133 return true; | 128 return true; |
| 134 } | 129 } |
| 135 | 130 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 // Killed tabs and their content id. | 292 // Killed tabs and their content id. |
| 298 // Note that process with pid 11 is counted twice. But so far I don't have a | 293 // 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. | 294 // good way to estimate the memory freed if multiple tabs share one process. |
| 300 EXPECT_EQ(3U, killed_tabs.size()); | 295 EXPECT_EQ(3U, killed_tabs.size()); |
| 301 EXPECT_EQ(2, killed_tabs[0]); | 296 EXPECT_EQ(2, killed_tabs[0]); |
| 302 EXPECT_EQ(5, killed_tabs[1]); | 297 EXPECT_EQ(5, killed_tabs[1]); |
| 303 EXPECT_EQ(1, killed_tabs[2]); | 298 EXPECT_EQ(1, killed_tabs[2]); |
| 304 } | 299 } |
| 305 | 300 |
| 306 } // namespace memory | 301 } // namespace memory |
| OLD | NEW |