| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/private_working_set_snapshot.h" | 5 #include "chrome/browser/private_working_set_snapshot.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 |
| 7 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 11 |
| 10 using PrivateWorkingSetSnapshotWinTest = testing::Test; | 12 using PrivateWorkingSetSnapshotWinTest = testing::Test; |
| 11 | 13 |
| 12 TEST_F(PrivateWorkingSetSnapshotWinTest, FindPidSelfTest) { | 14 TEST_F(PrivateWorkingSetSnapshotWinTest, FindPidSelfTest) { |
| 13 // The Pdh APIs are supported on Windows XP and above, but the "Working Set - | 15 // The Pdh APIs are supported on Windows XP and above, but the "Working Set - |
| 14 // Private" counter that PrivateWorkingSetSnapshot depends on is not defined | 16 // Private" counter that PrivateWorkingSetSnapshot depends on is not defined |
| 15 // until Windows Vista and is not reliable until Windows 7. Early-out to avoid | 17 // until Windows Vista and is not reliable until Windows 7. Early-out to avoid |
| 16 // test failure. | 18 // test failure. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 size_t private_ws2 = private_ws_snapshot.GetPrivateWorkingSet(pid); | 57 size_t private_ws2 = private_ws_snapshot.GetPrivateWorkingSet(pid); |
| 56 EXPECT_EQ(private_ws, private_ws2) << "GetPrivateWorkingSet should be " | 58 EXPECT_EQ(private_ws, private_ws2) << "GetPrivateWorkingSet should be " |
| 57 "consistent until the next call to " | 59 "consistent until the next call to " |
| 58 "Sample()"; | 60 "Sample()"; |
| 59 | 61 |
| 60 private_ws_snapshot.Sample(); | 62 private_ws_snapshot.Sample(); |
| 61 size_t private_ws3 = private_ws_snapshot.GetPrivateWorkingSet(pid); | 63 size_t private_ws3 = private_ws_snapshot.GetPrivateWorkingSet(pid); |
| 62 EXPECT_GT(private_ws3, private_ws2 + alloc_size / 2) | 64 EXPECT_GT(private_ws3, private_ws2 + alloc_size / 2) |
| 63 << "GetPrivateWorkingSet should increase as we allocate more memory"; | 65 << "GetPrivateWorkingSet should increase as we allocate more memory"; |
| 64 } | 66 } |
| OLD | NEW |