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

Side by Side Diff: base/mac/memory_pressure_monitor_mac_unittest.cc

Issue 1128733002: Update from https://crrev.com/328418 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « base/mac/memory_pressure_monitor_mac.cc ('k') | base/mac/scoped_nsobject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/mac/memory_pressure_monitor_mac.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7
8 namespace base {
9
10 class TestMemoryPressureMonitorMac : public MemoryPressureMonitorMac {
11 public:
12 using MemoryPressureMonitorMac::MemoryPressureLevelForMacMemoryPressure;
13
14 TestMemoryPressureMonitorMac() { }
15
16 private:
17 DISALLOW_COPY_AND_ASSIGN(TestMemoryPressureMonitorMac);
18 };
19
20 TEST(TestMemoryPressureMonitorMac, MemoryPressureFromMacMemoryPressure) {
21 EXPECT_EQ(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE,
22 TestMemoryPressureMonitorMac::
23 MemoryPressureLevelForMacMemoryPressure(
24 DISPATCH_MEMORYPRESSURE_NORMAL));
25 EXPECT_EQ(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE,
26 TestMemoryPressureMonitorMac::
27 MemoryPressureLevelForMacMemoryPressure(
28 DISPATCH_MEMORYPRESSURE_WARN));
29 EXPECT_EQ(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL,
30 TestMemoryPressureMonitorMac::
31 MemoryPressureLevelForMacMemoryPressure(
32 DISPATCH_MEMORYPRESSURE_CRITICAL));
33 EXPECT_EQ(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE,
34 TestMemoryPressureMonitorMac::
35 MemoryPressureLevelForMacMemoryPressure(0));
36 EXPECT_EQ(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE,
37 TestMemoryPressureMonitorMac::
38 MemoryPressureLevelForMacMemoryPressure(3));
39 EXPECT_EQ(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE,
40 TestMemoryPressureMonitorMac::
41 MemoryPressureLevelForMacMemoryPressure(5));
42 EXPECT_EQ(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE,
43 TestMemoryPressureMonitorMac::
44 MemoryPressureLevelForMacMemoryPressure(-1));
45 }
46
47 TEST(TestMemoryPressureMonitorMac, CurrentMemoryPressure) {
48 TestMemoryPressureMonitorMac monitor;
49 MemoryPressureListener::MemoryPressureLevel memory_pressure =
50 monitor.GetCurrentPressureLevel();
51 EXPECT_TRUE(memory_pressure ==
52 MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE ||
53 memory_pressure ==
54 MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE ||
55 memory_pressure ==
56 MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL);
57 }
58
59 } // namespace base
OLDNEW
« no previous file with comments | « base/mac/memory_pressure_monitor_mac.cc ('k') | base/mac/scoped_nsobject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698