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

Side by Side Diff: content/browser/memory/memory_monitor_android_unittest.cc

Issue 2340293003: Add MemoryMonitorAndroid (Closed)
Patch Set: Use native callback instead of returning MemoryInfo Created 4 years, 2 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 "content/browser/memory/memory_monitor_android.h" 5 #include "content/browser/memory/memory_monitor_android.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace content { 9 namespace content {
10 10
11 class MemoryMonitorAndroidTest : public testing::Test { 11 class MemoryMonitorAndroidTest : public testing::Test {
12 public: 12 public:
13 MemoryMonitorAndroidTest() : monitor_(MemoryMonitorAndroid::Create()) {} 13 MemoryMonitorAndroidTest() : monitor_(MemoryMonitorAndroid::Create()) {}
14 14
15 protected: 15 protected:
16 std::unique_ptr<MemoryMonitorAndroid> monitor_; 16 std::unique_ptr<MemoryMonitorAndroid> monitor_;
17 }; 17 };
18 18
19 TEST_F(MemoryMonitorAndroidTest, CanGetMemoryInfo) {
20 EXPECT_TRUE(monitor_->CanGetMemoryInfo());
21 }
22
23 TEST_F(MemoryMonitorAndroidTest, GetMemoryInfo) { 19 TEST_F(MemoryMonitorAndroidTest, GetMemoryInfo) {
24 MemoryMonitorAndroid::MemoryInfo info; 20 MemoryMonitorAndroid::MemoryInfo info;
25 monitor_->GetMemoryInfo(&info); 21 monitor_->GetMemoryInfo(&info);
26 EXPECT_GT(info.avail_mem, 0); 22 EXPECT_GT(info.avail_mem, 0);
27 EXPECT_GT(info.threshold, 0); 23 EXPECT_GT(info.threshold, 0);
28 EXPECT_GT(info.total_mem, 0); 24 EXPECT_GT(info.total_mem, 0);
29 } 25 }
30 26
31 } // namespace content 27 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698